commit e4110e83008ff4dfc47ee5cd1214e83c8cfbe9e4 Author: 陈浩杰 <1411307268@qq.com> Date: Fri Oct 11 16:01:13 2024 +0800 feat: init git diff --git a/Configs/CRM_configs/sd_v2_base_ipmv_chin8_zero_snr.yaml b/Configs/CRM_configs/sd_v2_base_ipmv_chin8_zero_snr.yaml new file mode 100644 index 0000000..0c0b128 --- /dev/null +++ b/Configs/CRM_configs/sd_v2_base_ipmv_chin8_zero_snr.yaml @@ -0,0 +1,74 @@ +model: + target: CRM.imagedream.ldm.interface.LatentDiffusionInterface + params: + linear_start: 0.00085 + linear_end: 0.0120 + timesteps: 1000 + scale_factor: 0.18215 + parameterization: "eps" + zero_snr: true + + unet_config: + target: CRM.imagedream.ldm.modules.diffusionmodules.openaimodel.MultiViewUNetModelStage2 + params: + image_size: 32 # unused + in_channels: 8 + out_channels: 4 + model_channels: 320 + attention_resolutions: [ 4, 2, 1 ] + num_res_blocks: 2 + channel_mult: [ 1, 2, 4, 4 ] + num_head_channels: 64 # need to fix for flash-attn + use_spatial_transformer: True + use_linear_in_transformer: True + transformer_depth: 1 + context_dim: 1024 + use_checkpoint: False + legacy: False + camera_dim: 16 + with_ip: True + ip_dim: 16 # ip token length + ip_mode: "local_resample" + + vae_config: + target: CRM.imagedream.ldm.models.autoencoder.AutoencoderKL + params: + embed_dim: 4 + monitor: val/rec_loss + ddconfig: + #attn_type: "vanilla-xformers" + double_z: true + z_channels: 4 + resolution: 256 + in_channels: 3 + out_ch: 3 + ch: 128 + ch_mult: + - 1 + - 2 + - 4 + - 4 + num_res_blocks: 2 + attn_resolutions: [] + dropout: 0.0 + lossconfig: + target: torch.nn.Identity + + clip_config: + target: CRM.imagedream.ldm.modules.encoders.modules.FrozenOpenCLIPEmbedder + params: + freeze: True + layer: "penultimate" + ip_mode: "local_resample" + + +sampler: + target: CRM.libs.sample.ImageDreamDiffusionStage2 + params: + mode: pixel + num_frames: 6 + camera_views: [1, 2, 3, 4, 5, 0] + ref_position: null + random_background: false + offset_noise: true + resize_rate: 1.0 \ No newline at end of file diff --git a/Configs/CRM_configs/sd_v2_base_ipmv_zero_SNR.yaml b/Configs/CRM_configs/sd_v2_base_ipmv_zero_SNR.yaml new file mode 100644 index 0000000..e1c845e --- /dev/null +++ b/Configs/CRM_configs/sd_v2_base_ipmv_zero_SNR.yaml @@ -0,0 +1,73 @@ +model: + target: CRM.imagedream.ldm.interface.LatentDiffusionInterface + params: + linear_start: 0.00085 + linear_end: 0.0120 + timesteps: 1000 + scale_factor: 0.18215 + parameterization: "eps" + zero_snr: true + + unet_config: + target: CRM.imagedream.ldm.modules.diffusionmodules.openaimodel.MultiViewUNetModel + params: + image_size: 32 # unused + in_channels: 4 + out_channels: 4 + model_channels: 320 + attention_resolutions: [ 4, 2, 1 ] + num_res_blocks: 2 + channel_mult: [ 1, 2, 4, 4 ] + num_head_channels: 64 # need to fix for flash-attn + use_spatial_transformer: True + use_linear_in_transformer: True + transformer_depth: 1 + context_dim: 1024 + use_checkpoint: False + legacy: False + camera_dim: 16 + with_ip: True + ip_dim: 16 # ip token length + ip_mode: "local_resample" + + vae_config: + target: CRM.imagedream.ldm.models.autoencoder.AutoencoderKL + params: + embed_dim: 4 + monitor: val/rec_loss + ddconfig: + #attn_type: "vanilla-xformers" + double_z: true + z_channels: 4 + resolution: 256 + in_channels: 3 + out_ch: 3 + ch: 128 + ch_mult: + - 1 + - 2 + - 4 + - 4 + num_res_blocks: 2 + attn_resolutions: [] + dropout: 0.0 + lossconfig: + target: torch.nn.Identity + + clip_config: + target: CRM.imagedream.ldm.modules.encoders.modules.FrozenOpenCLIPEmbedder + params: + freeze: True + layer: "penultimate" + ip_mode: "local_resample" + +sampler: + target: CRM.libs.sample.ImageDreamDiffusion + params: + mode: pixel + num_frames: 7 + camera_views: [1, 2, 3, 4, 5, 0, 0] + ref_position: 6 + random_background: false + offset_noise: true + resize_rate: 1.0 \ No newline at end of file diff --git a/Configs/CRM_configs/specs_objaverse_total.json b/Configs/CRM_configs/specs_objaverse_total.json new file mode 100644 index 0000000..c99ebee --- /dev/null +++ b/Configs/CRM_configs/specs_objaverse_total.json @@ -0,0 +1,57 @@ +{ + "Input": { + "img_num": 16, + "class": "all", + "camera_angle_num": 8, + "tet_grid_size": 80, + "validate_num": 16, + "scale": 0.95, + "radius": 3, + "resolution": [256, 256] + }, + + "Pretrain": { + "mode": null, + "sdf_threshold": 0.1, + "sdf_scale": 10, + "batch_infer": false, + "lr": 1e-4, + "radius": 0.5 + }, + + "Train": { + "mode": "rnd", + "num_epochs": 500, + "grad_acc": 1, + "warm_up": 0, + "decay": 0.000, + "learning_rate": { + "init": 1e-4, + "sdf_decay": 1, + "rgb_decay": 1 + }, + "batch_size": 4, + "eva_iter": 80, + "eva_all_epoch": 10, + "tex_sup_mode": "blender", + "exp_uv_mesh": false, + "doub": false, + "random_bg": false, + "shift": 0, + "aug_shift": 0, + "geo_type": "flex" + }, + + "ArchSpecs": { + "unet_type": "diffusers", + "use_3D_aware": false, + "fea_concat": false, + "mlp_bias": true + }, + + "DecoderSpecs": { + "c_dim": 32, + "plane_resolution": 256 + } +} + diff --git a/Configs/CharacterGen_configs/Stage_2D_infer.yaml b/Configs/CharacterGen_configs/Stage_2D_infer.yaml new file mode 100644 index 0000000..0737967 --- /dev/null +++ b/Configs/CharacterGen_configs/Stage_2D_infer.yaml @@ -0,0 +1,23 @@ +pretrained_model_path: "stabilityai/stable-diffusion-2-1" +image_encoder_path: "./2D_Stage/models/image_encoder" +ckpt_dir: "./2D_Stage/models/checkpoint" + +validation: + use_inv_latent: False + video_length: 4 + +use_pose_guider: True +use_noise: False +use_shifted_noise: False +unet_condition_type: image + +unet_from_pretrained_kwargs: + camera_embedding_type: 'e_de_da_sincos' + projection_class_embeddings_input_dim: 10 # modify + joint_attention: false # modify + num_views: 4 + sample_size: 96 + zero_init_conv_in: false + zero_init_camera_projection: false + in_channels: 4 + use_safetensors: true \ No newline at end of file diff --git a/Configs/CharacterGen_configs/Stage_3D_infer.yaml b/Configs/CharacterGen_configs/Stage_3D_infer.yaml new file mode 100644 index 0000000..edfad17 --- /dev/null +++ b/Configs/CharacterGen_configs/Stage_3D_infer.yaml @@ -0,0 +1,104 @@ +system_cls: CharacterGen.Stage_3D.lrm.systems.multiview_lrm.MultiviewLRM +data: + cond_width: 504 + cond_height: 504 + +system: + weights: 3D_Stage/models/lrm.ckpt + + weights_ignore_modules: + - decoder.heads.density + + check_train_every_n_steps: 100 + + camera_embedder_cls: CharacterGen.Stage_3D.lrm.models.camera.LinearCameraEmbedder + camera_embedder: + in_channels: 16 + out_channels: 768 + conditions: + - c2w_cond + + # image tokenizer transforms input images to tokens + image_tokenizer_cls: CharacterGen.Stage_3D.lrm.models.tokenizers.image.DINOV2SingleImageTokenizer + image_tokenizer: + pretrained_model_name_or_path: "3D_Stage/models/base" + freeze_backbone_params: false + enable_memory_efficient_attention: true + enable_gradient_checkpointing: true + # camera modulation to the DINO transformer layers + modulation: true + modulation_zero_init: true + modulation_single_layer: true + modulation_cond_dim: ${system.camera_embedder.out_channels} + + # tokenizer gives a tokenized representation for the 3D scene + # triplane tokens in this case + tokenizer_cls: CharacterGen.Stage_3D.lrm.models.tokenizers.triplane.TriplaneLearnablePositionalEmbedding + tokenizer: + plane_size: 32 + num_channels: 512 + + # backbone network is a transformer that takes scene tokens (potentially with conditional image tokens) + # and outputs scene tokens of the same size + backbone_cls: CharacterGen.Stage_3D.lrm.models.transformers.transformer_1d.Transformer1D + backbone: + in_channels: ${system.tokenizer.num_channels} + num_attention_heads: 16 + attention_head_dim: 64 + num_layers: 12 + cross_attention_dim: 768 # hard-code, =DINO feature dim + # camera modulation to the transformer layers + # if not needed, set norm_type=layer_norm and do not specify cond_dim_ada_norm_continuous + norm_type: "layer_norm" + enable_memory_efficient_attention: true + gradient_checkpointing: true + + # post processor takes scene tokens and outputs the final scene parameters that will be used for rendering + # in this case, triplanes are upsampled and the features are condensed + post_processor_cls: CharacterGen.Stage_3D.lrm.models.networks.TriplaneUpsampleNetwork + post_processor: + in_channels: 512 + out_channels: 80 + + renderer_cls: CharacterGen.Stage_3D.lrm.models.renderers.triplane_dmtet.TriplaneDMTetRenderer + renderer: + radius: 0.6 # slightly larger than 0.5 + feature_reduction: concat + sdf_bias: -2. + tet_dir: "tets" + isosurface_resolution: 256 + enable_isosurface_grid_deformation: false + sdf_activation: negative + + decoder_cls: CharacterGen.Stage_3D.lrm.models.networks.MultiHeadMLP + decoder: + in_channels: 240 # 3 * 80 + n_neurons: 64 + n_hidden_layers_share: 8 + heads: + - name: sdf + out_channels: 1 + n_hidden_layers: 1 + output_activation: null + - name: features + out_channels: 3 + n_hidden_layers: 1 + output_activation: null # activate in material + activation: silu + chunk_mode: deferred + chunk_size: 131072 + + exporter: + fmt: "obj" + #visual: "vertex" + visual: "uv" + save_uv: True + save_texture: True + uv_unwrap_method: "open3d" + output_path: "3D_Stage/outputs" + + material_cls: CharacterGen.Stage_3D.lrm.models.materials.no_material.NoMaterial + + background_cls: CharacterGen.Stage_3D.lrm.models.background.solid_color_background.SolidColorBackground + background: + color: [0.5, 0.5, 0.5] \ No newline at end of file diff --git a/Configs/Craftsman_config.yaml b/Configs/Craftsman_config.yaml new file mode 100644 index 0000000..2bef790 --- /dev/null +++ b/Configs/Craftsman_config.yaml @@ -0,0 +1,143 @@ +name: michelangelo-image-to-shape-diffusion/clip-mvrgb-modln-l256-e64-ne8-nd16-nl6-170k +description: '' +tag: michelangelo-aligned-autoencoder+n4096+noise0.0+pfeat3+zeroemb0.0+normembFalse+lr5e-05+qkvbiasFalse+nfreq8+ln_postTrue +seed: 0 +use_timestamp: true +timestamp: '' +exp_root_dir: outputs +exp_dir: outputs/michelangelo-image-to-shape-diffusion/clip-mvrgb-modln-l256-e64-ne8-nd16-nl6-170k +trial_name: michelangelo-aligned-autoencoder+n4096+noise0.0+pfeat3+zeroemb0.0+normembFalse+lr5e-05+qkvbiasFalse+nfreq8+ln_postTrue +trial_dir: outputs/michelangelo-image-to-shape-diffusion/clip-mvrgb-modln-l256-e64-ne8-nd16-nl6-170k/michelangelo-aligned-autoencoder+n4096+noise0.0+pfeat3+zeroemb0.0+normembFalse+lr5e-05+qkvbiasFalse+nfreq8+ln_postTrue +n_gpus: 8 +resume: ./ckpts/3DNativeGeneration/michelangelo-image-to-shape-diffusion/clip-mvrgb-modln-l256-e64-ne8-nd16-nl6-170k.ckpt +data_type: objaverse-datamodule +data: + root_dir: data/objaverse_clean/cap3d_high_quality_170k_images + data_type: occupancy + n_samples: 4096 + noise_sigma: 0.0 + load_supervision: false + supervision_type: occupancy + n_supervision: 10000 + load_image: true + image_data_path: data/objaverse_clean/raw_data/images/cap3d_high_quality_170k + image_type: mvrgb + idx: + - 0 + - 4 + - 8 + - 12 + - 16 + n_views: 4 + load_caption: false + rotate_points: false + batch_size: 32 + num_workers: 16 +system_type: shape-diffusion-system +system: + val_samples_json: val_data/mv_images/val_samples_rgb_mvimage.json + z_scale_factor: 1.0 + guidance_scale: 7.5 + num_inference_steps: 50 + eta: 0.0 + shape_model_type: michelangelo-aligned-autoencoder + shape_model: + num_latents: 256 + embed_dim: 64 + point_feats: 3 + out_dim: 1 + num_freqs: 8 + include_pi: false + heads: 12 + width: 768 + num_encoder_layers: 8 + num_decoder_layers: 16 + use_ln_post: true + init_scale: 0.25 + qkv_bias: false + use_flash: true + use_checkpoint: true + condition_model_type: clip-embedder + condition_model: + pretrained_model_name_or_path: openai/clip-vit-large-patch14 + encode_camera: true + camera_embeds_dim: 32 + n_views: 4 + empty_embeds_ratio: 0.1 + normalize_embeds: false + zero_uncond_embeds: true + denoiser_model_type: simple-denoiser + denoiser_model: + input_channels: 64 + output_channels: 64 + n_ctx: 256 + width: 768 + layers: 6 + heads: 12 + context_dim: 1024 + init_scale: 1.0 + skip_ln: true + use_checkpoint: true + noise_scheduler_type: diffusers.schedulers.DDPMScheduler + noise_scheduler: + num_train_timesteps: 1000 + beta_start: 0.00085 + beta_end: 0.012 + beta_schedule: scaled_linear + variance_type: fixed_small + clip_sample: false + denoise_scheduler_type: diffusers.schedulers.DDIMScheduler + denoise_scheduler: + num_train_timesteps: 1000 + beta_start: 0.00085 + beta_end: 0.012 + beta_schedule: scaled_linear + clip_sample: false + set_alpha_to_one: false + steps_offset: 1 + loggers: + wandb: + enable: false + project: JiangXin + name: text-to-shape-diffusion+michelangelo-image-to-shape-diffusion/clip-mvrgb-modln-l256-e64-ne8-nd16-nl6-170k+michelangelo-aligned-autoencoder+n4096+noise0.0+pfeat3+zeroemb0.0+normembFalse+lr5e-05+qkvbiasFalse+nfreq8+ln_postTrue + loss: + loss_type: mse + lambda_diffusion: 1.0 + optimizer: + name: AdamW + args: + lr: 5.0e-05 + betas: + - 0.9 + - 0.99 + eps: 1.0e-06 + scheduler: + name: SequentialLR + interval: step + schedulers: + - name: LinearLR + interval: step + args: + start_factor: 1.0e-06 + end_factor: 1.0 + total_iters: 5000 + - name: CosineAnnealingLR + interval: step + args: + T_max: 5000 + eta_min: 0.0 + milestones: + - 5000 +trainer: + num_nodes: 2 + max_epochs: 100000 + log_every_n_steps: 5 + num_sanity_val_steps: 1 + check_val_every_n_epoch: 3 + enable_progress_bar: true + precision: 16-mixed + strategy: ddp_find_unused_parameters_true +checkpoint: + save_last: true + save_top_k: -1 + every_n_train_steps: 5000 diff --git a/Configs/Era3D_config.yaml b/Configs/Era3D_config.yaml new file mode 100644 index 0000000..4839db5 --- /dev/null +++ b/Configs/Era3D_config.yaml @@ -0,0 +1,8 @@ +num_views: 6 + +dataset: + prompt_embeds_path: Gen_3D_Modules/Era3D/mvdiffusion/data/fixed_prompt_embeds_6view + num_views: ${num_views} + bg_color: 'white' + img_wh: [512, 512] + num_validation_samples: 1000 diff --git a/Configs/InstantMesh_configs/instant_mesh_base.yaml b/Configs/InstantMesh_configs/instant_mesh_base.yaml new file mode 100644 index 0000000..c2867de --- /dev/null +++ b/Configs/InstantMesh_configs/instant_mesh_base.yaml @@ -0,0 +1,15 @@ +model_config: + target: InstantMesh.models.lrm_mesh.InstantMesh + params: + encoder_feat_dim: 768 + encoder_freeze: false + encoder_model_name: facebook/dino-vitb16 + transformer_dim: 1024 + transformer_layers: 12 + transformer_heads: 16 + triplane_low_res: 32 + triplane_high_res: 64 + triplane_dim: 40 + rendering_samples_per_ray: 96 + grid_res: 128 + grid_scale: 2.1 \ No newline at end of file diff --git a/Configs/InstantMesh_configs/instant_mesh_large.yaml b/Configs/InstantMesh_configs/instant_mesh_large.yaml new file mode 100644 index 0000000..feae2b0 --- /dev/null +++ b/Configs/InstantMesh_configs/instant_mesh_large.yaml @@ -0,0 +1,15 @@ +model_config: + target: InstantMesh.models.lrm_mesh.InstantMesh + params: + encoder_feat_dim: 768 + encoder_freeze: false + encoder_model_name: facebook/dino-vitb16 + transformer_dim: 1024 + transformer_layers: 16 + transformer_heads: 16 + triplane_low_res: 32 + triplane_high_res: 64 + triplane_dim: 80 + rendering_samples_per_ray: 128 + grid_res: 128 + grid_scale: 2.1 \ No newline at end of file diff --git a/Configs/InstantMesh_configs/instant_nerf_base.yaml b/Configs/InstantMesh_configs/instant_nerf_base.yaml new file mode 100644 index 0000000..d07feb5 --- /dev/null +++ b/Configs/InstantMesh_configs/instant_nerf_base.yaml @@ -0,0 +1,13 @@ +model_config: + target: InstantMesh.models.lrm.InstantNeRF + params: + encoder_feat_dim: 768 + encoder_freeze: false + encoder_model_name: facebook/dino-vitb16 + transformer_dim: 1024 + transformer_layers: 12 + transformer_heads: 16 + triplane_low_res: 32 + triplane_high_res: 64 + triplane_dim: 40 + rendering_samples_per_ray: 96 \ No newline at end of file diff --git a/Configs/InstantMesh_configs/instant_nerf_large.yaml b/Configs/InstantMesh_configs/instant_nerf_large.yaml new file mode 100644 index 0000000..45f9573 --- /dev/null +++ b/Configs/InstantMesh_configs/instant_nerf_large.yaml @@ -0,0 +1,13 @@ +model_config: + target: InstantMesh.models.lrm.InstantNeRF + params: + encoder_feat_dim: 768 + encoder_freeze: false + encoder_model_name: facebook/dino-vitb16 + transformer_dim: 1024 + transformer_layers: 16 + transformer_heads: 16 + triplane_low_res: 32 + triplane_high_res: 64 + triplane_dim: 80 + rendering_samples_per_ray: 128 \ No newline at end of file diff --git a/Configs/StableFast3D_config.yaml b/Configs/StableFast3D_config.yaml new file mode 100644 index 0000000..4f6a60f --- /dev/null +++ b/Configs/StableFast3D_config.yaml @@ -0,0 +1,96 @@ +cond_image_size: 512 +isosurface_resolution: 160 +radius: 0.87 + +camera_embedder_cls: StableFast3D.sf3d.models.camera.LinearCameraEmbedder +camera_embedder: + in_channels: 25 + out_channels: 768 + conditions: + - c2w_cond + - intrinsic_normed_cond + +image_tokenizer_cls: StableFast3D.sf3d.models.tokenizers.image.DINOV2SingleImageTokenizer +image_tokenizer: + pretrained_model_name_or_path: "facebook/dinov2-large" + width: 512 + height: 512 + modulation_cond_dim: 768 + +tokenizer_cls: StableFast3D.sf3d.models.tokenizers.triplane.TriplaneLearnablePositionalEmbedding +tokenizer: + plane_size: 96 + num_channels: 1024 + +backbone_cls: StableFast3D.sf3d.models.transformers.backbone.TwoStreamInterleaveTransformer +backbone: + num_attention_heads: 16 + attention_head_dim: 64 + raw_triplane_channels: 1024 + triplane_channels: 1024 + raw_image_channels: 1024 # DINO features + num_latents: 1792 + num_blocks: 4 + num_basic_blocks: 3 + +post_processor_cls: StableFast3D.sf3d.models.network.PixelShuffleUpsampleNetwork +post_processor: + in_channels: 1024 + out_channels: 40 + scale_factor: 4 + conv_layers: 4 + + +decoder_cls: StableFast3D.sf3d.models.network.MaterialMLP +decoder: + in_channels: 120 + n_neurons: 64 + activation: silu + heads: + - name: density + out_channels: 1 + out_bias: -1.0 + n_hidden_layers: 2 + output_activation: trunc_exp + - name: features + out_channels: 3 + n_hidden_layers: 3 + output_activation: sigmoid + - name: perturb_normal + out_channels: 3 + n_hidden_layers: 3 + output_activation: normalize_channel_last + - name: vertex_offset + out_channels: 3 + n_hidden_layers: 2 + +image_estimator_cls: StableFast3D.sf3d.models.image_estimator.clip_based_estimator.ClipBasedHeadEstimator +image_estimator: + distribution: beta + distribution_eval: mode + heads: + - name: roughness + out_channels: 1 + n_hidden_layers: 3 + output_activation: linear + add_to_decoder_features: true + output_bias: 1.0 + shape: [-1, 1, 1] + - name: metallic + out_channels: 1 + n_hidden_layers: 3 + output_activation: linear + add_to_decoder_features: true + output_bias: 1.0 + shape: [-1, 1, 1] + +global_estimator_cls: StableFast3D.sf3d.models.global_estimator.multi_head_estimator.MultiHeadEstimator +global_estimator: + triplane_features: 1024 + heads: + - name: sg_amplitudes + out_channels: 24 + n_hidden_layers: 3 + output_activation: softplus + output_bias: 1.0 + shape: [-1, 24, 1] diff --git a/Configs/TriplaneGaussian_config.yaml b/Configs/TriplaneGaussian_config.yaml new file mode 100644 index 0000000..4acb337 --- /dev/null +++ b/Configs/TriplaneGaussian_config.yaml @@ -0,0 +1,150 @@ +data: + background_color: [1.0, 1.0, 1.0] + cond_width: 252 # multiply of 14 + cond_height: 252 + + relative_pose: true + + num_workers: 16 + eval_batch_size: 1 + eval_height: 512 + eval_width: 512 + +system: + camera_embedder_cls: TriplaneGaussian.models.networks.MLP + camera_embedder: + dim_in: 25 # c2w + [fx, fy, cx, cy] + dim_out: 768 + n_neurons: 768 + n_hidden_layers: 1 + activation: silu + + image_feature: + out_dim: 773 + + image_tokenizer_cls: TriplaneGaussian.models.tokenizers.image.DINOV2SingleImageTokenizer + image_tokenizer: + pretrained_model_name_or_path: "facebook/dinov2-base" + width: ${data.cond_width} + height: ${data.cond_height} + + modulation: true + modulation_zero_init: true + modulation_single_layer: true + modulation_cond_dim: ${system.camera_embedder.dim_out} # c2w + intrinsic + + freeze_backbone_params: false + enable_memory_efficient_attention: ${system.backbone.enable_memory_efficient_attention} + enable_gradient_checkpointing: ${system.backbone.gradient_checkpointing} + + tokenizer_cls: TriplaneGaussian.models.tokenizers.triplane.TriplaneLearnablePositionalEmbedding + tokenizer: + plane_size: 32 + num_channels: 512 + + backbone_cls: TriplaneGaussian.models.transformers.Transformer1D + backbone: + in_channels: ${system.tokenizer.num_channels} + num_attention_heads: 8 + attention_head_dim: 64 + num_layers: 10 + cross_attention_dim: 768 # hard-code, =DINO feature dim + + norm_type: "layer_norm" + + enable_memory_efficient_attention: false + gradient_checkpointing: false + + post_processor_cls: TriplaneGaussian.models.networks.TriplaneUpsampleNetwork + post_processor: + in_channels: ${system.tokenizer.num_channels} + out_channels: 80 + + pointcloud_generator_cls: TriplaneGaussian.models.pointclouds.simplepoint.SimplePointGenerator + pointcloud_generator: + camera_embedder_cls: TriplaneGaussian.models.networks.MLP + camera_embedder: + dim_in: 25 # c2w + [fx, fy, cx, cy] + dim_out: 768 + n_neurons: 768 + n_hidden_layers: 1 + activation: silu + + image_tokenizer_cls: TriplaneGaussian.models.tokenizers.image.DINOV2SingleImageTokenizer + image_tokenizer: + pretrained_model_name_or_path: "facebook/dinov2-base" + width: ${data.cond_width} + height: ${data.cond_height} + + modulation: true + modulation_zero_init: true + modulation_single_layer: true + modulation_cond_dim: ${system.camera_embedder.dim_out} # c2w + intrinsic + + freeze_backbone_params: true + enable_memory_efficient_attention: ${system.backbone.enable_memory_efficient_attention} + enable_gradient_checkpointing: false + + tokenizer_cls: TriplaneGaussian.models.tokenizers.point.PointLearnablePositionalEmbedding + tokenizer: + num_pcl: 2048 + num_channels: 512 + + backbone_cls: TriplaneGaussian.models.transformers.Transformer1D + backbone: + in_channels: ${system.pointcloud_generator.tokenizer.num_channels} + num_attention_heads: 8 + attention_head_dim: 64 + num_layers: 10 + cross_attention_dim: 768 # hard-code, =DINO feature dim + + norm_type: "layer_norm" + + enable_memory_efficient_attention: ${system.backbone.enable_memory_efficient_attention} + gradient_checkpointing: ${system.backbone.gradient_checkpointing} + + post_processor_cls: TriplaneGaussian.models.networks.PointOutLayer + post_processor: + in_channels: 512 + out_channels: 3 + + pointcloud_upsampling_cls: TriplaneGaussian.models.snowflake.model_spdpp.SnowflakeModelSPDPP + pointcloud_upsampling: + input_channels: 768 + dim_feat: 128 + num_p0: 2048 + radius: 1 + bounding: true + use_fps: true + up_factors: [2,4] + token_type: "image_token" + + pointcloud_encoder_cls: TriplaneGaussian.models.pointclouds.pointnet.LocalPoolPointnet + pointcloud_encoder: + input_channels: 776 # 3 + 3 + 768 + 1 + 1 [xyz, local features] + c_dim: ${system.tokenizer.num_channels} + hidden_dim: 128 + plane_size: ${system.tokenizer.plane_size} + n_blocks: 5 + radius: ${system.renderer.radius} + + renderer_cls: TriplaneGaussian.models.renderer.GS3DRenderer + renderer: + sh_degree: 3 + radius: 0.6 + mlp_network_config: + n_neurons: ${system.renderer.gs_out.in_channels} + n_hidden_layers: 2 + activation: silu + gs_out: + in_channels: 128 + xyz_offset: true + restrict_offset: true + use_rgb: false + feature_channels: + xyz: 3 + scaling: 3 + rotation: 4 + opacity: 1 + shs: ${shsdim:${system.renderer.sh_degree}} + clip_scaling: 0.2 \ No newline at end of file diff --git a/Configs/TripoSR_config.yaml b/Configs/TripoSR_config.yaml new file mode 100644 index 0000000..9a0cea4 --- /dev/null +++ b/Configs/TripoSR_config.yaml @@ -0,0 +1,38 @@ +cond_image_size: 512 + +image_tokenizer_cls: TripoSR.models.tokenizers.image.DINOSingleImageTokenizer +image_tokenizer: + pretrained_model_name_or_path: "facebook/dino-vitb16" + +tokenizer_cls: TripoSR.models.tokenizers.triplane.Triplane1DTokenizer +tokenizer: + plane_size: 32 + num_channels: 1024 + +backbone_cls: TripoSR.models.transformer.transformer_1d.Transformer1D +backbone: + in_channels: ${tokenizer.num_channels} + num_attention_heads: 16 + attention_head_dim: 64 + num_layers: 16 + cross_attention_dim: 768 + +post_processor_cls: TripoSR.models.network_utils.TriplaneUpsampleNetwork +post_processor: + in_channels: 1024 + out_channels: 40 + +decoder_cls: TripoSR.models.network_utils.NeRFMLP +decoder: + in_channels: 120 # 3 * 40 + n_neurons: 64 + n_hidden_layers: 9 + activation: silu + +renderer_cls: TripoSR.models.nerf_renderer.TriplaneNeRFRenderer +renderer: + radius: 0.87 # slightly larger than 0.5 * sqrt(3) + feature_reduction: concat + density_activation: exp + density_bias: -1.0 + num_samples_per_ray: 128 \ No newline at end of file diff --git a/Configs/Unique3D_configs/image2mvimage.yaml b/Configs/Unique3D_configs/image2mvimage.yaml new file mode 100644 index 0000000..2057073 --- /dev/null +++ b/Configs/Unique3D_configs/image2mvimage.yaml @@ -0,0 +1,43 @@ +init_config: + # enable controls + enable_cross_attn_lora: False + enable_cross_attn_ip: False + enable_self_attn_lora: False + enable_self_attn_ref: False + enable_multiview_attn: True + + # for cross attention + init_cross_attn_lora: False + init_cross_attn_ip: False + cross_attn_lora_rank: 256 # 0 for not enabled + cross_attn_lora_only_kv: False + ipadapter_pretrained_name: "h94/IP-Adapter" + ipadapter_subfolder_name: "models" + ipadapter_weight_name: "ip-adapter_sd15.safetensors" + ipadapter_effect_on: "all" # all, first + + # for self attention + init_self_attn_lora: False + self_attn_lora_rank: 256 + self_attn_lora_only_kv: False + + # for self attention ref + init_self_attn_ref: False + self_attn_ref_position: "attn1" + self_attn_ref_other_model_name: "lambdalabs/sd-image-variations-diffusers" + self_attn_ref_pixel_wise_crosspond: False + self_attn_ref_effect_on: "all" + + # for multiview attention + init_multiview_attn: True + multiview_attn_position: "attn1" + use_mv_joint_attn: True + num_modalities: 1 + + # for unet + init_unet_path: "" + cat_condition: True # cat condition to input + + # for cls embedding + init_num_cls_label: 8 # for initialize + cls_labels: [0, 1, 2, 3] # for current task \ No newline at end of file diff --git a/Configs/Unique3D_configs/image2normal.yaml b/Configs/Unique3D_configs/image2normal.yaml new file mode 100644 index 0000000..271e41a --- /dev/null +++ b/Configs/Unique3D_configs/image2normal.yaml @@ -0,0 +1,44 @@ +pretrained_model_name_or_path: "lambdalabs/sd-image-variations-diffusers" + +init_config: + # enable controls + enable_cross_attn_lora: False + enable_cross_attn_ip: False + enable_self_attn_lora: False + enable_self_attn_ref: True + enable_multiview_attn: False + + # for cross attention + init_cross_attn_lora: False + init_cross_attn_ip: False + cross_attn_lora_rank: 512 # 0 for not enabled + cross_attn_lora_only_kv: False + ipadapter_pretrained_name: "h94/IP-Adapter" + ipadapter_subfolder_name: "models" + ipadapter_weight_name: "ip-adapter_sd15.safetensors" + ipadapter_effect_on: "all" # all, first + + # for self attention + init_self_attn_lora: False + self_attn_lora_rank: 512 + self_attn_lora_only_kv: False + + # for self attention ref + init_self_attn_ref: True + self_attn_ref_position: "attn1" + self_attn_ref_other_model_name: "lambdalabs/sd-image-variations-diffusers" + self_attn_ref_pixel_wise_crosspond: True + self_attn_ref_effect_on: "all" + + # for multiview attention + init_multiview_attn: False + multiview_attn_position: "attn1" + num_modalities: 1 + + # for unet + init_unet_path: "${pretrained_model_name_or_path}" + init_num_cls_label: 0 # for initialize + cls_labels: [] # for current task + + + diff --git a/Configs/Wonder3D_config.yaml b/Configs/Wonder3D_config.yaml new file mode 100644 index 0000000..419f866 --- /dev/null +++ b/Configs/Wonder3D_config.yaml @@ -0,0 +1,42 @@ +#pretrained_model_name_or_path: 'flamehaze1115/wonder3d-v1.0' # or './ckpts' +revision: null +validation_dataset: + root_dir: "./example_images" # the folder path stores testing images + num_views: 6 + bg_color: 'white' + img_wh: [256, 256] + num_validation_samples: 1000 + crop_size: 192 + filepaths: ['owl.png'] # the test image names. leave it empty, test all images in the folder + +save_dir: 'outputs/' + +pred_type: 'joint' +seed: 42 +validation_batch_size: 1 +dataloader_num_workers: 64 + +local_rank: -1 + +pipe_kwargs: + camera_embedding_type: 'e_de_da_sincos' + num_views: 6 + +validation_guidance_scales: [1.0] +pipe_validation_kwargs: + eta: 1.0 +validation_grid_nrow: 6 + +unet_from_pretrained_kwargs: + camera_embedding_type: 'e_de_da_sincos' + projection_class_embeddings_input_dim: 10 + num_views: 6 + sample_size: 32 + cd_attention_mid: true + zero_init_conv_in: false + zero_init_camera_projection: false + +num_views: 6 +camera_embedding_type: 'e_de_da_sincos' + +enable_xformers_memory_efficient_attention: true \ No newline at end of file diff --git a/Configs/system.conf b/Configs/system.conf new file mode 100644 index 0000000..7811129 --- /dev/null +++ b/Configs/system.conf @@ -0,0 +1,14 @@ +web{ + clients_ip = [ + 127.0.0.1, + 0.0.0.0, + // docker have default ip for host in container of subnet 172.17.0.0/16 + // althrought there would be 172.18.0.0 + 172.17.0.0, + 172.17.0.1, + ] +} + +huggingface{ + token = "" # Your user access token to enable automatic download restricted model card +} \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..bf0df38 --- /dev/null +++ b/__init__.py @@ -0,0 +1,41 @@ +import importlib.util +import glob +import os +import sys +import inspect +import folder_paths as comfy_paths +from pyhocon import ConfigFactory +from .webserver.server import server, set_web_conf +from .shared_utils.log_utils import setup_logger +from .pysssss import init, get_ext_dir + +NODE_CLASS_MAPPINGS = {} +NODE_DISPLAY_NAME_MAPPINGS = {} + +ROOT_PATH = os.path.join(comfy_paths.get_folder_paths("custom_nodes")[0], "ComfyUI-Rodin") +sys.path.append(ROOT_PATH) + +conf_path = os.path.join(ROOT_PATH, "Configs/system.conf") +f = open(conf_path) +conf_text = f.read() +f.close() +sys_conf = ConfigFactory.parse_string(conf_text) + +set_web_conf(sys_conf['web']) + +if init(): + py = get_ext_dir("py") + files = glob.glob(os.path.join(py, "*.py"), recursive=False) + for file in files: + name = os.path.splitext(file)[0] + spec = importlib.util.spec_from_file_location(name, file) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + if hasattr(module, "NODE_CLASS_MAPPINGS") and getattr(module, "NODE_CLASS_MAPPINGS") is not None: + NODE_CLASS_MAPPINGS.update(module.NODE_CLASS_MAPPINGS) + if hasattr(module, "NODE_DISPLAY_NAME_MAPPINGS") and getattr(module, "NODE_DISPLAY_NAME_MAPPINGS") is not None: + NODE_DISPLAY_NAME_MAPPINGS.update(module.NODE_DISPLAY_NAME_MAPPINGS) + +WEB_DIRECTORY = "./web" +__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"] diff --git a/__pycache__/__init__.cpython-311.pyc b/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b613783 Binary files /dev/null and b/__pycache__/__init__.cpython-311.pyc differ diff --git a/__pycache__/pysssss.cpython-311.pyc b/__pycache__/pysssss.cpython-311.pyc new file mode 100644 index 0000000..8a34005 Binary files /dev/null and b/__pycache__/pysssss.cpython-311.pyc differ diff --git a/asset/error.png b/asset/error.png new file mode 100644 index 0000000..24cef4f Binary files /dev/null and b/asset/error.png differ diff --git a/py/__pycache__/hyperhuman.cpython-311.pyc b/py/__pycache__/hyperhuman.cpython-311.pyc new file mode 100644 index 0000000..9aa2065 Binary files /dev/null and b/py/__pycache__/hyperhuman.cpython-311.pyc differ diff --git a/py/__pycache__/hyperhuman_Rodin.cpython-311.pyc b/py/__pycache__/hyperhuman_Rodin.cpython-311.pyc new file mode 100644 index 0000000..6527b31 Binary files /dev/null and b/py/__pycache__/hyperhuman_Rodin.cpython-311.pyc differ diff --git a/py/hyperhuman_Rodin.py b/py/hyperhuman_Rodin.py new file mode 100644 index 0000000..5251fbf --- /dev/null +++ b/py/hyperhuman_Rodin.py @@ -0,0 +1,579 @@ +import requests +import torch +import os + +import trimesh.exchange +import trimesh.exchange.gltf +import folder_paths as comfy_paths +import logging +import time +import urllib.request +import datetime +import shutil +import glob +import json +import random +import time +import sys +from tqdm import tqdm +from server import PromptServer +from aiohttp import web +from PIL import Image, ImageOps, ImageSequence, ImageFile +from PIL.PngImagePlugin import PngInfo +import node_helpers +import numpy as np +import io +import comfy.utils +import trimesh + +ROOT_PATH = os.path.join(comfy_paths.get_folder_paths("custom_nodes")[0], "ComfyUI-Rodin") +CONFIG_ROOT_PATH = os.path.join(ROOT_PATH, "Configs") + + +# Constants +BASE_URL = "https://hyperhuman.deemos.com/api/v2" +API_HEADERS = {} + +API_KEY_PARAMETER = { + "api_key": ("APIKEY", {"forceInput": True, "multiline": True}), +} + +COMMON_PARAMETERS = { + "tier": (["Regular", "Sketch"], {"default": "Regular"}), + "seed_": ("INT", {"default": 0, "min": 0, "max": 65535, "step": 1, "display": "number", }), + "geometry_file_format": + (["glb", "usdz", "fbx", "obj", "stl"], + {"default": "glb", "label_off": "glb", + "pysssss.binding": [{ + "source": "tier", + "callback": [{ + "type": "if", + "condition": [{"left": "$source.value", "op": "eq", "right": '"Sketch"'}], + "true": [{ + "type": "set", "target": "$this.options.values", "value": ["glb"] + }, { + "type": "set", "target": "$this.value", "value": '"glb"' + }, { + "type": "set", "target": "$this.disabled", "value": True + },], + "false": [{ + "type": "set", "target": "$this.disabled", "value": False + }, { + "type": "set", "target": "$this.options.values", "value": ["glb", "usdz", "fbx", "obj", "stl"] + }], + }] + }] + }), + "material": + (["PBR", "Shaded"], + {"default": "PBR", + "pysssss.binding": [{ + "source": "tier", + "callback": [{ + "type": "if", + "condition": [{"left": "$source.value", "op": "eq", "right": '"Sketch"'}], + "true": [{ + "type": "set", "target": "$this.options.values", "value": ["PBR"] + }, { + "type": "set", "target": "$this.value", "value": '"PBR"' + }, + { + "type": "set", "target": "$this.disabled", "value": True + },], + "false": [{ + "type": "set", "target": "$this.disabled", "value": False + }, { + "type": "set", "target": "$this.options.values", "value": ["PBR", "Shaded"] + }], + }] + }] + }), + "quality": + (["high", "medium", "low", "extra-low"], + {"default": "medium", + "pysssss.binding": [{ + "source": "tier", + "callback": [{ + "type": "if", + "condition": [{"left": "$source.value", "op": "eq", "right": '"Sketch"'}], + "true": [{ + "type": "set", "target": "$this.options.values", "value": ["medium"] + }, { + "type": "set", "target": "$this.value", "value": '"medium"' + }, { + "type": "set", "target": "$this.disabled", "value": True + },], + "false": [{ + "type": "set", "target": "$this.disabled", "value": False + }, { + "type": "set", "target": "$this.options.values", "value": ["high", "medium", "low", "extra-low"] + }], + }] + }] + }), + "use_hyper": + ("BOOLEAN", + {"default": False, + "pysssss.binding": [{ + "source": "tier", + "callback": [{ + "type": "if", + "condition": [{"left": "$source.value", "op": "eq", "right": '"Sketch"' + }], + "true": [{ + "type": "set", "target": "$this.value", "value": False + }, { + "type": "set", "target": "$this.disabled", "value": True + },], + "false": [{ + "type": "set", "target": "$this.disabled", "value": False + }, { + "type": "set", "target": "$this.options.values", "value": "$result" + }], + }] + }] + }), +} + +SUPPORTED_3D_EXTENSIONS = ( + '.obj', + '.glb', + '.fbx', + '.stl', + '.usdz', +) + + +def post_request(url, api_key, data, files=None, max_retries=5, delay=2): + headers = {"Authorization": f"Bearer {api_key}"} + full_url = f"{BASE_URL}/{url}" + + for attempt in range(max_retries): + try: + response = requests.post(full_url, headers={**API_HEADERS, **headers}, data=data, files=files) + response.raise_for_status() + return response.json() + except requests.ConnectionError as e: + logging.info(f"Connection error: {e}. Retrying {attempt + 1}/{max_retries}...") + except requests.Timeout as e: + logging.info(f"Timeout error: {e}. Retrying {attempt + 1}/{max_retries}...") + except requests.HTTPError as e: + logging.info(f"HTTP error: {e}. Response: {response.text if response else 'No response'}") + + break + except Exception as e: + logging.info(f"An unexpected error occurred: {e}. Retrying {attempt + 1}/{max_retries}...") + + time.sleep(delay) + + logging.info("[ Rodin3D.process_request ] Max retries reached. Request failed.") + return None + + + +def check_status(api_key, subscription_key): + data = {"subscription_key": subscription_key} + return post_request("status", api_key, data)["jobs"] + +def load_image(image_path): + img = node_helpers.pillow(Image.open, image_path) + + output_images = [] + w, h = None, None + + excluded_formats = ['MPO'] + + for i in ImageSequence.Iterator(img): + i = node_helpers.pillow(ImageOps.exif_transpose, i) + + if i.mode == 'I': + i = i.point(lambda i: i * (1 / 255)) + image = i.convert("RGB") + + if len(output_images) == 0: + w = image.size[0] + h = image.size[1] + + if image.size[0] != w or image.size[1] != h: + continue + + image = np.array(image).astype(np.float32) / 255.0 + image = torch.from_numpy(image)[None,] + if 'A' in i.getbands(): + mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0 + mask = 1. - torch.from_numpy(mask) + else: + mask = torch.zeros((64,64), dtype=torch.float32, device="cpu") + output_images.append(image) + + if len(output_images) > 1 and img.format not in excluded_formats: + output_image = torch.cat(output_images, dim=0) + else: + output_image = output_images[0] + + return output_image + +def handle_image(img): + for i in ImageSequence.Iterator(img): + i = node_helpers.pillow(ImageOps.exif_transpose, i) + + if i.mode == 'I': + i = i.point(lambda i: i * (1 / 255)) + image = i.convert("RGB") + w = image.size[0] + h = image.size[1] + + if image.size[0] != w or image.size[1] != h: + continue + + image = np.array(image).astype(np.float32) / 255.0 + image = torch.from_numpy(image)[None,] + if 'A' in i.getbands(): + mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0 + mask = 1. - torch.from_numpy(mask) + else: + mask = torch.zeros((64,64), dtype=torch.float32, device="cpu") + return image + +def download_files(api_key, uuid): + data = {"task_uuid": uuid} + files_info = post_request("download", api_key, data) + save_path = os.path.join(comfy_paths.get_output_directory(), datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")) + os.makedirs(save_path, exist_ok=True) + + shaded = diffuse = normal = pbr = load_image('custom_nodes/ComfyUI-Rodin/asset/error.png') + for file_info in files_info["list"]: + filename = file_info["name"].split('/')[-1] + file_path = os.path.join(save_path, filename) + if file_path.endswith(SUPPORTED_3D_EXTENSIONS): + model_file_path = file_path + print(f"[ download_files ] Downloading file: {file_path}") + with requests.get(file_info["url"], stream=True) as r: + if file_path.endswith('.glb'): + kwargs = trimesh.exchange.gltf.load_glb(r.raw); + shaded = handle_image(kwargs['geometry']['model']['visual'].material.baseColorTexture) + diffuse = handle_image(kwargs['geometry']['model']['visual'].material.baseColorTexture) + normal = handle_image(kwargs['geometry']['model']['visual'].material.normalTexture) + pbr = handle_image(kwargs['geometry']['model']['visual'].material.metallicRoughnessTexture) + with open(file_path, "wb") as f: + shutil.copyfileobj(r.raw, f) + if filename == "shaded.png": + shaded = load_image(file_path) + elif filename == "texture_diffuse.png": + diffuse = load_image(file_path) + elif filename == "texture_normal.png": + normal = load_image(file_path) + elif filename == "texture_pbr.png": + pbr = load_image(file_path) + + + #logging.info(model_file_path) + + return shaded, diffuse, normal, pbr, model_file_path, + + +def tensor_to_filelike(tensor): + """ + Converts a PyTorch tensor to a file-like object. + + Args: + - tensor (torch.Tensor): A tensor representing an image of shape (H, W, C) + where C is the number of channels (3 for RGB), H is height, and W is width. + + Returns: + - io.BytesIO: A file-like object containing the image data. + """ + array = tensor.cpu().numpy() + array = (array * 255).astype('uint8') + image = Image.fromarray(array, 'RGB') + img_byte_arr = io.BytesIO() + image.save(img_byte_arr, format='PNG') # PNG is used for lossless compression + img_byte_arr.seek(0) + return img_byte_arr + +def LogInfomation(data, name): + logging.info(f"[ Rodin3D.process_request ]\n{name} =") + if isinstance(data, (dict)): + logging.info(json.dumps(data, indent=4)) + elif isinstance(data, (list)) and name == "files": + logging.info(repr(data)) + elif isinstance(data, (list)) and name == "status": + table_header = f"{'UUID':<40} {'Status':<12}" + separator = '-' * 52 + logging.info(table_header) + logging.info(separator) + for item in data: + logging.info(f"{item['uuid']:<40} {item['status']:<12}") + + + + +class Rodin3D: + + RETURN_TYPES = ("IMAGE", "IMAGE", "IMAGE", "IMAGE", "STRING", ) + RETURN_NAMES = ("shaded", "diffuse", "normal", "pbr", "model_path") + FUNCTION = "main_func" + OUTPUT_NODE = True + CATEGORY = "Mesh/Rodin" + + def process_request(self, api_key, images, prompt, condition_mode, seed, geometry_file_format, material, quality, use_hyper, tier) -> None: + # Prepare request data and files + files = [ + ( + "images", + open(image, "rb") if isinstance(image, str) else tensor_to_filelike(image[0]) + ) + for image in images if image is not None] + data = { + "prompt": prompt, + "condition_mode": condition_mode, + "seed": seed, + "geometry_file_format": geometry_file_format, + "material": material, + "quality": quality, + "use_hyper": use_hyper, + "tier": tier, + } + #logging.info(f"[ Rodin3D.process_request ]\n data = {data}, files = {files}") + LogInfomation(data, "data") + LogInfomation(files, "files") + response = post_request("rodin", api_key, data, files=files) + + # Submit and handle the response + if "uuid" in response: + shaded, diffuse, normal, pbr, model_path = self.submit_poll_download(api_key, data, response['uuid'], response['jobs']['subscription_key']) + return shaded, diffuse, normal, pbr, model_path, + else: + logging.info(f"[ Rodin3D.process_request ] Error submitting the job:\n{response}") + + def submit_poll_download(self, api_key, data, uuid, subscription_key): + """Submits the job, polls for its completion, and downloads the result when ready.""" + polling_interval = 2 # Interval in seconds to wait between checks + + total_seconds_estimated = 20 if data["tier"] == "Sketch" else 60 + pbar = comfy.utils.ProgressBar(total_seconds_estimated) + + while True: + status = check_status(api_key, subscription_key) + #logging.info(f"[ Rodin3D.process_request ] status = {status}") + LogInfomation(status, "status") + + if all([job["status"] == "Done" for job in status]): + logging.info(f"[ Rodin3D.process_request ] Generation complete. Downloading files...") + save_model_path = download_files(api_key, uuid) + print(f"[save model path] : {save_model_path}") + return save_model_path + + time.sleep(polling_interval) + pbar.update(2) + + +class RodinImage3D(Rodin3D): + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + **API_KEY_PARAMETER, + "image": ("IMAGE", {"forceInput": True, "multiline": True}), + }, + "optional": { + "prompt": ("STRING",{"forceInput":True,"multiline": True}), + **COMMON_PARAMETERS + }, + } + + def main_func(self, api_key, image, seed_, geometry_file_format, material, quality, use_hyper, tier, prompt=None): + images = [image] + condition_mode = "concat" + + shaded, diffuse, normal, pbr, model_path = self.process_request(api_key, images, prompt, condition_mode, seed_, geometry_file_format, material, quality, use_hyper, tier) + #logging.info(m_model_path) + #logging.info(type(m_model_path)) + return (shaded, diffuse, normal, pbr, model_path) + + +class RodinMultipleImage3D(RodinImage3D): + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + **API_KEY_PARAMETER, + }, + "optional": { + "image_1": ("IMAGE", {"forceInput": True, "multiline": True}), + "image_2": ("IMAGE", {"forceInput": True, "multiline": True}), + "image_3": ("IMAGE", {"forceInput": True, "multiline": True}), + "image_4": ("IMAGE", {"forceInput": True, "multiline": True}), + "image_5": ("IMAGE", {"forceInput": True, "multiline": True}), + "prompt": ("STRING",{"forceInput":True,"multiline": True}), + "condition_mode": (["concat", "fuse"], {"default": "concat"}), + **COMMON_PARAMETERS + }, + } + + def main_func(self, api_key, seed_, geometry_file_format, material, quality, use_hyper, tier, condition_mode, image_1=None, image_2=None, image_3=None, image_4=None, image_5=None, prompt=None): + images = [image_1, image_2, image_3, image_4, image_5] + # Filter out None values + images = [img for img in images if img is not None] + + model_path = self.process_request(api_key, images, prompt, condition_mode, seed_, geometry_file_format, material, quality, use_hyper, tier) + + return (model_path,) + + +class RodinText3D(RodinImage3D): + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + **API_KEY_PARAMETER, + "prompt": ("STRING", {"forceInput": True, "multiline": True}), + }, + "optional": { + **COMMON_PARAMETERS + }, + } + + def main_func(self, api_key, prompt, seed_, geometry_file_format, material, quality, use_hyper, tier): + images = [] + condition_mode = None + + model_path = self.process_request(api_key, images, prompt, condition_mode, seed_, geometry_file_format, material, quality, use_hyper, tier) + + return (model_path,) + + +class PromptForRodin: + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("prompt",) + + FUNCTION = "main_func" + CATEGORY = "Mesh/Rodin" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ("STRING", {"default": "A textual prompt to guide the 3d generation.", "multiline": True}) + } + } + + def main_func(self, prompt): + return (prompt,) + + +class LoadRodinAPIKEY: + + RETURN_TYPES = ("APIKEY",) + RETURN_NAMES = ("api_key",) + FUNCTION = "main_func" + CATEGORY = "Mesh/Rodin" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "api_key": ("STRING", {"default": "Get your API KEY from: https://hyperhuman.deemos.com/api-dashboard", "multiline": True}) + }, + } + + def main_func(self, api_key): + return (api_key,) + + + +class Preview_3DMesh: + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model_path":("STRING", {"default": '', "multiline": False,"forceInput": True, }), + # NOTE: function which draging model file and getting the file path has done + # "test": ("MODELUPLOAD", {"widget": "model_path"}), + }, + # "optional": { + # "shaded":("IMAGE", {"multiline": True}), + # "diffuse":("IMAGE", { "multiline": True}), + # "normal":("IMAGE", {"multiline": True}), + # "pbr":("IMAGE", {"multiline": True}), + # }, + } + + OUTPUT_NODE = True + RETURN_TYPES = () + FUNCTION = "preview_mesh" + CATEGORY = "Comfy3D/Visualize" + + def save_image(self, images, path): + for (batch_number, image) in enumerate(images): + i = 255. * image.cpu().numpy() + img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) + metadata = None + img.save(path, pnginfo=metadata) + return path + + + def preview_mesh(self, model_path, shaded = None, diffuse = None, normal = None, pbr = None): + + model_folder, filename = os.path.split(model_path) + + + if not os.path.isabs(model_path): + model_folder = os.path.join(comfy_paths.output_directory, model_folder) + model_path = os.path.join(comfy_paths.output_directory, model_path) + + if not filename.lower().endswith(SUPPORTED_3D_EXTENSIONS): + logging.error(f"[{self.__class__.__name__}] File name {filename} does not end with supported 3D file extensions: {SUPPORTED_3D_EXTENSIONS}") + model_path = "" + # shaded_path = diffuse_path = normal_path = pbr_path = '' + + # if shaded is not None: + # self.save_image(shaded, model_folder + '/shaded.png'); + # shaded_path = model_folder + '/texture_shaded.png' + # if diffuse is not None: + # self.save_image(diffuse, model_folder + '/diffuse.png'); + # diffuse_path = model_folder + '/texture_diffuse.png' + # if normal is not None: + # self.save_image(normal, model_folder + '/normal.png'); + # normal_path = model_folder + '/texture_normal.png' + # if pbr is not None: + # self.save_image(pbr, model_folder + '/pbr.png'); + # pbr_path = model_folder + '/texture_pbr.png' + + previews = [ + { + "model_path": model_path, + # "shaded_path": shaded_path, + # "diffuse_path": diffuse_path, + # "normal_path": normal_path, + # "pbr_path": pbr_path, + } + ] + return {"ui": {"previews": previews}, "result": ()} + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "RodinImage3D": RodinImage3D, + "RodinMultipleImage3D": RodinMultipleImage3D, + "RodinText3D": RodinText3D, + "PromptForRodin": PromptForRodin, + "LoadRodinAPIKEY": LoadRodinAPIKEY, + "Preview_3DMesh":Preview_3DMesh, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "RodinImage3D": "Rodin - Image to 3D", + "RodinMultipleImage3D": "Rodin - Multiple Images to 3D", + "RodinText3D": "Rodin - Text to 3D", + "PromptForRodin": "Rodin - Prompt for Rodin", + "LoadRodinAPIKEY": "Rodin - API KEY", + "Preview_3DMesh":"Rodin - Preview 3D Mesh", +} diff --git a/pysssss.default.json b/pysssss.default.json new file mode 100644 index 0000000..6ca0642 --- /dev/null +++ b/pysssss.default.json @@ -0,0 +1,4 @@ +{ + "name": "CustomScripts", + "logging": false +} diff --git a/pysssss.example.json b/pysssss.example.json new file mode 100644 index 0000000..251e3c7 --- /dev/null +++ b/pysssss.example.json @@ -0,0 +1,7 @@ +{ + "name": "CustomScripts", + "logging": false, + "workflows": { + "directory": "C:\\ComfyUI-Workflows" + } +} diff --git a/pysssss.json b/pysssss.json new file mode 100644 index 0000000..6ca0642 --- /dev/null +++ b/pysssss.json @@ -0,0 +1,4 @@ +{ + "name": "CustomScripts", + "logging": false +} diff --git a/pysssss.py b/pysssss.py new file mode 100644 index 0000000..b1024f5 --- /dev/null +++ b/pysssss.py @@ -0,0 +1,300 @@ +import asyncio +import os +import json +import shutil +import inspect +import aiohttp +from server import PromptServer +from tqdm import tqdm + +config = None + + +def is_logging_enabled(): + config = get_extension_config() + if "logging" not in config: + return False + return config["logging"] + + +def log(message, type=None, always=False, name=None): + if not always and not is_logging_enabled(): + return + + if type is not None: + message = f"[{type}] {message}" + + if name is None: + name = get_extension_config()["name"] + + print(f"(pysssss:{name}) {message}") + + +def get_ext_dir(subpath=None, mkdir=False): + dir = os.path.dirname(__file__) + if subpath is not None: + dir = os.path.join(dir, subpath) + + dir = os.path.abspath(dir) + + if mkdir and not os.path.exists(dir): + os.makedirs(dir) + return dir + + +def get_comfy_dir(subpath=None, mkdir=False): + dir = os.path.dirname(inspect.getfile(PromptServer)) + if subpath is not None: + dir = os.path.join(dir, subpath) + + dir = os.path.abspath(dir) + + if mkdir and not os.path.exists(dir): + os.makedirs(dir) + return dir + + +def get_web_ext_dir(): + config = get_extension_config() + name = config["name"] + dir = get_comfy_dir("web/extensions/pysssss") + if not os.path.exists(dir): + os.makedirs(dir) + dir = os.path.join(dir, name) + return dir + + +def get_extension_config(reload=False): + global config + if reload == False and config is not None: + return config + + config_path = get_ext_dir("pysssss.json") + default_config_path = get_ext_dir("pysssss.default.json") + if not os.path.exists(config_path): + if os.path.exists(default_config_path): + shutil.copy(default_config_path, config_path) + if not os.path.exists(config_path): + log(f"Failed to create config at {config_path}", type="ERROR", always=True, name="???") + print(f"Extension path: {get_ext_dir()}") + return {"name": "Unknown", "version": -1} + + else: + log("Missing pysssss.default.json, this extension may not work correctly. Please reinstall the extension.", + type="ERROR", always=True, name="???") + print(f"Extension path: {get_ext_dir()}") + return {"name": "Unknown", "version": -1} + + with open(config_path, "r") as f: + config = json.loads(f.read()) + return config + + +def link_js(src, dst): + src = os.path.abspath(src) + dst = os.path.abspath(dst) + if os.name == "nt": + try: + import _winapi + _winapi.CreateJunction(src, dst) + return True + except: + pass + try: + os.symlink(src, dst) + return True + except: + import logging + logging.exception('') + return False + + +def is_junction(path): + if os.name != "nt": + return False + try: + return bool(os.readlink(path)) + except OSError: + return False + + +def install_js(): + src_dir = get_ext_dir("web/js") + if not os.path.exists(src_dir): + log("No JS") + return + + should_install = should_install_js() + if should_install: + log("it looks like you're running an old version of ComfyUI that requires manual setup of web files, it is recommended you update your installation.", "warning", True) + dst_dir = get_web_ext_dir() + linked = os.path.islink(dst_dir) or is_junction(dst_dir) + if linked or os.path.exists(dst_dir): + if linked: + if should_install: + log("JS already linked") + else: + os.unlink(dst_dir) + log("JS unlinked, PromptServer will serve extension") + elif not should_install: + shutil.rmtree(dst_dir) + log("JS deleted, PromptServer will serve extension") + return + + if not should_install: + log("JS skipped, PromptServer will serve extension") + return + + if link_js(src_dir, dst_dir): + log("JS linked") + return + + log("Copying JS files") + shutil.copytree(src_dir, dst_dir, dirs_exist_ok=True) + + +def should_install_js(): + return not hasattr(PromptServer.instance, "supports") or "custom_nodes_from_web" not in PromptServer.instance.supports + + +def init(check_imports=None): + log("Init") + + if check_imports is not None: + import importlib.util + for imp in check_imports: + spec = importlib.util.find_spec(imp) + if spec is None: + log(f"{imp} is required, please check requirements are installed.", + type="ERROR", always=True) + return False + + install_js() + return True + + +def get_async_loop(): + loop = None + try: + loop = asyncio.get_event_loop() + except: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + return loop + + +def get_http_session(): + loop = get_async_loop() + return aiohttp.ClientSession(loop=loop) + + +async def download(url, stream, update_callback=None, session=None): + close_session = False + if session is None: + close_session = True + session = get_http_session() + try: + async with session.get(url) as response: + size = int(response.headers.get('content-length', 0)) or None + + with tqdm( + unit='B', unit_scale=True, miniters=1, desc=url.split('/')[-1], total=size, + ) as progressbar: + perc = 0 + async for chunk in response.content.iter_chunked(2048): + stream.write(chunk) + progressbar.update(len(chunk)) + if update_callback is not None and progressbar.total is not None and progressbar.total != 0: + last = perc + perc = round(progressbar.n / progressbar.total, 2) + if perc != last: + last = perc + await update_callback(perc) + finally: + if close_session and session is not None: + await session.close() + + +async def download_to_file(url, destination, update_callback=None, is_ext_subpath=True, session=None): + if is_ext_subpath: + destination = get_ext_dir(destination) + with open(destination, mode='wb') as f: + download(url, f, update_callback, session) + + +def wait_for_async(async_fn, loop=None): + res = [] + + async def run_async(): + r = await async_fn() + res.append(r) + + if loop is None: + try: + loop = asyncio.get_event_loop() + except: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + loop.run_until_complete(run_async()) + + return res[0] + + +def update_node_status(client_id, node, text, progress=None): + if client_id is None: + client_id = PromptServer.instance.client_id + + if client_id is None: + return + + PromptServer.instance.send_sync("pysssss/update_status", { + "node": node, + "progress": progress, + "text": text + }, client_id) + + +async def update_node_status_async(client_id, node, text, progress=None): + if client_id is None: + client_id = PromptServer.instance.client_id + + if client_id is None: + return + + await PromptServer.instance.send("pysssss/update_status", { + "node": node, + "progress": progress, + "text": text + }, client_id) + + +def get_config_value(key, default=None, throw=False): + split = key.split(".") + obj = get_extension_config() + for s in split: + if s in obj: + obj = obj[s] + else: + if throw: + raise KeyError("Configuration key missing: " + key) + else: + return default + return obj + + +def is_inside_dir(root_dir, check_path): + root_dir = os.path.abspath(root_dir) + if not os.path.isabs(check_path): + check_path = os.path.abspath(os.path.join(root_dir, check_path)) + return os.path.commonpath([check_path, root_dir]) == root_dir + + +def get_child_dir(root_dir, child_path, throw_if_outside=True): + child_path = os.path.abspath(os.path.join(root_dir, child_path)) + if is_inside_dir(root_dir, child_path): + return child_path + if throw_if_outside: + raise NotADirectoryError( + "Saving outside the target folder is not allowed.") + return None diff --git a/shared_utils/__init__.py b/shared_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shared_utils/__pycache__/__init__.cpython-311.pyc b/shared_utils/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7ce9b46 Binary files /dev/null and b/shared_utils/__pycache__/__init__.cpython-311.pyc differ diff --git a/shared_utils/__pycache__/log_utils.cpython-311.pyc b/shared_utils/__pycache__/log_utils.cpython-311.pyc new file mode 100644 index 0000000..ad7bc06 Binary files /dev/null and b/shared_utils/__pycache__/log_utils.cpython-311.pyc differ diff --git a/shared_utils/camera_utils.py b/shared_utils/camera_utils.py new file mode 100644 index 0000000..a272d9f --- /dev/null +++ b/shared_utils/camera_utils.py @@ -0,0 +1,258 @@ +from abc import ABC, abstractmethod + +import numpy as np +import math +from scipy.spatial.transform import Rotation as R + +import torch + +from kiui.cam import orbit_camera + +def dot(x, y): + if isinstance(x, np.ndarray): + return np.sum(x * y, -1, keepdims=True) + else: + return torch.sum(x * y, -1, keepdim=True) + + +def length(x, eps=1e-20): + if isinstance(x, np.ndarray): + return np.sqrt(np.maximum(np.sum(x * x, axis=-1, keepdims=True), eps)) + else: + return torch.sqrt(torch.clamp(dot(x, x), min=eps)) + + +def safe_normalize(x, eps=1e-20): + return x / length(x, eps) + + +def look_at(campos, target, opengl=True): + # campos: [N, 3], camera/eye position + # target: [N, 3], object to look at + # return: [N, 3, 3], rotation matrix + if not opengl: + # camera forward aligns with -z + forward_vector = safe_normalize(target - campos) + up_vector = np.array([0, 1, 0], dtype=np.float32) + right_vector = safe_normalize(np.cross(forward_vector, up_vector)) + up_vector = safe_normalize(np.cross(right_vector, forward_vector)) + else: + # camera forward aligns with +z + forward_vector = safe_normalize(campos - target) + up_vector = np.array([0, 1, 0], dtype=np.float32) + right_vector = safe_normalize(np.cross(up_vector, forward_vector)) + up_vector = safe_normalize(np.cross(forward_vector, right_vector)) + R = np.stack([right_vector, up_vector, forward_vector], axis=1) + return R + +def get_look_at_camera_pose(target, target_to_cam_offset, look_distance=0.1, opengl=True): + """ + Calculate the pose (cam2world) matrix from target position the camera suppose to look at and offset vector from target to camera + + Args: + target (NDArray[float32], shape: 3): the target position the camera suppose to look at + target_to_cam_dir (NDArray[float32], shape: 3): offset direction from target to camera + look_distance (float, optional): length of offset vector from target to camera. + + Returns: + NDArray[float32]: shape: (4, 4), pose (cam2world) matrix + """ + + norm=np.linalg.norm(target_to_cam_offset) + if norm==0: + norm=np.finfo(np.float32).eps + target_to_cam_offset = look_distance * target_to_cam_offset / norm + + campos = target_to_cam_offset + target # [3] + T = np.eye(4, dtype=np.float32) + T[:3, :3] = look_at(campos, target, opengl) + T[:3, 3] = campos + return T + +class OrbitCamera: + def __init__(self, W, H, r=2, fovy=60, near=0.01, far=100): + self.W = W + self.H = H + self.radius = r # camera distance from center + self.fovy = np.deg2rad(fovy) # deg 2 rad + self.near = near + self.far = far + self.center = np.array([0, 0, 0], dtype=np.float32) # look at this point + self.rot = R.from_matrix(np.eye(3)) + self.up = np.array([0, 1, 0], dtype=np.float32) # need to be normalized! + + @property + def fovx(self): + return 2 * np.arctan(np.tan(self.fovy / 2) * self.W / self.H) + + @property + def campos(self): + return self.pose[:3, 3] + + # pose (c2w) + @property + def pose(self): + # first move camera to radius + res = np.eye(4, dtype=np.float32) + res[2, 3] = self.radius # opengl convention... + # rotate + rot = np.eye(4, dtype=np.float32) + rot[:3, :3] = self.rot.as_matrix() + res = rot @ res + # translate + res[:3, 3] -= self.center + return res + + # view (w2c) + @property + def view(self): + return np.linalg.inv(self.pose) + + # projection (perspective) + @property + def perspective(self): + y = np.tan(self.fovy / 2) + aspect = self.W / self.H + return np.array( + [ + [1 / (y * aspect), 0, 0, 0], + [0, -1 / y, 0, 0], + [ + 0, + 0, + -(self.far + self.near) / (self.far - self.near), + -(2 * self.far * self.near) / (self.far - self.near), + ], + [0, 0, -1, 0], + ], + dtype=np.float32, + ) + + # intrinsics + @property + def intrinsics(self): + focal = self.H / (2 * np.tan(self.fovy / 2)) + return np.array([focal, focal, self.W // 2, self.H // 2], dtype=np.float32) + + @property + def mvp(self): + return self.perspective @ np.linalg.inv(self.pose) # [4, 4] + + def orbit(self, dx, dy): + # rotate along camera up/side axis! + side = self.rot.as_matrix()[:3, 0] + rotvec_x = self.up * np.radians(-0.05 * dx) + rotvec_y = side * np.radians(-0.05 * dy) + self.rot = R.from_rotvec(rotvec_x) * R.from_rotvec(rotvec_y) * self.rot + + def scale(self, delta): + self.radius *= 1.1 ** (-delta) + + def pan(self, dx, dy, dz=0): + # pan in camera coordinate system (careful on the sensitivity!) + self.center += 0.0005 * self.rot.as_matrix()[:3, :3] @ np.array([-dx, -dy, dz]) + +def calculate_fovX(H, W, fovy): + return 2 * np.arctan(np.tan(fovy / 2) * W / H) + +def get_projection_matrix(znear, zfar, fovX, fovY, z_sign=1.0): + tanHalfFovY = math.tan((fovY / 2)) + tanHalfFovX = math.tan((fovX / 2)) + + P = torch.zeros(4, 4) + + P[0, 0] = 1 / tanHalfFovX + P[1, 1] = 1 / tanHalfFovY + P[3, 2] = z_sign + P[2, 2] = z_sign * zfar / (zfar - znear) + P[2, 3] = -(zfar * znear) / (zfar - znear) + return P + + +class MiniCam: + def __init__(self, c2w, width, height, fovy, fovx, znear, zfar, projection_matrix=None): + # c2w (pose) should be in NeRF convention. + + self.image_width = width + self.image_height = height + self.FoVy = fovy + self.FoVx = fovx + self.znear = znear + self.zfar = zfar + + w2c = np.linalg.inv(c2w) + + # rectify... + w2c[1:3, :3] *= -1 + w2c[:3, 3] *= -1 + + self.world_view_transform = torch.tensor(w2c).transpose(0, 1).cuda() + self.projection_matrix = ( + get_projection_matrix( + znear=self.znear, zfar=self.zfar, fovX=self.FoVx, fovY=self.FoVy + ) + .transpose(0, 1) + .cuda() + ) if projection_matrix is None else projection_matrix + self.full_proj_transform = self.world_view_transform @ self.projection_matrix + self.camera_center = -torch.tensor(c2w[:3, 3]).cuda() + +class BaseCameraController(ABC): + def __init__(self, renderer, cam_size_W, cam_size_H, reference_orbit_camera_fovy, invert_bg_prob=1.0, static_bg=None, device='cuda'): + self.device = torch.device(device) + + self.renderer = renderer + self.cam = OrbitCamera(cam_size_W, cam_size_H, fovy=reference_orbit_camera_fovy) + + self.invert_bg_prob = invert_bg_prob + self.black_bg = torch.tensor([0, 0, 0], dtype=torch.float32, device=self.device) + self.white_bg = torch.tensor([1, 1, 1], dtype=torch.float32, device=self.device) + self.static_bg = None if static_bg is None else torch.tensor(static_bg, dtype=torch.float32, device=self.device) + + self.post_init() + + super().__init__() + + def post_init(self): + # Calls after default initialize at the end of __init__() + pass + + @abstractmethod + def get_render_result(self, render_pose, bg_color, **kwargs): + pass + + def render_at_pose(self, cam_pose, **kwargs): + radius, elevation, azimuth, center_X, center_Y, center_Z = cam_pose + + orbit_target = np.array([center_X, center_Y, center_Z], dtype=np.float32) + render_pose = orbit_camera(elevation, azimuth, radius, target=orbit_target) + + if self.static_bg is None: + bg_color = self.white_bg if np.random.rand() > self.invert_bg_prob else self.black_bg + else: + bg_color = self.static_bg + + return self.get_render_result(render_pose, bg_color, **kwargs) + + def render_all_pose(self, all_cam_poses, **kwargs): + all_rendered_images, all_rendered_masks = [], [] + extra_outputs = {} + for cam_pose in all_cam_poses: + out = self.render_at_pose(cam_pose, **kwargs) + + image = out["image"] # [3, H, W] in [0, 1] + mask = out["alpha"] # [1, H, W] in [0, 1] + + all_rendered_images.append(image) + all_rendered_masks.append(mask) + + for k in out: + if k not in extra_outputs: + extra_outputs[k] = [] + extra_outputs[k].append(out[k]) + + for k in extra_outputs: + extra_outputs[k] = torch.stack(extra_outputs[k], dim=0) + + # [Number of Poses, 3, H, W], [Number of Poses, 1, H, W] both in [0, 1] + return torch.stack(all_rendered_images, dim=0), torch.stack(all_rendered_masks, dim=0), extra_outputs \ No newline at end of file diff --git a/shared_utils/common_utils.py b/shared_utils/common_utils.py new file mode 100644 index 0000000..a51d217 --- /dev/null +++ b/shared_utils/common_utils.py @@ -0,0 +1,82 @@ +import os +from os import listdir +from os.path import isfile, join, exists, dirname +import sys +from datetime import datetime +from shared_utils.log_utils import cstr + +def get_parent_dirpath_n_level_up(abs_path, n=1): + for i in range(n): + abs_path = dirname(abs_path) + return abs_path + +def get_persistent_directory(folder_name): + if sys.platform == "win32": + folder = join(os.path.expanduser("~"), "AppData", "Local", folder_name) + else: + folder = join(os.path.expanduser("~"), "." + folder_name) + + os.makedirs(folder, exist_ok=True) + return folder + +def parse_save_filename(save_path, output_directory, supported_extensions, class_name): + + folder_path, filename = os.path.split(save_path) + filename, file_extension = os.path.splitext(filename) + if file_extension.lower() in supported_extensions: + if not os.path.isabs(save_path): + folder_path = join(output_directory, folder_path) + + os.makedirs(folder_path, exist_ok=True) + + # replace time date format to current time + now = datetime.now() # current date and time + all_date_format = ["%Y", "%m", "%d", "%H", "%M", "%S", "%f"] + for date_format in all_date_format: + if date_format in filename: + filename = filename.replace(date_format, now.strftime(date_format)) + + save_path = join(folder_path, filename) + file_extension + cstr(f"[{class_name}] Saving model to {save_path}").msg.print() + return save_path + else: + cstr(f"[{class_name}] File name {filename} does not end with supported file extensions: {supported_extensions}").error.print() + + return None + +def get_list_filenames(directory, extension_filter=None, recursive=False): + """ + Recursively finds files with specified extensions in a directory and returns relative paths. + + Args: + directory (str): The directory path to search. + extension_filter (list): List of file extensions (e.g., ['.txt', '.csv']). + + Returns: + list: List of relative file paths matching the specified extensions. + """ + if exists(directory): + if recursive: + result = [] + for root, _, files in os.walk(directory): + for item in files: + if extension_filter is None or os.path.splitext(item)[1].lower() in extension_filter: + relative_path = os.path.relpath(os.path.join(root, item), directory) + result.append(relative_path) + return result + else: + return [f for f in listdir(directory) if isfile(join(directory, f)) and (extension_filter is None or f.lower().endswith(extension_filter))] + else: + return [] + +# Download pre-trained model if it not exist locally +def resume_or_download_model_from_hf(checkpoints_dir_abs, repo_id, model_name, class_name="", repo_type="model"): + + ckpt_path = os.path.join(checkpoints_dir_abs, model_name) + if not os.path.isfile(ckpt_path): + cstr(f"[{class_name}] can't find checkpoint {ckpt_path}, will download it from repo {repo_id} instead").warning.print() + + from huggingface_hub import hf_hub_download + hf_hub_download(repo_id=repo_id, local_dir=checkpoints_dir_abs, filename=model_name, repo_type=repo_type) + + return ckpt_path diff --git a/shared_utils/image_utils.py b/shared_utils/image_utils.py new file mode 100644 index 0000000..ff9f96a --- /dev/null +++ b/shared_utils/image_utils.py @@ -0,0 +1,198 @@ +import torch +import torch.nn.functional as F +import torchvision.transforms.functional as TF +import numpy as np +from PIL import Image +from typing import Any, Callable, Dict, List, Optional, Tuple, Union + +def prepare_torch_img(img, size_H, size_W, device="cuda", keep_shape=False): + # [N, H, W, C] -> [N, C, H, W] + img_new = img.permute(0, 3, 1, 2).to(device) + img_new = F.interpolate(img_new, (size_H, size_W), mode="bilinear", align_corners=False).contiguous() + if keep_shape: + img_new = img_new.permute(0, 2, 3, 1) + return img_new + +def torch_imgs_to_pils(images, masks=None, alpha_min=0.1): + """ + images (torch): [N, H, W, C] or [H, W, C] + masks (torch): [N, H, W] or [H, W] + """ + if len(images.shape) == 3: + images = images.unsqueeze(0) + + if masks is not None: + if len(masks.shape) == 2: + masks = masks.unsqueeze(0) + + inv_mask_index = masks < alpha_min + images[inv_mask_index] = 0. + + masks = masks.unsqueeze(3) + images = torch.cat((images, masks), dim=3) + mode="RGBA" + else: + mode="RGB" + + pil_image_list = [Image.fromarray((images[i].detach().cpu().numpy() * 255).astype(np.uint8), mode=mode) for i in range(images.shape[0])] + + return pil_image_list + +def troch_image_dilate(img): + """ + Remove thin seams on generated texture + img (torch): [H, W, C] + """ + import cv2 + img = np.asarray(img.cpu().numpy(), dtype=np.float32) + img = img * 255 + img = img.clip(0, 255) + mask = np.sum(img.astype(np.float32), axis=-1, keepdims=True) + mask = (mask <= 3.0).astype(np.float32) + kernel = np.ones((3, 3), 'uint8') + dilate_img = cv2.dilate(img, kernel, iterations=1) + img = img * (1 - mask) + dilate_img * mask + img = (img.clip(0, 255) / 255).astype(np.float32) + return torch.from_numpy(img) + +def pils_to_torch_imgs(pils: Union[Image.Image, List[Image.Image]], device="cuda", force_rgb=True): + if isinstance(pils, Image.Image): + pils = [pils] + + images = [] + for pil in pils: + if pil.mode == "RGBA" and force_rgb: + pil = pil.convert('RGB') + + images.append(TF.to_tensor(pil).permute(1, 2, 0)) + + images = torch.stack(images, dim=0).to(device) + + return images + +def pils_rgba_to_rgb(pils: Union[Image.Image, List[Image.Image]], bkgd="WHITE"): + if isinstance(pils, Image.Image): + pils = [pils] + + rgbs = [] + for pil in pils: + if pil.mode == 'RGBA': + new_image = Image.new("RGBA", pil.size, bkgd) + new_image.paste(pil, (0, 0), pil) + rgbs.append(new_image.convert('RGB')) + else: + rgbs.append(pil) + + return rgbs + +def pil_split_image(image, rows=None, cols=None): + """ + inverse function of make_image_grid + """ + # image is in square + if rows is None and cols is None: + # image.size [W, H] + rows = 1 + cols = image.size[0] // image.size[1] + assert cols * image.size[1] == image.size[0] + subimg_size = image.size[1] + elif rows is None: + subimg_size = image.size[0] // cols + rows = image.size[1] // subimg_size + assert rows * subimg_size == image.size[1] + elif cols is None: + subimg_size = image.size[1] // rows + cols = image.size[0] // subimg_size + assert cols * subimg_size == image.size[0] + else: + subimg_size = image.size[1] // rows + assert cols * subimg_size == image.size[0] + subimgs = [] + for i in range(rows): + for j in range(cols): + subimg = image.crop((j*subimg_size, i*subimg_size, (j+1)*subimg_size, (i+1)*subimg_size)) + subimgs.append(subimg) + return subimgs + +def pil_make_image_grid(images, rows=None, cols=None): + if rows is None and cols is None: + rows = 1 + cols = len(images) + if rows is None: + rows = len(images) // cols + if len(images) % cols != 0: + rows += 1 + if cols is None: + cols = len(images) // rows + if len(images) % rows != 0: + cols += 1 + total_imgs = rows * cols + if total_imgs > len(images): + images += [Image.new(images[0].mode, images[0].size) for _ in range(total_imgs - len(images))] + + w, h = images[0].size + grid = Image.new(images[0].mode, size=(cols * w, rows * h)) + + for i, img in enumerate(images): + grid.paste(img, box=(i % cols * w, i // cols * h)) + return grid + +def pils_erode_masks(mask_list): + out_mask_list = [] + for idx, mask in enumerate(mask_list): + arr = np.array(mask) + alpha = (arr[:, :, 3] > 127).astype(np.uint8) + # erode 1px + import cv2 + alpha = cv2.erode(alpha, np.ones((3, 3), np.uint8), iterations=1) + alpha = (alpha * 255).astype(np.uint8) + out_mask_list.append(Image.fromarray(alpha[:, :, None])) + + return out_mask_list + +def pils_resize_foreground( + pils: Union[Image.Image, List[Image.Image]], + ratio: float, +) -> List[Image.Image]: + if isinstance(pils, Image.Image): + pils = [pils] + + new_pils = [] + for image in pils: + image = np.array(image) + assert image.shape[-1] == 4 + alpha = np.where(image[..., 3] > 0) + y1, y2, x1, x2 = ( + alpha[0].min(), + alpha[0].max(), + alpha[1].min(), + alpha[1].max(), + ) + # crop the foreground + fg = image[y1:y2, x1:x2] + # pad to square + size = max(fg.shape[0], fg.shape[1]) + ph0, pw0 = (size - fg.shape[0]) // 2, (size - fg.shape[1]) // 2 + ph1, pw1 = size - fg.shape[0] - ph0, size - fg.shape[1] - pw0 + new_image = np.pad( + fg, + ((ph0, ph1), (pw0, pw1), (0, 0)), + mode="constant", + constant_values=((0, 0), (0, 0), (0, 0)), + ) + + # compute padding according to the ratio + new_size = int(new_image.shape[0] / ratio) + # pad to size, double side + ph0, pw0 = (new_size - size) // 2, (new_size - size) // 2 + ph1, pw1 = new_size - size - ph0, new_size - size - pw0 + new_image = np.pad( + new_image, + ((ph0, ph1), (pw0, pw1), (0, 0)), + mode="constant", + constant_values=((0, 0), (0, 0), (0, 0)), + ) + new_image = Image.fromarray(new_image, mode="RGBA") + new_pils.append(new_image) + + return new_pils \ No newline at end of file diff --git a/shared_utils/log_utils.py b/shared_utils/log_utils.py new file mode 100644 index 0000000..4c0de0d --- /dev/null +++ b/shared_utils/log_utils.py @@ -0,0 +1,105 @@ +import logging +import sys + +class cstr(str): + # Modified from: WAS Node Suite + class color: + END = '\33[0m' + BOLD = '\33[1m' + ITALIC = '\33[3m' + UNDERLINE = '\33[4m' + BLINK = '\33[5m' + BLINK2 = '\33[6m' + SELECTED = '\33[7m' + + BLACK = '\33[30m' + RED = '\33[31m' + GREEN = '\33[32m' + YELLOW = '\33[33m' + BLUE = '\33[34m' + VIOLET = '\33[35m' + BEIGE = '\33[36m' + WHITE = '\33[37m' + + BLACKBG = '\33[40m' + REDBG = '\33[41m' + GREENBG = '\33[42m' + YELLOWBG = '\33[43m' + BLUEBG = '\33[44m' + VIOLETBG = '\33[45m' + BEIGEBG = '\33[46m' + WHITEBG = '\33[47m' + + GREY = '\33[90m' + LIGHTRED = '\33[91m' + LIGHTGREEN = '\33[92m' + LIGHTYELLOW = '\33[93m' + LIGHTBLUE = '\33[94m' + LIGHTVIOLET = '\33[95m' + LIGHTBEIGE = '\33[96m' + LIGHTWHITE = '\33[97m' + + GREYBG = '\33[100m' + LIGHTREDBG = '\33[101m' + LIGHTGREENBG = '\33[102m' + LIGHTYELLOWBG = '\33[103m' + LIGHTBLUEBG = '\33[104m' + LIGHTVIOLETBG = '\33[105m' + LIGHTBEIGEBG = '\33[106m' + LIGHTWHITEBG = '\33[107m' + + @staticmethod + def add_code(name, code): + if not hasattr(cstr.color, name.upper()): + setattr(cstr.color, name.upper(), code) + else: + raise ValueError(f"'cstr' object already contains a code with the name '{name}'.") + + def __new__(cls, text): + return super().__new__(cls, text) + + def __getattr__(self, attr): + if attr.lower().startswith("_cstr"): + code = getattr(self.color, attr.upper().lstrip("_cstr")) + modified_text = self.replace(f"__{attr[1:]}__", f"{code}") + return cstr(modified_text) + elif attr.upper() in dir(self.color): + code = getattr(self.color, attr.upper()) + modified_text = f"{code}{self}{self.color.END}" + return cstr(modified_text) + elif attr.lower() in dir(cstr): + return getattr(cstr, attr.lower()) + else: + raise AttributeError(f"'cstr' object has no attribute '{attr}'") + + def print(self, **kwargs): + print(self, **kwargs) + +#! MESSAGE TEMPLATES +cstr.color.add_code("msg", f"{cstr.color.BLUE}[Comfy3D] {cstr.color.END}") +cstr.color.add_code("warning", f"{cstr.color.LIGHTYELLOW}[Comfy3D] [WARNING] {cstr.color.END}") +cstr.color.add_code("error", f"{cstr.color.RED}[Comfy3D] [ERROR] {cstr.color.END}") + +class WarningFilter(logging.Filter): + def filter(self, record): + if record.levelno == logging.WARNING: + record.msg = f"Warn!: {record.msg}" + return True + +def create_handler(stream, levels, formatter): + handler = logging.StreamHandler(stream) + handler.setLevel(min(levels)) + handler.addFilter(lambda record: record.levelno in levels) + handler.addFilter(WarningFilter()) # Apply the custom filter + handler.setFormatter(formatter) + + return handler +def setup_logger(logger_name, level, stdout_levels, stderr_levels, formatter): + logger = logging.getLogger(logger_name) + for handler in logger.handlers[:]: + logger.removeHandler(handler) + logger.setLevel(level) + stdout_handler = create_handler(sys.stdout, stdout_levels, formatter) + stderr_handler = create_handler(sys.stderr, stderr_levels, formatter) + logger.addHandler(stdout_handler) + logger.addHandler(stderr_handler) \ No newline at end of file diff --git a/shared_utils/sh_utils.py b/shared_utils/sh_utils.py new file mode 100644 index 0000000..bbca7d1 --- /dev/null +++ b/shared_utils/sh_utils.py @@ -0,0 +1,118 @@ +# Copyright 2021 The PlenOctree Authors. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import torch + +C0 = 0.28209479177387814 +C1 = 0.4886025119029199 +C2 = [ + 1.0925484305920792, + -1.0925484305920792, + 0.31539156525252005, + -1.0925484305920792, + 0.5462742152960396 +] +C3 = [ + -0.5900435899266435, + 2.890611442640554, + -0.4570457994644658, + 0.3731763325901154, + -0.4570457994644658, + 1.445305721320277, + -0.5900435899266435 +] +C4 = [ + 2.5033429417967046, + -1.7701307697799304, + 0.9461746957575601, + -0.6690465435572892, + 0.10578554691520431, + -0.6690465435572892, + 0.47308734787878004, + -1.7701307697799304, + 0.6258357354491761, +] + + +def eval_sh(deg, sh, dirs): + """ + Evaluate spherical harmonics at unit directions + using hardcoded SH polynomials. + Works with torch/np/jnp. + ... Can be 0 or more batch dimensions. + Args: + deg: int SH deg. Currently, 0-3 supported + sh: jnp.ndarray SH coeffs [..., C, (deg + 1) ** 2] + dirs: jnp.ndarray unit directions [..., 3] + Returns: + [..., C] + """ + assert deg <= 4 and deg >= 0 + coeff = (deg + 1) ** 2 + assert sh.shape[-1] >= coeff + + result = C0 * sh[..., 0] + if deg > 0: + x, y, z = dirs[..., 0:1], dirs[..., 1:2], dirs[..., 2:3] + result = (result - + C1 * y * sh[..., 1] + + C1 * z * sh[..., 2] - + C1 * x * sh[..., 3]) + + if deg > 1: + xx, yy, zz = x * x, y * y, z * z + xy, yz, xz = x * y, y * z, x * z + result = (result + + C2[0] * xy * sh[..., 4] + + C2[1] * yz * sh[..., 5] + + C2[2] * (2.0 * zz - xx - yy) * sh[..., 6] + + C2[3] * xz * sh[..., 7] + + C2[4] * (xx - yy) * sh[..., 8]) + + if deg > 2: + result = (result + + C3[0] * y * (3 * xx - yy) * sh[..., 9] + + C3[1] * xy * z * sh[..., 10] + + C3[2] * y * (4 * zz - xx - yy)* sh[..., 11] + + C3[3] * z * (2 * zz - 3 * xx - 3 * yy) * sh[..., 12] + + C3[4] * x * (4 * zz - xx - yy) * sh[..., 13] + + C3[5] * z * (xx - yy) * sh[..., 14] + + C3[6] * x * (xx - 3 * yy) * sh[..., 15]) + + if deg > 3: + result = (result + C4[0] * xy * (xx - yy) * sh[..., 16] + + C4[1] * yz * (3 * xx - yy) * sh[..., 17] + + C4[2] * xy * (7 * zz - 1) * sh[..., 18] + + C4[3] * yz * (7 * zz - 3) * sh[..., 19] + + C4[4] * (zz * (35 * zz - 30) + 3) * sh[..., 20] + + C4[5] * xz * (7 * zz - 3) * sh[..., 21] + + C4[6] * (xx - yy) * (7 * zz - 1) * sh[..., 22] + + C4[7] * xz * (xx - 3 * yy) * sh[..., 23] + + C4[8] * (xx * (xx - 3 * yy) - yy * (3 * xx - yy)) * sh[..., 24]) + return result + +def RGB2SH(rgb): + return (rgb - 0.5) / C0 + +def SH2RGB(sh): + return sh * C0 + 0.5 \ No newline at end of file diff --git a/user/text_file_dirs.json b/user/text_file_dirs.json new file mode 100644 index 0000000..15adc22 --- /dev/null +++ b/user/text_file_dirs.json @@ -0,0 +1,5 @@ +{ + "input": "$input/**/*.txt", + "output": "$output/**/*.txt", + "temp": "$temp/**/*.txt" +} diff --git a/web/.DS_Store b/web/.DS_Store new file mode 100644 index 0000000..6ef7b3d Binary files /dev/null and b/web/.DS_Store differ diff --git a/web/html/threeVisualizer-original.html b/web/html/threeVisualizer-original.html new file mode 100644 index 0000000..d529390 --- /dev/null +++ b/web/html/threeVisualizer-original.html @@ -0,0 +1,55 @@ + + + + + + + + + + + +
+ +

+ +

+ +
+
+ +
+ + +
+ + + + + + + + diff --git a/web/js/assets/canvas2svg.js b/web/js/assets/canvas2svg.js new file mode 100644 index 0000000..03dc392 --- /dev/null +++ b/web/js/assets/canvas2svg.js @@ -0,0 +1,1192 @@ +/*!! + * Canvas 2 Svg v1.0.19 + * A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document. + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Author: + * Kerry Liu + * + * Copyright (c) 2014 Gliffy Inc. + */ + +;(function() { + "use strict"; + + var STYLES, ctx, CanvasGradient, CanvasPattern, namedEntities; + + //helper function to format a string + function format(str, args) { + var keys = Object.keys(args), i; + for (i=0; i 1) { + options = defaultOptions; + options.width = arguments[0]; + options.height = arguments[1]; + } else if( !o ) { + options = defaultOptions; + } else { + options = o; + } + + if(!(this instanceof ctx)) { + //did someone call this without new? + return new ctx(options); + } + + //setup options + this.width = options.width || defaultOptions.width; + this.height = options.height || defaultOptions.height; + this.enableMirroring = options.enableMirroring !== undefined ? options.enableMirroring : defaultOptions.enableMirroring; + + this.canvas = this; ///point back to this instance! + this.__document = options.document || document; + this.__canvas = this.__document.createElement("canvas"); + this.__ctx = this.__canvas.getContext("2d"); + + this.__setDefaultStyles(); + this.__stack = [this.__getStyleState()]; + this.__groupStack = []; + + //the root svg element + this.__root = this.__document.createElementNS("http://www.w3.org/2000/svg", "svg"); + this.__root.setAttribute("version", 1.1); + this.__root.setAttribute("xmlns", "http://www.w3.org/2000/svg"); + this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); + this.__root.setAttribute("width", this.width); + this.__root.setAttribute("height", this.height); + + //make sure we don't generate the same ids in defs + this.__ids = {}; + + //defs tag + this.__defs = this.__document.createElementNS("http://www.w3.org/2000/svg", "defs"); + this.__root.appendChild(this.__defs); + + //also add a group child. the svg element can't use the transform attribute + this.__currentElement = this.__document.createElementNS("http://www.w3.org/2000/svg", "g"); + this.__root.appendChild(this.__currentElement); + }; + + + /** + * Creates the specified svg element + * @private + */ + ctx.prototype.__createElement = function (elementName, properties, resetFill) { + if (typeof properties === "undefined") { + properties = {}; + } + + var element = this.__document.createElementNS("http://www.w3.org/2000/svg", elementName), + keys = Object.keys(properties), i, key; + if(resetFill) { + //if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black. + element.setAttribute("fill", "none"); + element.setAttribute("stroke", "none"); + } + for(i=0; i 0) { + var group = this.__createElement("g"); + parent.appendChild(group); + this.__currentElement = group; + } + + var transform = this.__currentElement.getAttribute("transform"); + if(transform) { + transform += " "; + } else { + transform = ""; + } + transform += t; + this.__currentElement.setAttribute("transform", transform); + }; + + /** + * scales the current element + */ + ctx.prototype.scale = function(x, y) { + if(y === undefined) { + y = x; + } + this.__addTransform(format("scale({x},{y})", {x:x, y:y})); + }; + + /** + * rotates the current element + */ + ctx.prototype.rotate = function(angle){ + var degrees = (angle * 180 / Math.PI); + this.__addTransform(format("rotate({angle},{cx},{cy})", {angle:degrees, cx:0, cy:0})); + }; + + /** + * translates the current element + */ + ctx.prototype.translate = function(x, y){ + this.__addTransform(format("translate({x},{y})", {x:x,y:y})); + }; + + /** + * applies a transform to the current element + */ + ctx.prototype.transform = function(a, b, c, d, e, f){ + this.__addTransform(format("matrix({a},{b},{c},{d},{e},{f})", {a:a, b:b, c:c, d:d, e:e, f:f})); + }; + + /** + * Create a new Path Element + */ + ctx.prototype.beginPath = function(){ + var path, parent; + + // Note that there is only one current default path, it is not part of the drawing state. + // See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path + this.__currentDefaultPath = ""; + this.__currentPosition = {}; + + path = this.__createElement("path", {}, true); + parent = this.__closestGroupOrSvg(); + parent.appendChild(path); + this.__currentElement = path; + }; + + /** + * Helper function to apply currentDefaultPath to current path element + * @private + */ + ctx.prototype.__applyCurrentDefaultPath = function() { + if(this.__currentElement.nodeName === "path") { + var d = this.__currentDefaultPath; + this.__currentElement.setAttribute("d", d); + } else { + throw new Error("Attempted to apply path command to node " + this.__currentElement.nodeName); + } + }; + + /** + * Helper function to add path command + * @private + */ + ctx.prototype.__addPathCommand = function(command){ + this.__currentDefaultPath += " "; + this.__currentDefaultPath += command; + }; + + /** + * Adds the move command to the current path element, + * if the currentPathElement is not empty create a new path element + */ + ctx.prototype.moveTo = function(x,y){ + if(this.__currentElement.nodeName !== "path") { + this.beginPath(); + } + + // creates a new subpath with the given point + this.__currentPosition = {x: x, y: y}; + this.__addPathCommand(format("M {x} {y}", {x:x, y:y})); + }; + + /** + * Closes the current path + */ + ctx.prototype.closePath = function(){ + this.__addPathCommand("Z"); + }; + + /** + * Adds a line to command + */ + ctx.prototype.lineTo = function(x, y){ + this.__currentPosition = {x: x, y: y}; + if (this.__currentDefaultPath.indexOf('M') > -1) { + this.__addPathCommand(format("L {x} {y}", {x:x, y:y})); + } else { + this.__addPathCommand(format("M {x} {y}", {x:x, y:y})); + } + }; + + /** + * Add a bezier command + */ + ctx.prototype.bezierCurveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) { + this.__currentPosition = {x: x, y: y}; + this.__addPathCommand(format("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}", + {cp1x:cp1x, cp1y:cp1y, cp2x:cp2x, cp2y:cp2y, x:x, y:y})); + }; + + /** + * Adds a quadratic curve to command + */ + ctx.prototype.quadraticCurveTo = function(cpx, cpy, x, y){ + this.__currentPosition = {x: x, y: y}; + this.__addPathCommand(format("Q {cpx} {cpy} {x} {y}", {cpx:cpx, cpy:cpy, x:x, y:y})); + }; + + + /** + * Return a new normalized vector of given vector + */ + var normalize = function(vector) { + var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]); + return [vector[0] / len, vector[1] / len]; + }; + + /** + * Adds the arcTo to the current path + * + * @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto + */ + ctx.prototype.arcTo = function(x1, y1, x2, y2, radius) { + // Let the point (x0, y0) be the last point in the subpath. + var x0 = this.__currentPosition && this.__currentPosition.x; + var y0 = this.__currentPosition && this.__currentPosition.y; + + // First ensure there is a subpath for (x1, y1). + if (typeof x0 == "undefined" || typeof y0 == "undefined") { + return; + } + + // Negative values for radius must cause the implementation to throw an IndexSizeError exception. + if (radius < 0) { + throw new Error("IndexSizeError: The radius provided (" + radius + ") is negative."); + } + + // If the point (x0, y0) is equal to the point (x1, y1), + // or if the point (x1, y1) is equal to the point (x2, y2), + // or if the radius radius is zero, + // then the method must add the point (x1, y1) to the subpath, + // and connect that point to the previous point (x0, y0) by a straight line. + if (((x0 === x1) && (y0 === y1)) + || ((x1 === x2) && (y1 === y2)) + || (radius === 0)) { + this.lineTo(x1, y1); + return; + } + + // Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line, + // then the method must add the point (x1, y1) to the subpath, + // and connect that point to the previous point (x0, y0) by a straight line. + var unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]); + var unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]); + if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) { + this.lineTo(x1, y1); + return; + } + + // Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius, + // and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1), + // and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2). + // The points at which this circle touches these two lines are called the start and end tangent points respectively. + + // note that both vectors are unit vectors, so the length is 1 + var cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]); + var theta = Math.acos(Math.abs(cos)); + + // Calculate origin + var unit_vec_p1_origin = normalize([ + unit_vec_p1_p0[0] + unit_vec_p1_p2[0], + unit_vec_p1_p0[1] + unit_vec_p1_p2[1] + ]); + var len_p1_origin = radius / Math.sin(theta / 2); + var x = x1 + len_p1_origin * unit_vec_p1_origin[0]; + var y = y1 + len_p1_origin * unit_vec_p1_origin[1]; + + // Calculate start angle and end angle + // rotate 90deg clockwise (note that y axis points to its down) + var unit_vec_origin_start_tangent = [ + -unit_vec_p1_p0[1], + unit_vec_p1_p0[0] + ]; + // rotate 90deg counter clockwise (note that y axis points to its down) + var unit_vec_origin_end_tangent = [ + unit_vec_p1_p2[1], + -unit_vec_p1_p2[0] + ]; + var getAngle = function(vector) { + // get angle (clockwise) between vector and (1, 0) + var x = vector[0]; + var y = vector[1]; + if (y >= 0) { // note that y axis points to its down + return Math.acos(x); + } else { + return -Math.acos(x); + } + }; + var startAngle = getAngle(unit_vec_origin_start_tangent); + var endAngle = getAngle(unit_vec_origin_end_tangent); + + // Connect the point (x0, y0) to the start tangent point by a straight line + this.lineTo(x + unit_vec_origin_start_tangent[0] * radius, + y + unit_vec_origin_start_tangent[1] * radius); + + // Connect the start tangent point to the end tangent point by arc + // and adding the end tangent point to the subpath. + this.arc(x, y, radius, startAngle, endAngle); + }; + + /** + * Sets the stroke property on the current element + */ + ctx.prototype.stroke = function(){ + if(this.__currentElement.nodeName === "path") { + this.__currentElement.setAttribute("paint-order", "fill stroke markers"); + } + this.__applyCurrentDefaultPath(); + this.__applyStyleToCurrentElement("stroke"); + }; + + /** + * Sets fill properties on the current element + */ + ctx.prototype.fill = function(){ + if(this.__currentElement.nodeName === "path") { + this.__currentElement.setAttribute("paint-order", "stroke fill markers"); + } + this.__applyCurrentDefaultPath(); + this.__applyStyleToCurrentElement("fill"); + }; + + /** + * Adds a rectangle to the path. + */ + ctx.prototype.rect = function(x, y, width, height){ + if(this.__currentElement.nodeName !== "path") { + this.beginPath(); + } + this.moveTo(x, y); + this.lineTo(x+width, y); + this.lineTo(x+width, y+height); + this.lineTo(x, y+height); + this.lineTo(x, y); + this.closePath(); + }; + + + /** + * adds a rectangle element + */ + ctx.prototype.fillRect = function(x, y, width, height){ + var rect, parent; + rect = this.__createElement("rect", { + x : x, + y : y, + width : width, + height : height + }, true); + parent = this.__closestGroupOrSvg(); + parent.appendChild(rect); + this.__currentElement = rect; + this.__applyStyleToCurrentElement("fill"); + }; + + /** + * Draws a rectangle with no fill + * @param x + * @param y + * @param width + * @param height + */ + ctx.prototype.strokeRect = function(x, y, width, height){ + var rect, parent; + rect = this.__createElement("rect", { + x : x, + y : y, + width : width, + height : height + }, true); + parent = this.__closestGroupOrSvg(); + parent.appendChild(rect); + this.__currentElement = rect; + this.__applyStyleToCurrentElement("stroke"); + }; + + + /** + * Clear entire canvas: + * 1. save current transforms + * 2. remove all the childNodes of the root g element + */ + ctx.prototype.__clearCanvas = function() { + var current = this.__closestGroupOrSvg(), + transform = current.getAttribute("transform"); + var rootGroup = this.__root.childNodes[1]; + var childNodes = rootGroup.childNodes; + for (var i = childNodes.length - 1; i >= 0; i--) { + if (childNodes[i]) { + rootGroup.removeChild(childNodes[i]); + } + } + this.__currentElement = rootGroup; + //reset __groupStack as all the child group nodes are all removed. + this.__groupStack = []; + if (transform) { + this.__addTransform(transform); + } + }; + + /** + * "Clears" a canvas by just drawing a white rectangle in the current group. + */ + ctx.prototype.clearRect = function(x, y, width, height) { + //clear entire canvas + if (x === 0 && y === 0 && width === this.width && height === this.height) { + this.__clearCanvas(); + return; + } + var rect, parent = this.__closestGroupOrSvg(); + rect = this.__createElement("rect", { + x : x, + y : y, + width : width, + height : height, + fill : "#FFFFFF" + }, true); + parent.appendChild(rect); + }; + + /** + * Adds a linear gradient to a defs tag. + * Returns a canvas gradient object that has a reference to it's parent def + */ + ctx.prototype.createLinearGradient = function(x1, y1, x2, y2){ + var grad = this.__createElement("linearGradient", { + id : randomString(this.__ids), + x1 : x1+"px", + x2 : x2+"px", + y1 : y1+"px", + y2 : y2+"px", + "gradientUnits" : "userSpaceOnUse" + }, false); + this.__defs.appendChild(grad); + return new CanvasGradient(grad, this); + }; + + /** + * Adds a radial gradient to a defs tag. + * Returns a canvas gradient object that has a reference to it's parent def + */ + ctx.prototype.createRadialGradient = function(x0, y0, r0, x1, y1, r1){ + var grad = this.__createElement("radialGradient", { + id : randomString(this.__ids), + cx : x1+"px", + cy : y1+"px", + r : r1+"px", + fx : x0+"px", + fy : y0+"px", + "gradientUnits" : "userSpaceOnUse" + }, false); + this.__defs.appendChild(grad); + return new CanvasGradient(grad, this); + + }; + + /** + * Parses the font string and returns svg mapping + * @private + */ + ctx.prototype.__parseFont = function() { + var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z]+?)\s*$/i; + var fontPart = regex.exec( this.font ); + var data = { + style : fontPart[1] || 'normal', + size : fontPart[4] || '10px', + family : fontPart[6] || 'sans-serif', + weight: fontPart[3] || 'normal', + decoration : fontPart[2] || 'normal', + href : null + }; + + //canvas doesn't support underline natively, but we can pass this attribute + if(this.__fontUnderline === "underline") { + data.decoration = "underline"; + } + + //canvas also doesn't support linking, but we can pass this as well + if(this.__fontHref) { + data.href = this.__fontHref; + } + + return data; + }; + + /** + * Helper to link text fragments + * @param font + * @param element + * @return {*} + * @private + */ + ctx.prototype.__wrapTextLink = function(font, element) { + if(font.href) { + var a = this.__createElement("a"); + a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", font.href); + a.appendChild(element); + return a; + } + return element; + }; + + /** + * Fills or strokes text + * @param text + * @param x + * @param y + * @param action - stroke or fill + * @private + */ + ctx.prototype.__applyText = function(text, x, y, action) { + var font = this.__parseFont(), + parent = this.__closestGroupOrSvg(), + textElement = this.__createElement("text", { + "font-family" : font.family, + "font-size" : font.size, + "font-style" : font.style, + "font-weight" : font.weight, + "text-decoration" : font.decoration, + "x" : x, + "y" : y, + "text-anchor": getTextAnchor(this.textAlign), + "dominant-baseline": getDominantBaseline(this.textBaseline) + }, true); + + textElement.appendChild(this.__document.createTextNode(text)); + this.__currentElement = textElement; + this.__applyStyleToCurrentElement(action); + parent.appendChild(this.__wrapTextLink(font,textElement)); + }; + + /** + * Creates a text element + * @param text + * @param x + * @param y + */ + ctx.prototype.fillText = function(text, x, y){ + this.__applyText(text, x, y, "fill"); + }; + + /** + * Strokes text + * @param text + * @param x + * @param y + */ + ctx.prototype.strokeText = function(text, x, y){ + this.__applyText(text, x, y, "stroke"); + }; + + /** + * No need to implement this for svg. + * @param text + * @return {TextMetrics} + */ + ctx.prototype.measureText = function(text){ + this.__ctx.font = this.font; + return this.__ctx.measureText(text); + }; + + /** + * Arc command! + */ + ctx.prototype.arc = function(x, y, radius, startAngle, endAngle, counterClockwise) { + // in canvas no circle is drawn if no angle is provided. + if (startAngle === endAngle) { + return; + } + startAngle = startAngle % (2*Math.PI); + endAngle = endAngle % (2*Math.PI); + if(startAngle === endAngle) { + //circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle) + endAngle = ((endAngle + (2*Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2*Math.PI); + } + var endX = x+radius*Math.cos(endAngle), + endY = y+radius*Math.sin(endAngle), + startX = x+radius*Math.cos(startAngle), + startY = y+radius*Math.sin(startAngle), + sweepFlag = counterClockwise ? 0 : 1, + largeArcFlag = 0, + diff = endAngle - startAngle; + + // https://github.com/gliffy/canvas2svg/issues/4 + if(diff < 0) { + diff += 2*Math.PI; + } + + if(counterClockwise) { + largeArcFlag = diff > Math.PI ? 0 : 1; + } else { + largeArcFlag = diff > Math.PI ? 1 : 0; + } + + this.lineTo(startX, startY); + this.__addPathCommand(format("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}", + {rx:radius, ry:radius, xAxisRotation:0, largeArcFlag:largeArcFlag, sweepFlag:sweepFlag, endX:endX, endY:endY})); + + this.__currentPosition = {x: endX, y: endY}; + }; + + /** + * Generates a ClipPath from the clip command. + */ + ctx.prototype.clip = function(){ + var group = this.__closestGroupOrSvg(), + clipPath = this.__createElement("clipPath"), + id = randomString(this.__ids), + newGroup = this.__createElement("g"); + + this.__applyCurrentDefaultPath(); + group.removeChild(this.__currentElement); + clipPath.setAttribute("id", id); + clipPath.appendChild(this.__currentElement); + + this.__defs.appendChild(clipPath); + + //set the clip path to this group + group.setAttribute("clip-path", format("url(#{id})", {id:id})); + + //clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations + // to this path + group.appendChild(newGroup); + + this.__currentElement = newGroup; + + }; + + /** + * Draws a canvas, image or mock context to this canvas. + * Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support. + * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage + */ + ctx.prototype.drawImage = function(){ + //convert arguments to a real array + var args = Array.prototype.slice.call(arguments), + image=args[0], + dx, dy, dw, dh, sx=0, sy=0, sw, sh, parent, svg, defs, group, + currentElement, svgImage, canvas, context, id; + + if(args.length === 3) { + dx = args[1]; + dy = args[2]; + sw = image.width; + sh = image.height; + dw = sw; + dh = sh; + } else if(args.length === 5) { + dx = args[1]; + dy = args[2]; + dw = args[3]; + dh = args[4]; + sw = image.width; + sh = image.height; + } else if(args.length === 9) { + sx = args[1]; + sy = args[2]; + sw = args[3]; + sh = args[4]; + dx = args[5]; + dy = args[6]; + dw = args[7]; + dh = args[8]; + } else { + throw new Error("Inavlid number of arguments passed to drawImage: " + arguments.length); + } + + parent = this.__closestGroupOrSvg(); + currentElement = this.__currentElement; + var translateDirective = "translate(" + dx + ", " + dy + ")"; + if(image instanceof ctx) { + //canvas2svg mock canvas context. In the future we may want to clone nodes instead. + //also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context. + svg = image.getSvg().cloneNode(true); + if (svg.childNodes && svg.childNodes.length > 1) { + defs = svg.childNodes[0]; + while(defs.childNodes.length) { + id = defs.childNodes[0].getAttribute("id"); + this.__ids[id] = id; + this.__defs.appendChild(defs.childNodes[0]); + } + group = svg.childNodes[1]; + if (group) { + //save original transform + var originTransform = group.getAttribute("transform"); + var transformDirective; + if (originTransform) { + transformDirective = originTransform+" "+translateDirective; + } else { + transformDirective = translateDirective; + } + group.setAttribute("transform", transformDirective); + parent.appendChild(group); + } + } + } else if(image.nodeName === "CANVAS" || image.nodeName === "IMG") { + //canvas or image + svgImage = this.__createElement("image"); + svgImage.setAttribute("width", dw); + svgImage.setAttribute("height", dh); + svgImage.setAttribute("preserveAspectRatio", "none"); + + if(sx || sy || sw !== image.width || sh !== image.height) { + //crop the image using a temporary canvas + canvas = this.__document.createElement("canvas"); + canvas.width = dw; + canvas.height = dh; + context = canvas.getContext("2d"); + context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh); + image = canvas; + } + svgImage.setAttribute("transform", translateDirective); + svgImage.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", + image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src")); + parent.appendChild(svgImage); + } + }; + + /** + * Generates a pattern tag + */ + ctx.prototype.createPattern = function(image, repetition){ + var pattern = this.__document.createElementNS("http://www.w3.org/2000/svg", "pattern"), id = randomString(this.__ids), + img; + pattern.setAttribute("id", id); + pattern.setAttribute("width", image.width); + pattern.setAttribute("height", image.height); + if(image.nodeName === "CANVAS" || image.nodeName === "IMG") { + img = this.__document.createElementNS("http://www.w3.org/2000/svg", "image"); + img.setAttribute("width", image.width); + img.setAttribute("height", image.height); + img.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", + image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src")); + pattern.appendChild(img); + this.__defs.appendChild(pattern); + } else if(image instanceof ctx) { + pattern.appendChild(image.__root.childNodes[1]); + this.__defs.appendChild(pattern); + } + return new CanvasPattern(pattern, this); + }; + + ctx.prototype.setLineDash = function(dashArray) { + if (dashArray && dashArray.length > 0) { + this.lineDash = dashArray.join(","); + } else { + this.lineDash = null; + } + }; + + /** + * Not yet implemented + */ + ctx.prototype.drawFocusRing = function(){}; + ctx.prototype.createImageData = function(){}; + ctx.prototype.getImageData = function(){}; + ctx.prototype.putImageData = function(){}; + ctx.prototype.globalCompositeOperation = function(){}; + ctx.prototype.setTransform = function(){}; + + //add options for alternative namespace + if (typeof window === "object") { + window.C2S = ctx; + } + + // CommonJS/Browserify + if (typeof module === "object" && typeof module.exports === "object") { + module.exports = ctx; + } + +}()); diff --git a/web/js/assets/favicon-active.ico b/web/js/assets/favicon-active.ico new file mode 100644 index 0000000..64045ab Binary files /dev/null and b/web/js/assets/favicon-active.ico differ diff --git a/web/js/assets/favicon.ico b/web/js/assets/favicon.ico new file mode 100644 index 0000000..08df248 Binary files /dev/null and b/web/js/assets/favicon.ico differ diff --git a/web/js/assets/notify.mp3 b/web/js/assets/notify.mp3 new file mode 100644 index 0000000..5e3fdab Binary files /dev/null and b/web/js/assets/notify.mp3 differ diff --git a/web/js/common/autocomplete.css b/web/js/common/autocomplete.css new file mode 100644 index 0000000..1f371d6 --- /dev/null +++ b/web/js/common/autocomplete.css @@ -0,0 +1,62 @@ +.pysssss-autocomplete { + color: var(--descrip-text); + background-color: var(--comfy-menu-bg); + position: absolute; + font-family: sans-serif; + box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4); + z-index: 9999; + overflow: auto; +} + +.pysssss-autocomplete-item { + cursor: pointer; + padding: 3px 7px; + display: flex; + border-left: 3px solid transparent; + align-items: center; +} + +.pysssss-autocomplete-item--selected { + border-left-color: dodgerblue; +} + +.pysssss-autocomplete-highlight { + font-weight: bold; + text-decoration: underline; + text-decoration-color: dodgerblue; +} + +.pysssss-autocomplete-pill { + margin-left: auto; + font-size: 10px; + color: #fff; + padding: 2px 4px 2px 14px; + position: relative; +} + +.pysssss-autocomplete-pill::after { + content: ""; + display: block; + background: rgba(255, 255, 255, 0.25); + width: calc(100% - 10px); + height: 100%; + position: absolute; + left: 10px; + top: 0; + border-radius: 5px; +} + +.pysssss-autocomplete-pill + .pysssss-autocomplete-pill { + margin-left: 0; +} + +.pysssss-autocomplete-item-info { + margin-left: auto; + transition: filter 0.2s; + will-change: filter; + text-decoration: none; + padding-left: 10px; +} +.pysssss-autocomplete-item-info:hover { + filter: invert(1); +} diff --git a/web/js/common/autocomplete.js b/web/js/common/autocomplete.js new file mode 100644 index 0000000..d1c17fe --- /dev/null +++ b/web/js/common/autocomplete.js @@ -0,0 +1,681 @@ +import { $el } from "../../../../scripts/ui.js"; +import { addStylesheet } from "./utils.js"; + +addStylesheet(import.meta.url); + +/* + https://github.com/component/textarea-caret-position + The MIT License (MIT) + + Copyright (c) 2015 Jonathan Ong me@jongleberry.com + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +const getCaretCoordinates = (function () { + // We'll copy the properties below into the mirror div. + // Note that some browsers, such as Firefox, do not concatenate properties + // into their shorthand (e.g. padding-top, padding-bottom etc. -> padding), + // so we have to list every single property explicitly. + var properties = [ + "direction", // RTL support + "boxSizing", + "width", // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does + "height", + "overflowX", + "overflowY", // copy the scrollbar for IE + + "borderTopWidth", + "borderRightWidth", + "borderBottomWidth", + "borderLeftWidth", + "borderStyle", + + "paddingTop", + "paddingRight", + "paddingBottom", + "paddingLeft", + + // https://developer.mozilla.org/en-US/docs/Web/CSS/font + "fontStyle", + "fontVariant", + "fontWeight", + "fontStretch", + "fontSize", + "fontSizeAdjust", + "lineHeight", + "fontFamily", + + "textAlign", + "textTransform", + "textIndent", + "textDecoration", // might not make a difference, but better be safe + + "letterSpacing", + "wordSpacing", + + "tabSize", + "MozTabSize", + ]; + + var isBrowser = typeof window !== "undefined"; + var isFirefox = isBrowser && window.mozInnerScreenX != null; + + return function getCaretCoordinates(element, position, options) { + if (!isBrowser) { + throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser"); + } + + var debug = (options && options.debug) || false; + if (debug) { + var el = document.querySelector("#input-textarea-caret-position-mirror-div"); + if (el) el.parentNode.removeChild(el); + } + + // The mirror div will replicate the textarea's style + var div = document.createElement("div"); + div.id = "input-textarea-caret-position-mirror-div"; + document.body.appendChild(div); + + var style = div.style; + var computed = window.getComputedStyle ? window.getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9 + var isInput = element.nodeName === "INPUT"; + + // Default textarea styles + style.whiteSpace = "pre-wrap"; + if (!isInput) style.wordWrap = "break-word"; // only for textarea-s + + // Position off-screen + style.position = "absolute"; // required to return coordinates properly + if (!debug) style.visibility = "hidden"; // not 'display: none' because we want rendering + + // Transfer the element's properties to the div + properties.forEach(function (prop) { + if (isInput && prop === "lineHeight") { + // Special case for s because text is rendered centered and line height may be != height + if (computed.boxSizing === "border-box") { + var height = parseInt(computed.height); + var outerHeight = + parseInt(computed.paddingTop) + + parseInt(computed.paddingBottom) + + parseInt(computed.borderTopWidth) + + parseInt(computed.borderBottomWidth); + var targetHeight = outerHeight + parseInt(computed.lineHeight); + if (height > targetHeight) { + style.lineHeight = height - outerHeight + "px"; + } else if (height === targetHeight) { + style.lineHeight = computed.lineHeight; + } else { + style.lineHeight = 0; + } + } else { + style.lineHeight = computed.height; + } + } else { + style[prop] = computed[prop]; + } + }); + + if (isFirefox) { + // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275 + if (element.scrollHeight > parseInt(computed.height)) style.overflowY = "scroll"; + } else { + style.overflow = "hidden"; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll' + } + + div.textContent = element.value.substring(0, position); + // The second special handling for input type="text" vs textarea: + // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037 + if (isInput) div.textContent = div.textContent.replace(/\s/g, "\u00a0"); + + var span = document.createElement("span"); + // Wrapping must be replicated *exactly*, including when a long word gets + // onto the next line, with whitespace at the end of the line before (#7). + // The *only* reliable way to do that is to copy the *entire* rest of the + // textarea's content into the created at the caret position. + // For inputs, just '.' would be enough, but no need to bother. + span.textContent = element.value.substring(position) || "."; // || because a completely empty faux span doesn't render at all + div.appendChild(span); + + var coordinates = { + top: span.offsetTop + parseInt(computed["borderTopWidth"]), + left: span.offsetLeft + parseInt(computed["borderLeftWidth"]), + height: parseInt(computed["lineHeight"]), + }; + + if (debug) { + span.style.backgroundColor = "#aaa"; + } else { + document.body.removeChild(div); + } + + return coordinates; + }; +})(); + +/* + Key functions from: + https://github.com/yuku/textcomplete + © Yuku Takahashi - This software is licensed under the MIT license. + + The MIT License (MIT) + + Copyright (c) 2015 Jonathan Ong me@jongleberry.com + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +const CHAR_CODE_ZERO = "0".charCodeAt(0); +const CHAR_CODE_NINE = "9".charCodeAt(0); + +class TextAreaCaretHelper { + constructor(el, getScale) { + this.el = el; + this.getScale = getScale; + } + + #calculateElementOffset() { + const rect = this.el.getBoundingClientRect(); + const owner = this.el.ownerDocument; + if (owner == null) { + throw new Error("Given element does not belong to document"); + } + const { defaultView, documentElement } = owner; + if (defaultView == null) { + throw new Error("Given element does not belong to window"); + } + const offset = { + top: rect.top + defaultView.pageYOffset, + left: rect.left + defaultView.pageXOffset, + }; + if (documentElement) { + offset.top -= documentElement.clientTop; + offset.left -= documentElement.clientLeft; + } + return offset; + } + + #isDigit(charCode) { + return CHAR_CODE_ZERO <= charCode && charCode <= CHAR_CODE_NINE; + } + + #getLineHeightPx() { + const computedStyle = getComputedStyle(this.el); + const lineHeight = computedStyle.lineHeight; + // If the char code starts with a digit, it is either a value in pixels, + // or unitless, as per: + // https://drafts.csswg.org/css2/visudet.html#propdef-line-height + // https://drafts.csswg.org/css2/cascade.html#computed-value + if (this.#isDigit(lineHeight.charCodeAt(0))) { + const floatLineHeight = parseFloat(lineHeight); + // In real browsers the value is *always* in pixels, even for unit-less + // line-heights. However, we still check as per the spec. + return this.#isDigit(lineHeight.charCodeAt(lineHeight.length - 1)) + ? floatLineHeight * parseFloat(computedStyle.fontSize) + : floatLineHeight; + } + // Otherwise, the value is "normal". + // If the line-height is "normal", calculate by font-size + return this.#calculateLineHeightPx(this.el.nodeName, computedStyle); + } + + /** + * Returns calculated line-height of the given node in pixels. + */ + #calculateLineHeightPx(nodeName, computedStyle) { + const body = document.body; + if (!body) return 0; + + const tempNode = document.createElement(nodeName); + tempNode.innerHTML = " "; + Object.assign(tempNode.style, { + fontSize: computedStyle.fontSize, + fontFamily: computedStyle.fontFamily, + padding: "0", + position: "absolute", + }); + body.appendChild(tempNode); + + // Make sure textarea has only 1 row + if (tempNode instanceof HTMLTextAreaElement) { + tempNode.rows = 1; + } + + // Assume the height of the element is the line-height + const height = tempNode.offsetHeight; + body.removeChild(tempNode); + + return height; + } + + getCursorOffset() { + const scale = this.getScale(); + const elOffset = this.#calculateElementOffset(); + const elScroll = this.#getElScroll(); + const cursorPosition = this.#getCursorPosition(); + const lineHeight = this.#getLineHeightPx(); + const top = elOffset.top - (elScroll.top * scale) + (cursorPosition.top + lineHeight) * scale; + const left = elOffset.left - elScroll.left + cursorPosition.left; + const clientTop = this.el.getBoundingClientRect().top; + if (this.el.dir !== "rtl") { + return { top, left, lineHeight, clientTop }; + } else { + const right = document.documentElement ? document.documentElement.clientWidth - left : 0; + return { top, right, lineHeight, clientTop }; + } + } + + #getElScroll() { + return { top: this.el.scrollTop, left: this.el.scrollLeft }; + } + + #getCursorPosition() { + return getCaretCoordinates(this.el, this.el.selectionEnd); + } + + getBeforeCursor() { + return this.el.selectionStart !== this.el.selectionEnd ? null : this.el.value.substring(0, this.el.selectionEnd); + } + + getAfterCursor() { + return this.el.value.substring(this.el.selectionEnd); + } + + insertAtCursor(value, offset, finalOffset) { + if (this.el.selectionStart != null) { + const startPos = this.el.selectionStart; + const endPos = this.el.selectionEnd; + + // Move selection to beginning of offset + this.el.selectionStart = this.el.selectionStart + offset; + + // Using execCommand to support undo, but since it's officially + // 'deprecated' we need a backup solution, but it won't support undo :( + let pasted = true; + try { + if (!document.execCommand("insertText", false, value)) { + pasted = false; + } + } catch (e) { + console.error("Error caught during execCommand:", e); + pasted = false; + } + + if (!pasted) { + console.error( + "execCommand unsuccessful; not supported. Adding text manually, no undo support."); + textarea.setRangeText(modifiedText, this.el.selectionStart, this.el.selectionEnd, 'end'); + } + + this.el.selectionEnd = this.el.selectionStart = startPos + value.length + offset + (finalOffset ?? 0); + } else { + // Using execCommand to support undo, but since it's officially + // 'deprecated' we need a backup solution, but it won't support undo :( + let pasted = true; + try { + if (!document.execCommand("insertText", false, value)) { + pasted = false; + } + } catch (e) { + console.error("Error caught during execCommand:", e); + pasted = false; + } + + if (!pasted) { + console.error( + "execCommand unsuccessful; not supported. Adding text manually, no undo support."); + this.el.value += value; + } + } + } +} + +/*********************/ + +/** + * @typedef {{ + * text: string, + * priority?: number, + * info?: Function, + * hint?: string, + * showValue?: boolean, + * caretOffset?: number + * }} AutoCompleteEntry + */ +export class TextAreaAutoComplete { + static globalSeparator = ""; + static enabled = true; + static insertOnTab = true; + static insertOnEnter = true; + static replacer = undefined; + static lorasEnabled = false; + static suggestionCount = 20; + + /** @type {Record>} */ + static groups = {}; + /** @type {Set} */ + static globalGroups = new Set(); + /** @type {Record} */ + static globalWords = {}; + /** @type {Record} */ + static globalWordsExclLoras = {}; + + /** @type {HTMLTextAreaElement} */ + el; + + /** @type {Record} */ + overrideWords; + overrideSeparator = ""; + + get words() { + return this.overrideWords ?? TextAreaAutoComplete.globalWords; + } + + get separator() { + return this.overrideSeparator ?? TextAreaAutoComplete.globalSeparator; + } + + /** + * @param {HTMLTextAreaElement} el + */ + constructor(el, words = null, separator = null) { + this.el = el; + this.helper = new TextAreaCaretHelper(el, () => app.canvas.ds.scale); + this.dropdown = $el("div.pysssss-autocomplete"); + this.overrideWords = words; + this.overrideSeparator = separator; + + this.#setup(); + } + + #setup() { + this.el.addEventListener("keydown", this.#keyDown.bind(this)); + this.el.addEventListener("keypress", this.#keyPress.bind(this)); + this.el.addEventListener("keyup", this.#keyUp.bind(this)); + this.el.addEventListener("click", this.#hide.bind(this)); + this.el.addEventListener("blur", () => setTimeout(() => this.#hide(), 150)); + } + + /** + * @param {KeyboardEvent} e + */ + #keyDown(e) { + if (!TextAreaAutoComplete.enabled) return; + + if (this.dropdown.parentElement) { + // We are visible + switch (e.key) { + case "ArrowUp": + e.preventDefault(); + if (this.selected.index) { + this.#setSelected(this.currentWords[this.selected.index - 1].wordInfo); + } else { + this.#setSelected(this.currentWords[this.currentWords.length - 1].wordInfo); + } + break; + case "ArrowDown": + e.preventDefault(); + if (this.selected.index === this.currentWords.length - 1) { + this.#setSelected(this.currentWords[0].wordInfo); + } else { + this.#setSelected(this.currentWords[this.selected.index + 1].wordInfo); + } + break; + case "Tab": + if (TextAreaAutoComplete.insertOnTab) { + this.#insertItem(); + e.preventDefault(); + } + break; + } + } + } + + /** + * @param {KeyboardEvent} e + */ + #keyPress(e) { + if (!TextAreaAutoComplete.enabled) return; + if (this.dropdown.parentElement) { + // We are visible + switch (e.key) { + case "Enter": + if (!e.ctrlKey) { + if (TextAreaAutoComplete.insertOnEnter) { + this.#insertItem(); + e.preventDefault(); + } + } + break; + } + } + + if (!e.defaultPrevented) { + this.#update(); + } + } + + #keyUp(e) { + if (!TextAreaAutoComplete.enabled) return; + if (this.dropdown.parentElement) { + // We are visible + switch (e.key) { + case "Escape": + e.preventDefault(); + this.#hide(); + break; + } + } else if (e.key.length > 1 && e.key != "Delete" && e.key != "Backspace") { + return; + } + if (!e.defaultPrevented) { + this.#update(); + } + } + + #setSelected(item) { + if (this.selected) { + this.selected.el.classList.remove("pysssss-autocomplete-item--selected"); + } + + this.selected = item; + this.selected.el.classList.add("pysssss-autocomplete-item--selected"); + } + + #insertItem() { + if (!this.selected) return; + this.selected.el.click(); + } + + #getFilteredWords(term) { + term = term.toLocaleLowerCase(); + + const priorityMatches = []; + const prefixMatches = []; + const includesMatches = []; + for (const word of Object.keys(this.words)) { + const lowerWord = word.toLocaleLowerCase(); + if (lowerWord === term) { + // Dont include exact matches + continue; + } + + const pos = lowerWord.indexOf(term); + if (pos === -1) { + // No match + continue; + } + + const wordInfo = this.words[word]; + if (wordInfo.priority) { + priorityMatches.push({ pos, wordInfo }); + } else if (pos) { + includesMatches.push({ pos, wordInfo }); + } else { + prefixMatches.push({ pos, wordInfo }); + } + } + + priorityMatches.sort( + (a, b) => + b.wordInfo.priority - a.wordInfo.priority || + a.wordInfo.text.length - b.wordInfo.text.length || + a.wordInfo.text.localeCompare(b.wordInfo.text) + ); + + const top = priorityMatches.length * 0.2; + return priorityMatches.slice(0, top).concat(prefixMatches, priorityMatches.slice(top), includesMatches).slice(0, TextAreaAutoComplete.suggestionCount); + } + + #update() { + let before = this.helper.getBeforeCursor(); + if (before?.length) { + const m = before.match(/([^\s|,|;|"]+)$/); + if (m) { + before = m[0]; + } else { + before = null; + } + } + + if (!before) { + this.#hide(); + return; + } + + this.currentWords = this.#getFilteredWords(before); + if (!this.currentWords.length) { + this.#hide(); + return; + } + + this.dropdown.style.display = ""; + + let hasSelected = false; + const items = this.currentWords.map(({ wordInfo, pos }, i) => { + const parts = [ + $el("span", { + textContent: wordInfo.text.substr(0, pos), + }), + $el("span.pysssss-autocomplete-highlight", { + textContent: wordInfo.text.substr(pos, before.length), + }), + $el("span", { + textContent: wordInfo.text.substr(pos + before.length), + }), + ]; + + if (wordInfo.hint) { + parts.push( + $el("span.pysssss-autocomplete-pill", { + textContent: wordInfo.hint, + }) + ); + } + + if (wordInfo.priority) { + parts.push( + $el("span.pysssss-autocomplete-pill", { + textContent: wordInfo.priority, + }) + ); + } + + if (wordInfo.value && wordInfo.text !== wordInfo.value && wordInfo.showValue !== false) { + parts.push( + $el("span.pysssss-autocomplete-pill", { + textContent: wordInfo.value, + }) + ); + } + + if (wordInfo.info) { + parts.push( + $el("a.pysssss-autocomplete-item-info", { + textContent: "ℹ️", + title: "View info...", + onclick: (e) => { + e.stopPropagation(); + wordInfo.info(); + e.preventDefault(); + }, + }) + ); + } + const item = $el( + "div.pysssss-autocomplete-item", + { + onclick: () => { + this.el.focus(); + let value = wordInfo.value ?? wordInfo.text; + const use_replacer = wordInfo.use_replacer ?? true; + if (TextAreaAutoComplete.replacer && use_replacer) { + value = TextAreaAutoComplete.replacer(value); + } + this.helper.insertAtCursor(value + this.separator, -before.length, wordInfo.caretOffset); + setTimeout(() => { + this.#update(); + }, 150); + }, + onmousemove: () => { + this.#setSelected(wordInfo); + }, + }, + parts + ); + + if (wordInfo === this.selected) { + hasSelected = true; + } + + wordInfo.index = i; + wordInfo.el = item; + + return item; + }); + + this.#setSelected(hasSelected ? this.selected : this.currentWords[0].wordInfo); + this.dropdown.replaceChildren(...items); + + if (!this.dropdown.parentElement) { + document.body.append(this.dropdown); + } + + const position = this.helper.getCursorOffset(); + this.dropdown.style.left = (position.left ?? 0) + "px"; + this.dropdown.style.top = (position.top ?? 0) + "px"; + this.dropdown.style.maxHeight = (window.innerHeight - position.top) + "px"; + } + + #hide() { + this.selected = null; + this.dropdown.remove(); + } + + static updateWords(id, words, addGlobal = true) { + const isUpdate = id in TextAreaAutoComplete.groups; + TextAreaAutoComplete.groups[id] = words; + if (addGlobal) { + TextAreaAutoComplete.globalGroups.add(id); + } + + if (isUpdate) { + // Remerge all words + TextAreaAutoComplete.globalWords = Object.assign( + {}, + ...Object.keys(TextAreaAutoComplete.groups) + .filter((k) => TextAreaAutoComplete.globalGroups.has(k)) + .map((k) => TextAreaAutoComplete.groups[k]) + ); + } else if (addGlobal) { + // Just insert the new words + Object.assign(TextAreaAutoComplete.globalWords, words); + } + } +} diff --git a/web/js/common/binding.js b/web/js/common/binding.js new file mode 100644 index 0000000..7533e7e --- /dev/null +++ b/web/js/common/binding.js @@ -0,0 +1,244 @@ +// @ts-check +// @ts-ignore +import { ComfyWidgets } from "../../../../scripts/widgets.js"; +// @ts-ignore +import { api } from "../../../../scripts/api.js"; +// @ts-ignore +import { app } from "../../../../scripts/app.js"; + +const PathHelper = { + get(obj, path) { + if (typeof path !== "string") { + // Hardcoded value + return path; + } + + if (path[0] === '"' && path[path.length - 1] === '"') { + // Hardcoded string + return JSON.parse(path); + } + + // Evaluate the path + path = path.split(".").filter(Boolean); + for (const p of path) { + const k = isNaN(+p) ? p : +p; + obj = obj[k]; + } + + return obj; + }, + set(obj, path, value) { + // https://stackoverflow.com/a/54733755 + if (Object(obj) !== obj) return obj; // When obj is not an object + // If not yet an array, get the keys from the string-path + if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; + path.slice(0, -1).reduce( + ( + a, + c, + i // Iterate all of them except the last one + ) => + Object(a[c]) === a[c] // Does the key exist and is its value an object? + ? // Yes: then follow that path + a[c] + : // No: create the key. Is the next key a potential array-index? + (a[c] = + Math.abs(path[i + 1]) >> 0 === +path[i + 1] + ? [] // Yes: assign a new array object + : {}), // No: assign a new plain object + obj + )[path[path.length - 1]] = value; // Finally assign the value to the last key + return obj; // Return the top-level object to allow chaining + }, +}; + +/*** + @typedef { { + left: string; + op: "eq" | "ne", + right: string + } } IfCondition + + @typedef { { + type: "if", + condition: Array, + true?: Array, + false?: Array + } } IfCallback + + @typedef { { + type: "fetch", + url: string, + then: Array + } } FetchCallback + + @typedef { { + type: "set", + target: string, + value: string + } } SetCallback + + @typedef { { + type: "validate-combo", + } } ValidateComboCallback + + @typedef { IfCallback | FetchCallback | SetCallback | ValidateComboCallback } BindingCallback + + @typedef { { + source: string, + callback: Array + } } Binding +***/ + +/** + * @param {IfCondition} condition + */ +function evaluateCondition(condition, state) { + const left = PathHelper.get(state, condition.left); + const right = PathHelper.get(state, condition.right); + + let r; + if (condition.op === "eq") { + r = left === right; + } else { + r = left !== right; + } + + return r; +} + +/** + * @type { Record) => Promise> } + */ +const callbacks = { + /** + * @param {IfCallback} cb + */ + async if(cb, state) { + // For now only support ANDs + let success = true; + for (const condition of cb.condition) { + const r = evaluateCondition(condition, state); + if (!r) { + success = false; + break; + } + } + + for (const m of cb[success + ""] ?? []) { + await invokeCallback(m, state); + } + }, + /** + * @param {FetchCallback} cb + */ + async fetch(cb, state) { + const url = cb.url.replace(/\{([^\}]+)\}/g, (m, v) => { + return PathHelper.get(state, v); + }); + const res = await (await api.fetchApi(url)).json(); + state["$result"] = res; + for (const m of cb.then) { + await invokeCallback(m, state); + } + }, + /** + * @param {SetCallback} cb + */ + async set(cb, state) { + const value = PathHelper.get(state, cb.value); + PathHelper.set(state, cb.target, value); + }, + async "validate-combo"(cb, state) { + const w = state["$this"]; + const valid = w.options.values.includes(w.value); + if (!valid) { + w.value = w.options.values[0]; + } + }, +}; + +async function invokeCallback(callback, state) { + if (callback.type in callbacks) { + // @ts-ignore + await callbacks[callback.type](callback, state); + } else { + console.warn( + "%c[🐍 pysssss]", + "color: limegreen", + `[binding ${state.$node.comfyClass}.${state.$this.name}]`, + "unsupported binding callback type:", + callback.type + ); + } +} + +app.registerExtension({ + name: "pysssss.Binding", + beforeRegisterNodeDef(node, nodeData) { + const hasBinding = (v) => { + if (!v) return false; + return Object.values(v).find((c) => c[1]?.["pysssss.binding"]); + }; + const inputs = { ...nodeData.input?.required, ...nodeData.input?.optional }; + if (hasBinding(inputs)) { + const onAdded = node.prototype.onAdded; + node.prototype.onAdded = function () { + const r = onAdded?.apply(this, arguments); + + for (const widget of this.widgets || []) { + const bindings = inputs[widget.name][1]?.["pysssss.binding"]; + if (!bindings) continue; + + for (const binding of bindings) { + /** + * @type {import("../../../../../web/types/litegraph.d.ts").IWidget} + */ + const source = this.widgets.find((w) => w.name === binding.source); + if (!source) { + console.warn( + "%c[🐍 pysssss]", + "color: limegreen", + `[binding ${node.comfyClass}.${widget.name}]`, + "unable to find source binding widget:", + binding.source, + binding + ); + continue; + } + + let lastValue; + async function valueChanged() { + const state = { + $this: widget, + $source: source, + $node: node, + }; + + for (const callback of binding.callback) { + await invokeCallback(callback, state); + } + + app.graph.setDirtyCanvas(true, false); + } + + const cb = source.callback; + source.callback = function () { + const v = cb?.apply(this, arguments) ?? source.value; + if (v !== lastValue) { + lastValue = v; + valueChanged(); + } + return v; + }; + + lastValue = source.value; + valueChanged(); + } + } + + return r; + }; + } + }, +}); diff --git a/web/js/common/lightbox.css b/web/js/common/lightbox.css new file mode 100644 index 0000000..41fa52d --- /dev/null +++ b/web/js/common/lightbox.css @@ -0,0 +1,98 @@ +.pysssss-lightbox { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + z-index: 1000; + background: rgba(0, 0, 0, 0.6); + display: flex; + align-items: center; + transition: opacity 0.2s; +} + +.pysssss-lightbox-prev, +.pysssss-lightbox-next { + height: 60px; + display: flex; + align-items: center; +} + +.pysssss-lightbox-prev:after, +.pysssss-lightbox-next:after { + border-style: solid; + border-width: 0.25em 0.25em 0 0; + display: inline-block; + height: 0.45em; + left: 0.15em; + position: relative; + top: 0.15em; + transform: rotate(-135deg) scale(0.75); + vertical-align: top; + width: 0.45em; + padding: 10px; + font-size: 20px; + margin: 0 10px 0 20px; + transition: color 0.2s; + flex-shrink: 0; + content: ""; +} + +.pysssss-lightbox-next:after { + transform: rotate(45deg) scale(0.75); + margin: 0 20px 0 0px; +} + +.pysssss-lightbox-main { + flex: auto; + text-align: center; +} + +.pysssss-lightbox-link { + display: inline-block; + position: relative; +} + +.pysssss-lightbox .lds-ring { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); +} + +.pysssss-lightbox-img { + max-height: 90vh; + max-width: calc(100vw - 130px); + height: auto; + object-fit: contain; + border: 3px solid white; + border-radius: 4px; + transition: opacity 0.2s; + user-select: none; +} + +.pysssss-lightbox-img:hover { + border-color: dodgerblue; +} + +.pysssss-lightbox-close { + font-size: 80px; + line-height: 1ch; + height: 1ch; + width: 1ch; + position: absolute; + right: 10px; + top: 10px; + padding: 5px; +} + +.pysssss-lightbox-close:after { + content: "\00d7"; +} + +.pysssss-lightbox-close:hover, +.pysssss-lightbox-prev:hover, +.pysssss-lightbox-next:hover { + color: dodgerblue; + cursor: pointer; +} diff --git a/web/js/common/lightbox.js b/web/js/common/lightbox.js new file mode 100644 index 0000000..5c90790 --- /dev/null +++ b/web/js/common/lightbox.js @@ -0,0 +1,149 @@ +import { $el } from "../../../../scripts/ui.js"; +import { addStylesheet, getUrl, loadImage } from "./utils.js"; +import { createSpinner } from "./spinner.js"; + +addStylesheet(getUrl("lightbox.css", import.meta.url)); + +const $$el = (tag, name, ...args) => { + if (name) name = "-" + name; + return $el(tag + ".pysssss-lightbox" + name, ...args); +}; + +const ani = async (a, t, b) => { + a(); + await new Promise((r) => setTimeout(r, t)); + b(); +}; + +export class Lightbox { + constructor() { + this.el = $$el("div", "", { + parent: document.body, + onclick: (e) => { + e.stopImmediatePropagation(); + this.close(); + }, + style: { + display: "none", + opacity: 0, + }, + }); + this.closeBtn = $$el("div", "close", { + parent: this.el, + }); + this.prev = $$el("div", "prev", { + parent: this.el, + onclick: (e) => { + this.update(-1); + e.stopImmediatePropagation(); + }, + }); + this.main = $$el("div", "main", { + parent: this.el, + }); + this.next = $$el("div", "next", { + parent: this.el, + onclick: (e) => { + this.update(1); + e.stopImmediatePropagation(); + }, + }); + this.link = $$el("a", "link", { + parent: this.main, + target: "_blank", + }); + this.spinner = createSpinner(); + this.link.appendChild(this.spinner); + this.img = $$el("img", "img", { + style: { + opacity: 0, + }, + parent: this.link, + onclick: (e) => { + e.stopImmediatePropagation(); + }, + onwheel: (e) => { + if (!(e instanceof WheelEvent) || e.ctrlKey) { + return; + } + const direction = Math.sign(e.deltaY); + this.update(direction); + }, + }); + } + + close() { + ani( + () => (this.el.style.opacity = 0), + 200, + () => (this.el.style.display = "none") + ); + } + + async show(images, index) { + this.images = images; + this.index = index || 0; + await this.update(0); + } + + async update(shift) { + if (shift < 0 && this.index <= 0) { + return; + } + if (shift > 0 && this.index >= this.images.length - 1) { + return; + } + this.index += shift; + + this.prev.style.visibility = this.index ? "unset" : "hidden"; + this.next.style.visibility = this.index === this.images.length - 1 ? "hidden" : "unset"; + + const img = this.images[this.index]; + this.el.style.display = "flex"; + this.el.clientWidth; // Force a reflow + this.el.style.opacity = 1; + this.img.style.opacity = 0; + this.spinner.style.display = "inline-block"; + try { + await loadImage(img); + } catch (err) { + console.error('failed to load image', img, err); + } + this.spinner.style.display = "none"; + this.link.href = img; + this.img.src = img; + this.img.style.opacity = 1; + } + + async updateWithNewImage(img, feedDirection) { + // No-op if lightbox is not open + if (this.el.style.display === "none" || this.el.style.opacity === "0") return; + + // Ensure currently shown image does not change + const [method, shift] = feedDirection === "newest first" ? ["unshift", 1] : ["push", 0]; + this.images[method](img); + await this.update(shift); + } +} + +export const lightbox = new Lightbox(); + +addEventListener('keydown', (event) => { + if (lightbox.el.style.display === 'none') { + return; + } + const { key } = event; + switch (key) { + case 'ArrowLeft': + case 'a': + lightbox.update(-1); + break; + case 'ArrowRight': + case 'd': + lightbox.update(1); + break; + case 'Escape': + lightbox.close(); + break; + } +}); \ No newline at end of file diff --git a/web/js/common/modelInfoDialog.css b/web/js/common/modelInfoDialog.css new file mode 100644 index 0000000..a5b9f62 --- /dev/null +++ b/web/js/common/modelInfoDialog.css @@ -0,0 +1,119 @@ +.pysssss-model-info { + color: white; + font-family: sans-serif; + max-width: 90vw; +} +.pysssss-model-content { + display: flex; + flex-direction: column; + overflow: hidden; +} +.pysssss-model-info h2 { + text-align: center; + margin: 0 0 10px 0; +} +.pysssss-model-info p { + margin: 5px 0; +} +.pysssss-model-info a { + color: dodgerblue; +} +.pysssss-model-info a:hover { + text-decoration: underline; +} +.pysssss-model-tags-list { + display: flex; + flex-wrap: wrap; + list-style: none; + gap: 10px; + max-height: 200px; + overflow: auto; + margin: 10px 0; + padding: 0; +} +.pysssss-model-tag { + background-color: rgb(128, 213, 247); + color: #000; + display: flex; + align-items: center; + gap: 5px; + border-radius: 5px; + padding: 2px 5px; + cursor: pointer; +} +.pysssss-model-tag--selected span::before { + content: "✅"; + position: absolute; + background-color: dodgerblue; + left: 0; + top: 0; + right: 0; + bottom: 0; + text-align: center; +} +.pysssss-model-tag:hover { + outline: 2px solid dodgerblue; +} +.pysssss-model-tag p { + margin: 0; +} +.pysssss-model-tag span { + text-align: center; + border-radius: 5px; + background-color: dodgerblue; + color: #fff; + padding: 2px; + position: relative; + min-width: 20px; + overflow: hidden; +} + +.pysssss-model-metadata .comfy-modal-content { + max-width: 100%; +} +.pysssss-model-metadata label { + margin-right: 1ch; + color: #ccc; +} + +.pysssss-model-metadata span { + color: dodgerblue; +} + +.pysssss-preview { + max-width: 50%; + margin-left: 10px; + position: relative; +} +.pysssss-preview img { + max-height: 300px; +} +.pysssss-preview button { + position: absolute; + font-size: 12px; + bottom: 10px; + right: 10px; +} +.pysssss-preview button+button { + bottom: 34px; +} + +.pysssss-preview button.pysssss-preview-nav { + bottom: unset; + right: 30px; + top: 10px; + font-size: 14px; + line-height: 14px; +} + +.pysssss-preview button.pysssss-preview-nav+.pysssss-preview-nav { + right: 10px; +} +.pysssss-model-notes { + background-color: rgba(0, 0, 0, 0.25); + padding: 5px; + margin-top: 5px; +} +.pysssss-model-notes:empty { + display: none; +} diff --git a/web/js/common/modelInfoDialog.js b/web/js/common/modelInfoDialog.js new file mode 100644 index 0000000..032767d --- /dev/null +++ b/web/js/common/modelInfoDialog.js @@ -0,0 +1,358 @@ +import { $el, ComfyDialog } from "../../../../scripts/ui.js"; +import { api } from "../../../../scripts/api.js"; +import { addStylesheet } from "./utils.js"; + +addStylesheet(import.meta.url); + +class MetadataDialog extends ComfyDialog { + constructor() { + super(); + + this.element.classList.add("pysssss-model-metadata"); + } + show(metadata) { + super.show( + $el( + "div", + Object.keys(metadata).map((k) => + $el("div", [ + $el("label", { textContent: k }), + $el("span", { textContent: typeof metadata[k] === "object" ? JSON.stringify(metadata[k]) : metadata[k] }), + ]) + ) + ) + ); + } +} + +export class ModelInfoDialog extends ComfyDialog { + constructor(name, node) { + super(); + this.name = name; + this.node = node; + this.element.classList.add("pysssss-model-info"); + } + + get customNotes() { + return this.metadata["pysssss.notes"]; + } + + set customNotes(v) { + this.metadata["pysssss.notes"] = v; + } + + get hash() { + return this.metadata["pysssss.sha256"]; + } + + async show(type, value) { + this.type = type; + + const req = api.fetchApi("/pysssss/metadata/" + encodeURIComponent(`${type}/${value}`)); + this.info = $el("div", { style: { flex: "auto" } }); + this.img = $el("img", { style: { display: "none" } }); + this.imgWrapper = $el("div.pysssss-preview", [this.img]); + this.main = $el("main", { style: { display: "flex" } }, [this.info, this.imgWrapper]); + this.content = $el("div.pysssss-model-content", [$el("h2", { textContent: this.name }), this.main]); + + const loading = $el("div", { textContent: "ℹ️ Loading...", parent: this.content }); + + super.show(this.content); + + this.metadata = await (await req).json(); + this.viewMetadata.style.cursor = this.viewMetadata.style.opacity = ""; + this.viewMetadata.removeAttribute("disabled"); + + loading.remove(); + this.addInfo(); + } + + createButtons() { + const btns = super.createButtons(); + this.viewMetadata = $el("button", { + type: "button", + textContent: "View raw metadata", + disabled: "disabled", + style: { + opacity: 0.5, + cursor: "not-allowed", + }, + onclick: (e) => { + if (this.metadata) { + new MetadataDialog().show(this.metadata); + } + }, + }); + + btns.unshift(this.viewMetadata); + return btns; + } + + getNoteInfo() { + function parseNote() { + if (!this.customNotes) return []; + + let notes = []; + // Extract links from notes + const r = new RegExp("(\\bhttps?:\\/\\/[^\\s]+)", "g"); + let end = 0; + let m; + do { + m = r.exec(this.customNotes); + let pos; + let fin = 0; + if (m) { + pos = m.index; + fin = m.index + m[0].length; + } else { + pos = this.customNotes.length; + } + + let pre = this.customNotes.substring(end, pos); + if (pre) { + pre = pre.replaceAll("\n", "
"); + notes.push( + $el("span", { + innerHTML: pre, + }) + ); + } + if (m) { + notes.push( + $el("a", { + href: m[0], + textContent: m[0], + target: "_blank", + }) + ); + } + + end = fin; + } while (m); + return notes; + } + + let textarea; + let notesContainer; + const editText = "✏️ Edit"; + const edit = $el("a", { + textContent: editText, + href: "#", + style: { + float: "right", + color: "greenyellow", + textDecoration: "none", + }, + onclick: async (e) => { + e.preventDefault(); + + if (textarea) { + this.customNotes = textarea.value; + + const resp = await api.fetchApi("/pysssss/metadata/notes/" + encodeURIComponent(`${this.type}/${this.name}`), { + method: "POST", + body: this.customNotes, + }); + + if (resp.status !== 200) { + console.error(resp); + alert(`Error saving notes (${req.status}) ${req.statusText}`); + return; + } + + e.target.textContent = editText; + textarea.remove(); + textarea = null; + + notesContainer.replaceChildren(...parseNote.call(this)); + this.node?.["pysssss.updateExamples"]?.(); + } else { + e.target.textContent = "💾 Save"; + textarea = $el("textarea", { + style: { + width: "100%", + minWidth: "200px", + minHeight: "50px", + }, + textContent: this.customNotes, + }); + e.target.after(textarea); + notesContainer.replaceChildren(); + textarea.style.height = Math.min(textarea.scrollHeight, 300) + "px"; + } + }, + }); + + notesContainer = $el("div.pysssss-model-notes", parseNote.call(this)); + return $el( + "div", + { + style: { display: "contents" }, + }, + [edit, notesContainer] + ); + } + + addInfo() { + const usageHint = this.metadata["modelspec.usage_hint"]; + if (usageHint) { + this.addInfoEntry("Usage Hint", usageHint); + } + this.addInfoEntry("Notes", this.getNoteInfo()); + } + + addInfoEntry(name, value) { + return $el( + "p", + { + parent: this.info, + }, + [ + typeof name === "string" ? $el("label", { textContent: name + ": " }) : name, + typeof value === "string" ? $el("span", { textContent: value }) : value, + ] + ); + } + + async getCivitaiDetails() { + const req = await fetch("https://civitai.com/api/v1/model-versions/by-hash/" + this.hash); + if (req.status === 200) { + return await req.json(); + } else if (req.status === 404) { + throw new Error("Model not found"); + } else { + throw new Error(`Error loading info (${req.status}) ${req.statusText}`); + } + } + + addCivitaiInfo() { + const promise = this.getCivitaiDetails(); + const content = $el("span", { textContent: "ℹ️ Loading..." }); + + this.addInfoEntry( + $el("label", [ + $el("img", { + style: { + width: "18px", + position: "relative", + top: "3px", + margin: "0 5px 0 0", + }, + src: "https://civitai.com/favicon.ico", + }), + $el("span", { textContent: "Civitai: " }), + ]), + content + ); + + return promise + .then((info) => { + content.replaceChildren( + $el("a", { + href: "https://civitai.com/models/" + info.modelId, + textContent: "View " + info.model.name, + target: "_blank", + }) + ); + + const allPreviews = info.images?.filter((i) => i.type === "image"); + const previews = allPreviews?.filter((i) => i.nsfwLevel <= ModelInfoDialog.nsfwLevel); + if (previews?.length) { + let previewIndex = 0; + let preview; + const updatePreview = () => { + preview = previews[previewIndex]; + this.img.src = preview.url; + }; + + updatePreview(); + this.img.style.display = ""; + + this.img.title = `${previews.length} previews.`; + if (allPreviews.length !== previews.length) { + this.img.title += ` ${allPreviews.length - previews.length} images hidden due to NSFW level.`; + } + + this.imgSave = $el("button", { + textContent: "Use as preview", + parent: this.imgWrapper, + onclick: async () => { + // Convert the preview to a blob + const blob = await (await fetch(this.img.src)).blob(); + + // Store it in temp + const name = "temp_preview." + new URL(this.img.src).pathname.split(".")[1]; + const body = new FormData(); + body.append("image", new File([blob], name)); + body.append("overwrite", "true"); + body.append("type", "temp"); + + const resp = await api.fetchApi("/upload/image", { + method: "POST", + body, + }); + + if (resp.status !== 200) { + console.error(resp); + alert(`Error saving preview (${req.status}) ${req.statusText}`); + return; + } + + // Use as preview + await api.fetchApi("/pysssss/save/" + encodeURIComponent(`${this.type}/${this.name}`), { + method: "POST", + body: JSON.stringify({ + filename: name, + type: "temp", + }), + headers: { + "content-type": "application/json", + }, + }); + app.refreshComboInNodes(); + }, + }); + + $el("button", { + textContent: "Show metadata", + parent: this.imgWrapper, + onclick: async () => { + if (preview.meta && Object.keys(preview.meta).length) { + new MetadataDialog().show(preview.meta); + } else { + alert("No image metadata found"); + } + }, + }); + + const addNavButton = (icon, direction) => { + $el("button.pysssss-preview-nav", { + textContent: icon, + parent: this.imgWrapper, + onclick: async () => { + previewIndex += direction; + if (previewIndex < 0) { + previewIndex = previews.length - 1; + } else if (previewIndex >= previews.length) { + previewIndex = 0; + } + updatePreview(); + }, + }); + }; + + if (previews.length > 1) { + addNavButton("‹", -1); + addNavButton("›", 1); + } + } else if (info.images?.length) { + $el("span", { style: { opacity: 0.6 }, textContent: "⚠️ All images hidden due to NSFW level setting.", parent: this.imgWrapper }); + } + + return info; + }) + .catch((err) => { + content.textContent = "⚠️ " + err.message; + }); + } +} diff --git a/web/js/common/spinner.css b/web/js/common/spinner.css new file mode 100644 index 0000000..3b47902 --- /dev/null +++ b/web/js/common/spinner.css @@ -0,0 +1,35 @@ +.pysssss-lds-ring { + display: inline-block; + position: relative; + width: 80px; + height: 80px; +} +.pysssss-lds-ring div { + box-sizing: border-box; + display: block; + position: absolute; + width: 64px; + height: 64px; + margin: 8px; + border: 5px solid #fff; + border-radius: 50%; + animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: #fff transparent transparent transparent; +} +.pysssss-lds-ring div:nth-child(1) { + animation-delay: -0.45s; +} +.pysssss-lds-ring div:nth-child(2) { + animation-delay: -0.3s; +} +.pysssss-lds-ring div:nth-child(3) { + animation-delay: -0.15s; +} +@keyframes lds-ring { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/web/js/common/spinner.js b/web/js/common/spinner.js new file mode 100644 index 0000000..4075990 --- /dev/null +++ b/web/js/common/spinner.js @@ -0,0 +1,9 @@ +import { addStylesheet } from "./utils.js"; + +addStylesheet(import.meta.url); + +export function createSpinner() { + const div = document.createElement("div"); + div.innerHTML = `
`; + return div.firstElementChild; +} diff --git a/web/js/common/utils.js b/web/js/common/utils.js new file mode 100644 index 0000000..cd7539d --- /dev/null +++ b/web/js/common/utils.js @@ -0,0 +1,30 @@ +import { $el } from "../../../../scripts/ui.js"; + +export function addStylesheet(url) { + if (url.endsWith(".js")) { + url = url.substr(0, url.length - 2) + "css"; + } + $el("link", { + parent: document.head, + rel: "stylesheet", + type: "text/css", + href: url.startsWith("http") ? url : getUrl(url), + }); +} + +export function getUrl(path, baseUrl) { + if (baseUrl) { + return new URL(path, baseUrl).toString(); + } else { + return new URL("../" + path, import.meta.url).toString(); + } +} + +export async function loadImage(url) { + return new Promise((res, rej) => { + const img = new Image(); + img.onload = res; + img.onerror = rej; + img.src = url; + }); +} diff --git a/web/js/libs/coloris.min.js b/web/js/libs/coloris.min.js new file mode 100644 index 0000000..017d102 --- /dev/null +++ b/web/js/libs/coloris.min.js @@ -0,0 +1,6 @@ +/*! + * Copyright (c) 2021 Momo Bassit. + * Licensed under the MIT License (MIT) + * https://github.com/mdbassit/Coloris + */ +!function(u,d,s,c){var p,f,h,i,b,v,y,g,m,l,w,k,L,E,a,n,r=d.createElement("canvas").getContext("2d"),x={r:0,g:0,b:0,h:0,s:0,v:0,a:1},A={},S={el:"[data-coloris]",parent:"body",theme:"default",themeMode:"light",rtl:!1,wrap:!0,margin:2,format:"hex",formatToggle:!1,swatches:[],swatchesOnly:!1,alpha:!0,forceAlpha:!1,focusInput:!0,selectInput:!1,inline:!1,defaultColor:"#000000",clearButton:!1,clearLabel:"Clear",closeButton:!1,closeLabel:"Close",onChange:function(){return c},a11y:{open:"Open color picker",close:"Close color picker",clear:"Clear the selected color",marker:"Saturation: {s}. Brightness: {v}.",hueSlider:"Hue slider",alphaSlider:"Opacity slider",input:"Color value field",format:"Color format",swatch:"Color swatch",instruction:"Saturation and brightness selector. Use up, down, left and right arrow keys to select."}},o={},C="",T={},B=!1;function M(e){if("object"==typeof e)for(var t in e)switch(t){case"el":N(e.el),!1!==e.wrap&&j(e.el);break;case"parent":(p=d.querySelector(e.parent))&&(p.appendChild(f),S.parent=e.parent,p===d.body&&(p=c));break;case"themeMode":S.themeMode=e.themeMode,"auto"===e.themeMode&&u.matchMedia&&u.matchMedia("(prefers-color-scheme: dark)").matches&&(S.themeMode="dark");case"theme":e.theme&&(S.theme=e.theme),f.className="clr-picker clr-"+S.theme+" clr-"+S.themeMode,S.inline&&I();break;case"rtl":S.rtl=!!e.rtl,d.querySelectorAll(".clr-field").forEach(function(e){return e.classList.toggle("clr-rtl",S.rtl)});break;case"margin":e.margin*=1,S.margin=(isNaN(e.margin)?S:e).margin;break;case"wrap":e.el&&e.wrap&&j(e.el);break;case"formatToggle":S.formatToggle=!!e.formatToggle,z("clr-format").style.display=S.formatToggle?"block":"none",S.formatToggle&&(S.format="auto");break;case"swatches":Array.isArray(e.swatches)&&function(){var a=[];e.swatches.forEach(function(e,t){a.push('")}),z("clr-swatches").innerHTML=a.length?"
"+a.join("")+"
":"",S.swatches=e.swatches.slice()}();break;case"swatchesOnly":S.swatchesOnly=!!e.swatchesOnly,f.setAttribute("data-minimal",S.swatchesOnly);break;case"alpha":S.alpha=!!e.alpha,f.setAttribute("data-alpha",S.alpha);break;case"inline":S.inline=!!e.inline,f.setAttribute("data-inline",S.inline),S.inline&&(l=e.defaultColor||S.defaultColor,E=q(l),I(),W(l));break;case"clearButton":"object"==typeof e.clearButton&&(e.clearButton.label&&(S.clearLabel=e.clearButton.label,y.innerHTML=S.clearLabel),e.clearButton=e.clearButton.show),S.clearButton=!!e.clearButton,y.style.display=S.clearButton?"block":"none";break;case"clearLabel":S.clearLabel=e.clearLabel,y.innerHTML=S.clearLabel;break;case"closeButton":S.closeButton=!!e.closeButton,S.closeButton?f.insertBefore(g,b):b.appendChild(g);break;case"closeLabel":S.closeLabel=e.closeLabel,g.innerHTML=S.closeLabel;break;case"a11y":var a,l,r=e.a11y,n=!1;if("object"==typeof r)for(var o in r)r[o]&&S.a11y[o]&&(S.a11y[o]=r[o],n=!0);n&&(a=z("clr-open-label"),l=z("clr-swatch-label"),a.innerHTML=S.a11y.open,l.innerHTML=S.a11y.swatch,g.setAttribute("aria-label",S.a11y.close),y.setAttribute("aria-label",S.a11y.clear),m.setAttribute("aria-label",S.a11y.hueSlider),w.setAttribute("aria-label",S.a11y.alphaSlider),v.setAttribute("aria-label",S.a11y.input),h.setAttribute("aria-label",S.a11y.instruction));break;default:S[t]=e[t]}}function H(e,t){"string"==typeof e&&"object"==typeof t&&(o[e]=t,B=!0)}function O(e){delete o[e],0===Object.keys(o).length&&(B=!1,e===C&&D())}function t(l){if(B){var e,r=["el","wrap","rtl","inline","defaultColor","a11y"];for(e in o)if("break"===function(e){var t=o[e];if(l.matches(e)){for(var a in C=e,T={},r.forEach(function(e){return delete t[e]}),t)T[a]=Array.isArray(S[a])?S[a].slice():S[a];return M(t),"break"}}(e))break}}function D(){0r.clientWidth&&(a+=t.width-o,i.left=!0),l+c>r.clientHeight-e&&c+S.margin<=t.top-(s.y-n)&&(l-=t.height+c+2*S.margin,i.top=!0),l+=r.scrollTop):(a+o>d.documentElement.clientWidth&&(a+=t.width-o,i.left=!0),l+c-n>d.documentElement.clientHeight&&c+S.margin<=t.top&&(l=n+t.y-c-S.margin,i.top=!0)),f.classList.toggle("clr-left",i.left),f.classList.toggle("clr-top",i.top),f.style.left=a+"px",f.style.top=l+"px",s.x+=f.offsetLeft,s.y+=f.offsetTop),A={width:h.offsetWidth,height:h.offsetHeight,x:h.offsetLeft+s.x,y:h.offsetTop+s.y}}function j(e){d.querySelectorAll(e).forEach(function(e){var t,a,l=e.parentNode;l.classList.contains("clr-field")||(t=d.createElement("div"),a="clr-field",(S.rtl||e.classList.contains("clr-rtl"))&&(a+=" clr-rtl"),t.innerHTML='',l.insertBefore(t,e),t.setAttribute("class",a),t.style.color=e.value,t.appendChild(e))})}function R(e){var t;L&&!S.inline&&(t=L,e&&(L=c,a!==t.value&&(t.value=a,t.dispatchEvent(new Event("input",{bubbles:!0})))),setTimeout(function(){a!==t.value&&t.dispatchEvent(new Event("change",{bubbles:!0}))}),f.classList.remove("clr-open"),B&&D(),t.dispatchEvent(new Event("close",{bubbles:!0})),S.focusInput&&t.focus({preventScroll:!0}),L=c)}function W(e){var t=function(e){r.fillStyle="#000",r.fillStyle=e,e=(e=/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i.exec(r.fillStyle))?{r:+e[3],g:+e[4],b:+e[5],a:+e[6]}:(e=r.fillStyle.replace("#","").match(/.{2}/g).map(function(e){return parseInt(e,16)}),{r:e[0],g:e[1],b:e[2],a:1});return e}(e),e=function(e){var t=e.r/255,a=e.g/255,l=e.b/255,r=s.max(t,a,l),n=s.min(t,a,l),o=r-n,c=r,i=0,n=0;o&&(r===t&&(i=(a-l)/o),r===a&&(i=2+(l-t)/o),r===l&&(i=4+(t-a)/o),r&&(n=o/r));return{h:(i=s.floor(60*i))<0?i+360:i,s:s.round(100*n),v:s.round(100*c),a:e.a}}(t);P(e.s,e.v),G(t,e),m.value=e.h,f.style.color="hsl("+e.h+", 100%, 50%)",l.style.left=e.h/360*100+"%",i.style.left=A.width*e.s/100+"px",i.style.top=A.height-A.height*e.v/100+"px",w.value=100*e.a,k.style.left=100*e.a+"%"}function q(e){e=e.substring(0,3).toLowerCase();return"rgb"===e||"hsl"===e?e:"hex"}function F(e){e=e!==c?e:v.value,L&&(L.value=e,L.dispatchEvent(new Event("input",{bubbles:!0}))),S.onChange&&S.onChange.call(u,e,L),d.dispatchEvent(new CustomEvent("coloris:pick",{detail:{color:e,currentEl:L}}))}function Y(e,t){e={h:+m.value,s:e/A.width*100,v:100-t/A.height*100,a:w.value/100},t=function(e){var t=e.s/100,a=e.v/100,l=t*a,r=e.h/60,n=l*(1-s.abs(r%2-1)),o=a-l;l+=o,n+=o;t=s.floor(r)%6,a=[l,n,o,o,n,l][t],r=[n,l,l,n,o,o][t],t=[o,o,n,l,l,n][t];return{r:s.round(255*a),g:s.round(255*r),b:s.round(255*t),a:e.a}}(e);P(e.s,e.v),G(t,e),F()}function P(e,t){var a=S.a11y.marker;e=+e.toFixed(1),t=+t.toFixed(1),a=(a=a.replace("{s}",e)).replace("{v}",t),i.setAttribute("aria-label",a)}function U(e){var t={pageX:((a=e).changedTouches?a.changedTouches[0]:a).pageX,pageY:(a.changedTouches?a.changedTouches[0]:a).pageY},a=t.pageX-A.x,t=t.pageY-A.y;p&&(t+=p.scrollTop),X(a,t),e.preventDefault(),e.stopPropagation()}function X(e,t){e=e<0?0:e>A.width?A.width:e,t=t<0?0:t>A.height?A.height:t,i.style.left=e+"px",i.style.top=t+"px",Y(e,t),i.focus()}function G(e,t){void 0===t&&(t={});var a,l,r=S.format;for(a in e=void 0===e?{}:e)x[a]=e[a];for(l in t)x[l]=t[l];var n,o=function(e){var t=e.r.toString(16),a=e.g.toString(16),l=e.b.toString(16),r="";e.r<16&&(t="0"+t);e.g<16&&(a="0"+a);e.b<16&&(l="0"+l);S.alpha&&(e.a<1||S.forceAlpha)&&(e=255*e.a|0,r=e.toString(16),e<16&&(r="0"+r));return"#"+t+a+l+r}(x),c=o.substring(0,7);switch(i.style.color=c,k.parentNode.style.color=c,k.style.color=o,b.style.color=o,h.style.display="none",h.offsetHeight,h.style.display="",k.nextElementSibling.style.display="none",k.nextElementSibling.offsetHeight,k.nextElementSibling.style.display="","mixed"===r?r=1===x.a?"hex":"rgb":"auto"===r&&(r=E),r){case"hex":v.value=o;break;case"rgb":v.value=(n=x,!S.alpha||1===n.a&&!S.forceAlpha?"rgb("+n.r+", "+n.g+", "+n.b+")":"rgba("+n.r+", "+n.g+", "+n.b+", "+n.a+")");break;case"hsl":v.value=(n=function(e){var t,a=e.v/100,l=a*(1-e.s/100/2);0
'+S.a11y.format+'
",d.body.appendChild(f),h=z("clr-color-area"),i=z("clr-color-marker"),y=z("clr-clear"),g=z("clr-close"),b=z("clr-color-preview"),v=z("clr-color-value"),m=z("clr-hue-slider"),l=z("clr-hue-marker"),w=z("clr-alpha-slider"),k=z("clr-alpha-marker"),N(S.el),j(S.el),J(f,"mousedown",function(e){f.classList.remove("clr-keyboard-nav"),e.stopPropagation()}),J(h,"mousedown",function(e){J(d,"mousemove",U)}),J(h,"touchstart",function(e){d.addEventListener("touchmove",U,{passive:!1})}),J(i,"mousedown",function(e){J(d,"mousemove",U)}),J(i,"touchstart",function(e){d.addEventListener("touchmove",U,{passive:!1})}),J(v,"change",function(e){var t=v.value;(L||S.inline)&&F(""===t?t:W(t))}),J(y,"click",function(e){F(""),R()}),J(g,"click",function(e){F(),R()}),J(z("clr-format"),"click",".clr-format input",function(e){E=e.target.value,G(),F()}),J(f,"click",".clr-swatches button",function(e){W(e.target.textContent),F(),S.swatchesOnly&&R()}),J(d,"mouseup",function(e){d.removeEventListener("mousemove",U)}),J(d,"touchend",function(e){d.removeEventListener("touchmove",U)}),J(d,"mousedown",function(e){n=!1,f.classList.remove("clr-keyboard-nav"),R()}),J(d,"keydown",function(e){var t,a=e.key,l=e.target,r=e.shiftKey;"Escape"===a?R(!0):["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(a)&&(n=!0,f.classList.add("clr-keyboard-nav")),"Tab"===a&&l.matches(".clr-picker *")&&(a=(t=$()).shift(),t=t.pop(),r&&l===a?(t.focus(),e.preventDefault()):r||l!==t||(a.focus(),e.preventDefault()))}),J(d,"click",".clr-field button",function(e){B&&D(),e.target.nextElementSibling.dispatchEvent(new Event("click",{bubbles:!0}))}),J(i,"keydown",function(e){var t={ArrowUp:[0,-1],ArrowDown:[0,1],ArrowLeft:[-1,0],ArrowRight:[1,0]};Object.keys(t).includes(e.key)&&(!function(e,t){X(+i.style.left.replace("px","")+e,+i.style.top.replace("px","")+t)}.apply(void 0,t[e.key]),e.preventDefault())}),J(h,"click",U),J(m,"input",e),J(w,"input",K)})}(window,document,Math); \ No newline at end of file diff --git a/web/js/threeVisualizer.js b/web/js/threeVisualizer.js new file mode 100644 index 0000000..7dd5fc5 --- /dev/null +++ b/web/js/threeVisualizer.js @@ -0,0 +1,177 @@ +import * as THREE from 'three'; +import { api } from '/scripts/api.js'; +import {getRGBValue} from '/extensions/Comfy-Rodin/js/sharedFunctions.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +const visualizer = document.getElementById("visualizer"); +const container = document.getElementById( 'container' ); +const progressDialog = document.getElementById("progress-dialog"); +const progressIndicator = document.getElementById("progress-indicator"); +const colorPicker = document.getElementById("color-picker"); +const downloadButton = document.getElementById("download-button"); + +const renderer = new THREE.WebGLRenderer( { antialias: true } ); +renderer.setPixelRatio( window.devicePixelRatio ); +renderer.setSize( window.innerWidth, window.innerHeight ); +container.appendChild( renderer.domElement ); + +const pmremGenerator = new THREE.PMREMGenerator( renderer ); + +// scene +const scene = new THREE.Scene(); +scene.background = new THREE.Color( 0x000000 ); +scene.environment = pmremGenerator.fromScene( new RoomEnvironment( renderer ), 0.04 ).texture; + +const ambientLight = new THREE.AmbientLight( 0xffffff , 3.0 ); + +const camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 100 ); +camera.position.set( 5, 2, 8 ); +const pointLight = new THREE.PointLight( 0xffffff, 15 ); +camera.add( pointLight ); + +const controls = new OrbitControls( camera, renderer.domElement ); +controls.target.set( 0, 0.5, 0 ); +controls.update(); +controls.enablePan = true; +controls.enableDamping = true; + +// Handle window reseize event +window.onresize = function () { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + +}; + +const clock = new THREE.Clock(); + +var lastTimestamp = ""; +var needUpdate = false; +let mixer; +let currentURL; +var url = location.protocol + '//' + location.host; + +downloadButton.addEventListener('click', e => { + window.open(currentURL, '_blank'); +}); + +function frameUpdate() { + + var filepath = visualizer.getAttribute("filepath"); + var timestamp = visualizer.getAttribute("timestamp"); + if (timestamp == lastTimestamp){ + if (needUpdate){ + controls.update(); + if (mixer !== undefined) { + const delta = clock.getDelta(); + mixer.update(delta); + } + renderer.render( scene, camera ); + } + requestAnimationFrame( frameUpdate ); + } else { + needUpdate = false; + scene.clear(); + progressDialog.open = true; + lastTimestamp = timestamp; + main(filepath); + } + + var color = getRGBValue(colorPicker.value, true); + if (color[0] != scene.background.r || color[1] != scene.background.g || color[2] != scene.background.b){ + scene.background.setStyle(colorPicker.value); + renderer.render( scene, camera ); // Force update background color in preview scene + } +} + +const onProgress = function ( xhr ) { + if ( xhr.lengthComputable ) { + progressIndicator.value = xhr.loaded / xhr.total * 100; + } +}; +const onError = function ( e ) { + console.error( e ); +}; + +async function main(filepath="") { + // Check if file name is valid + if (/^.+\.[a-zA-Z]+$/.test(filepath)){ + + let params = {"filepath": filepath}; + currentURL = api.apiURL('/viewfile?' + new URLSearchParams(params)); + + var filepathSplit = filepath.split('.'); + var fileExt = filepathSplit.pop().toLowerCase(); + var filepathNoExt = filepathSplit.join("."); + + if (fileExt == "obj"){ + const loader = new OBJLoader(); + + var mtlFolderpath = filepath.substring(0, Math.max(filepath.lastIndexOf("/"), filepath.lastIndexOf("\\"))) + "/"; + var mtlFilepath = filepathNoExt.replace(/^.*[\\\/]/, '') + ".mtl"; + + const mtlLoader = new MTLLoader(); + mtlLoader.setPath(api.apiURL('/viewfile?' + new URLSearchParams({"filepath": mtlFolderpath}))); + mtlLoader.load( mtlFilepath, function ( mtl ) { + mtl.preload(); + loader.setMaterials( mtl ); + }, onProgress, onError ); + + loader.load( currentURL, function ( obj ) { + obj.scale.setScalar( 5 ); + scene.add( obj ); + obj.traverse(node => { + if (node.material && node.material.map == null) { + node.material.vertexColors = true; + } + }); + + }, onProgress, onError ); + + } else if (fileExt == "glb") { + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath( 'https://unpkg.com/three@latest/examples/jsm/libs/draco/gltf/' ); + const loader = new GLTFLoader(); + loader.setDRACOLoader( dracoLoader ); + + loader.load( currentURL, function ( gltf ) { + const model = gltf.scene; + //model.position.set( 1, 1, 0 ); + model.scale.set( 3, 3, 3 ); + + scene.add( model ); + mixer = new THREE.AnimationMixer(model); + gltf.animations.forEach((clip) => { + mixer.clipAction(clip).play(); + }); + + }, onProgress, onError ); + + } else if (fileExt == "ply") { + + } else { + throw new Error(`File extension name has to be either .ply or .splat, got .${fileExt}`); + } + + needUpdate = true; + } + + scene.add( ambientLight ); + scene.add( camera ); + + progressDialog.close(); + + frameUpdate(); +} + +main("D:\\ComfyUI\\ComfyUI_windows_portable_nvidia_cu121_or_cpu\\ComfyUI_windows_portable\\ComfyUI\\output\\2024-09-12_17-52-06\\model.glb"); +//main(); diff --git a/web/style/gsStyle.css b/web/style/gsStyle.css new file mode 100644 index 0000000..997fab4 --- /dev/null +++ b/web/style/gsStyle.css @@ -0,0 +1,12 @@ +body, +html { + margin: 0; + padding: 0; + overflow: hidden; + background-color: #000; +} + +canvas { + width: 100vw; + height: 100vh; +} \ No newline at end of file diff --git a/web/style/libs/coloris.min.css b/web/style/libs/coloris.min.css new file mode 100644 index 0000000..885df05 --- /dev/null +++ b/web/style/libs/coloris.min.css @@ -0,0 +1 @@ +.clr-picker{display:none;flex-wrap:wrap;position:absolute;width:200px;z-index:1000;border-radius:10px;background-color:#fff;justify-content:flex-end;direction:ltr;box-shadow:0 0 5px rgba(0,0,0,.05),0 5px 20px rgba(0,0,0,.1);-moz-user-select:none;-webkit-user-select:none;user-select:none}.clr-picker.clr-open,.clr-picker[data-inline=true]{display:flex}.clr-picker[data-inline=true]{position:relative}.clr-gradient{position:relative;width:100%;height:100px;margin-bottom:15px;border-radius:3px 3px 0 0;background-image:linear-gradient(rgba(0,0,0,0),#000),linear-gradient(90deg,#fff,currentColor);cursor:pointer}.clr-marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:currentColor;cursor:pointer}.clr-picker input[type=range]::-webkit-slider-runnable-track{width:100%;height:16px}.clr-picker input[type=range]::-webkit-slider-thumb{width:16px;height:16px;-webkit-appearance:none}.clr-picker input[type=range]::-moz-range-track{width:100%;height:16px;border:0}.clr-picker input[type=range]::-moz-range-thumb{width:16px;height:16px;border:0}.clr-hue{background-image:linear-gradient(to right,red 0,#ff0 16.66%,#0f0 33.33%,#0ff 50%,#00f 66.66%,#f0f 83.33%,red 100%)}.clr-alpha,.clr-hue{position:relative;width:calc(100% - 40px);height:8px;margin:5px 20px;border-radius:4px}.clr-alpha span{display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.clr-alpha input[type=range],.clr-hue input[type=range]{position:absolute;width:calc(100% + 32px);height:16px;left:-16px;top:-4px;margin:0;background-color:transparent;opacity:0;cursor:pointer;appearance:none;-webkit-appearance:none}.clr-alpha div,.clr-hue div{position:absolute;width:16px;height:16px;left:0;top:50%;margin-left:-8px;transform:translateY(-50%);border:2px solid #fff;border-radius:50%;background-color:currentColor;box-shadow:0 0 1px #888;pointer-events:none}.clr-alpha div:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border-radius:50%;background-color:currentColor}.clr-format{display:none;order:1;width:calc(100% - 40px);margin:0 20px 20px}.clr-segmented{display:flex;position:relative;width:100%;margin:0;padding:0;border:1px solid #ddd;border-radius:15px;box-sizing:border-box;color:#999;font-size:12px}.clr-segmented input,.clr-segmented legend{position:absolute;width:100%;height:100%;margin:0;padding:0;border:0;left:0;top:0;opacity:0;pointer-events:none}.clr-segmented label{flex-grow:1;margin:0;padding:4px 0;font-size:inherit;font-weight:400;line-height:initial;text-align:center;cursor:pointer}.clr-segmented label:first-of-type{border-radius:10px 0 0 10px}.clr-segmented label:last-of-type{border-radius:0 10px 10px 0}.clr-segmented input:checked+label{color:#fff;background-color:#666}.clr-swatches{order:2;width:calc(100% - 32px);margin:0 16px}.clr-swatches div{display:flex;flex-wrap:wrap;padding-bottom:12px;justify-content:center}.clr-swatches button{position:relative;width:20px;height:20px;margin:0 4px 6px 4px;padding:0;border:0;border-radius:50%;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;cursor:pointer}.clr-swatches button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}input.clr-color{order:1;width:calc(100% - 80px);height:32px;margin:15px 20px 20px auto;padding:0 10px;border:1px solid #ddd;border-radius:16px;color:#444;background-color:#fff;font-family:sans-serif;font-size:14px;text-align:center;box-shadow:none}input.clr-color:focus{outline:0;border:1px solid #1e90ff}.clr-clear,.clr-close{display:none;order:2;height:24px;margin:0 20px 20px;padding:0 20px;border:0;border-radius:12px;color:#fff;background-color:#666;font-family:inherit;font-size:12px;font-weight:400;cursor:pointer}.clr-close{display:block;margin:0 20px 20px auto}.clr-preview{position:relative;width:32px;height:32px;margin:15px 0 20px 20px;border-radius:50%;overflow:hidden}.clr-preview:after,.clr-preview:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.clr-preview:after{border:0;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-preview button{position:absolute;width:100%;height:100%;z-index:1;margin:0;padding:0;border:0;border-radius:50%;outline-offset:-2px;background-color:transparent;text-indent:-9999px;cursor:pointer;overflow:hidden}.clr-alpha div,.clr-color,.clr-hue div,.clr-marker{box-sizing:border-box}.clr-field{display:inline-block;position:relative;color:transparent}.clr-field input{margin:0;direction:ltr}.clr-field.clr-rtl input{text-align:right}.clr-field button{position:absolute;width:30px;height:100%;right:0;top:50%;transform:translateY(-50%);margin:0;padding:0;border:0;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;pointer-events:none}.clr-field.clr-rtl button{right:auto;left:0}.clr-field button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 1px rgba(0,0,0,.5)}.clr-alpha,.clr-alpha div,.clr-field button,.clr-preview:before,.clr-swatches button{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.clr-marker:focus{outline:0}.clr-keyboard-nav .clr-alpha input:focus+div,.clr-keyboard-nav .clr-hue input:focus+div,.clr-keyboard-nav .clr-marker:focus,.clr-keyboard-nav .clr-segmented input:focus+label{outline:0;box-shadow:0 0 0 2px #1e90ff,0 0 2px 2px #fff}.clr-picker[data-alpha=false] .clr-alpha{display:none}.clr-picker[data-minimal=true]{padding-top:16px}.clr-picker[data-minimal=true] .clr-alpha,.clr-picker[data-minimal=true] .clr-color,.clr-picker[data-minimal=true] .clr-gradient,.clr-picker[data-minimal=true] .clr-hue,.clr-picker[data-minimal=true] .clr-preview{display:none}.clr-dark{background-color:#444}.clr-dark .clr-segmented{border-color:#777}.clr-dark .clr-swatches button:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.3)}.clr-dark input.clr-color{color:#fff;border-color:#777;background-color:#555}.clr-dark input.clr-color:focus{border-color:#1e90ff}.clr-dark .clr-preview:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.5)}.clr-dark .clr-alpha,.clr-dark .clr-alpha div,.clr-dark .clr-preview:before,.clr-dark .clr-swatches button{background-image:repeating-linear-gradient(45deg,#666 25%,transparent 25%,transparent 75%,#888 75%,#888),repeating-linear-gradient(45deg,#888 25%,#444 25%,#444 75%,#888 75%,#888)}.clr-picker.clr-polaroid{border-radius:6px;box-shadow:0 0 5px rgba(0,0,0,.1),0 5px 30px rgba(0,0,0,.2)}.clr-picker.clr-polaroid:before{content:'';display:block;position:absolute;width:16px;height:10px;left:20px;top:-10px;border:solid transparent;border-width:0 8px 10px 8px;border-bottom-color:currentColor;box-sizing:border-box;color:#fff;filter:drop-shadow(0 -4px 3px rgba(0,0,0,.1));pointer-events:none}.clr-picker.clr-polaroid.clr-dark:before{color:#444}.clr-picker.clr-polaroid.clr-left:before{left:auto;right:20px}.clr-picker.clr-polaroid.clr-top:before{top:auto;bottom:-10px;transform:rotateZ(180deg)}.clr-polaroid .clr-gradient{width:calc(100% - 20px);height:120px;margin:10px;border-radius:3px}.clr-polaroid .clr-alpha,.clr-polaroid .clr-hue{width:calc(100% - 30px);height:10px;margin:6px 15px;border-radius:5px}.clr-polaroid .clr-alpha div,.clr-polaroid .clr-hue div{box-shadow:0 0 5px rgba(0,0,0,.2)}.clr-polaroid .clr-format{width:calc(100% - 20px);margin:0 10px 15px}.clr-polaroid .clr-swatches{width:calc(100% - 12px);margin:0 6px}.clr-polaroid .clr-swatches div{padding-bottom:10px}.clr-polaroid .clr-swatches button{width:22px;height:22px}.clr-polaroid input.clr-color{width:calc(100% - 60px);margin:10px 10px 15px auto}.clr-polaroid .clr-clear{margin:0 10px 15px 10px}.clr-polaroid .clr-close{margin:0 10px 15px auto}.clr-polaroid .clr-preview{margin:10px 0 15px 10px}.clr-picker.clr-large{width:275px}.clr-large .clr-gradient{height:150px}.clr-large .clr-swatches button{width:22px;height:22px}.clr-picker.clr-pill{width:380px;padding-left:180px;box-sizing:border-box}.clr-pill .clr-gradient{position:absolute;width:180px;height:100%;left:0;top:0;margin-bottom:0;border-radius:3px 0 0 3px}.clr-pill .clr-hue{margin-top:20px} \ No newline at end of file diff --git a/web/style/sharedStyle.css b/web/style/sharedStyle.css new file mode 100644 index 0000000..ccd74d0 --- /dev/null +++ b/web/style/sharedStyle.css @@ -0,0 +1,74 @@ +dialog { + width: 100%; + text-align: center; + max-width: 20em; + color: white; + background-color: #000; + border: none; + position: relative; + transform: translate(-50%, -50%); +} + +#progress-container { + position: absolute; + top: 50%; + left: 50%; +} + +progress { + width: 100%; + height: 1em; + border: none; + background-color: #fff; + color: #eee; +} + +progress::-webkit-progress-bar { + background-color: #333; +} + +progress::-webkit-progress-value { + background-color: #eee; +} + +progress::-moz-progress-bar { + background-color: #eee; +} + + +#container { + position: absolute; + top: 0%; + left: 0%; + width: 100%; + height: 100%; +} + +.clr-field { + margin-left: 5px; + margin-top: 5px; +} + +.clr-field button { + width: 20px; + height: 20px; + left: 5px; + right: auto; + border-radius: 5px; +} + +.clr-field input { + padding-left: 36px; + width: 120px; + height: 24px; + border: 2px solid #aaa; + border-radius: 5px; +} + +#download-button { + margin-left: 5px; + margin-top: 10px; + position: absolute; + z-index: 10; + left: 180px; +} diff --git a/web/style/threeStyle.css b/web/style/threeStyle.css new file mode 100644 index 0000000..dab2f09 --- /dev/null +++ b/web/style/threeStyle.css @@ -0,0 +1,91 @@ +body { + margin: 0; + background-color: #000; + color: #fff; + font-family: Monospace; + font-size: 13px; + line-height: 24px; + overscroll-behavior: none; +} + +a { + color: #ff0; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +button { + cursor: pointer; + text-transform: uppercase; +} + +#info { + position: absolute; + top: 0px; + width: 100%; + padding: 10px; + box-sizing: border-box; + text-align: center; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + pointer-events: none; + z-index: 1; /* TODO Solve this in HTML */ +} + +a, button, input, select { + pointer-events: auto; +} + +.lil-gui { + z-index: 2 !important; /* TODO Solve this in HTML */ +} + +@media all and ( max-width: 640px ) { + .lil-gui.root { + right: auto; + top: auto; + max-height: 50%; + max-width: 80%; + bottom: 0; + left: 0; + } +} + +#overlay { + position: absolute; + font-size: 16px; + z-index: 2; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + background: rgba(0,0,0,0.7); +} + + #overlay button { + background: transparent; + border: 0; + border: 1px solid rgb(255, 255, 255); + border-radius: 4px; + color: #ffffff; + padding: 12px 18px; + text-transform: uppercase; + cursor: pointer; + } + +#notSupported { + width: 50%; + margin: auto; + background-color: #f00; + margin-top: 20px; + padding: 10px; +} \ No newline at end of file diff --git a/web/threeVisualizer/assets/emHdBindings-A46AWXYl.js b/web/threeVisualizer/assets/emHdBindings-A46AWXYl.js new file mode 100644 index 0000000..b723afd --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings-A46AWXYl.js @@ -0,0 +1 @@ +const e="/extensions/ComfyUI-Rodin/threeVisualizer/assets/emHdBindings-D9OMRJgz.data";export{e as default}; diff --git a/web/threeVisualizer/assets/emHdBindings-B2pBhR1n.js b/web/threeVisualizer/assets/emHdBindings-B2pBhR1n.js new file mode 100644 index 0000000..1dda336 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings-B2pBhR1n.js @@ -0,0 +1 @@ +const s="/extensions/ComfyUI-Rodin/threeVisualizer/assets/emHdBindings-CZBDkVTp.js";export{s as default}; diff --git a/web/threeVisualizer/assets/emHdBindings-BNKz2vMm.wasm b/web/threeVisualizer/assets/emHdBindings-BNKz2vMm.wasm new file mode 100644 index 0000000..03f2b21 Binary files /dev/null and b/web/threeVisualizer/assets/emHdBindings-BNKz2vMm.wasm differ diff --git a/web/threeVisualizer/assets/emHdBindings-CZBDkVTp.js b/web/threeVisualizer/assets/emHdBindings-CZBDkVTp.js new file mode 100644 index 0000000..0df0321 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings-CZBDkVTp.js @@ -0,0 +1,12022 @@ +var getUsdModule = ((args) => { + var _scriptDir = + typeof document !== "undefined" && document.currentScript + ? document.currentScript.src + : undefined; + if (typeof __filename !== "undefined") _scriptDir = _scriptDir || __filename; + return function (moduleArg = { + // module overrides can be supplied here + locateFile: (path, prefix) => { + if (!prefix && _scriptDir) prefix = _scriptDir.substr(0, _scriptDir.lastIndexOf('/') + 1); + return prefix + path; + }, + ...args +}) { + function GROWABLE_HEAP_I8() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP8; + } + function GROWABLE_HEAP_U8() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU8; + } + function GROWABLE_HEAP_I16() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP16; + } + function GROWABLE_HEAP_U16() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU16; + } + function GROWABLE_HEAP_I32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP32; + } + function GROWABLE_HEAP_U32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU32; + } + function GROWABLE_HEAP_F32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPF32; + } + function GROWABLE_HEAP_F64() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPF64; + } + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + Module["ready"] = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + if (!Module.expectedDataFileDownloads) { + Module.expectedDataFileDownloads = 0; + } + Module.expectedDataFileDownloads++; + (function () { + if (Module["ENVIRONMENT_IS_PTHREAD"] || Module["$ww"]) return; + var loadPackage = function (metadata) { + var PACKAGE_PATH = ""; + if (typeof window === "object") { + PACKAGE_PATH = window["encodeURIComponent"]( + window.location.pathname + .toString() + .substring( + 0, + window.location.pathname.toString().lastIndexOf("/"), + ) + "/", + ); + } else if ( + typeof process === "undefined" && + typeof location !== "undefined" + ) { + PACKAGE_PATH = encodeURIComponent( + location.pathname + .toString() + .substring(0, location.pathname.toString().lastIndexOf("/")) + + "/", + ); + } + var PACKAGE_NAME = "emHdBindings.data"; + var REMOTE_PACKAGE_BASE = "emHdBindings.data"; + if ( + typeof Module["locateFilePackage"] === "function" && + !Module["locateFile"] + ) { + Module["locateFile"] = Module["locateFilePackage"]; + err( + "warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)", + ); + } + var REMOTE_PACKAGE_NAME = Module["locateFile"] + ? Module["locateFile"](REMOTE_PACKAGE_BASE, "") + : REMOTE_PACKAGE_BASE; + var REMOTE_PACKAGE_SIZE = metadata["remote_package_size"]; + function fetchRemotePackage( + packageName, + packageSize, + callback, + errback, + ) { + if ( + typeof process === "object" && + typeof process.versions === "object" && + typeof process.versions.node === "string" + ) { + require("fs").readFile(packageName, function (err, contents) { + if (err) { + errback(err); + } else { + callback(contents.buffer); + } + }); + return; + } + var xhr = new XMLHttpRequest(); + xhr.open("GET", packageName, true); + xhr.responseType = "arraybuffer"; + xhr.onprogress = function (event) { + var url = packageName; + var size = packageSize; + if (event.total) size = event.total; + if (event.loaded) { + if (!xhr.addedTotal) { + xhr.addedTotal = true; + if (!Module.dataFileDownloads) Module.dataFileDownloads = {}; + Module.dataFileDownloads[url] = { + loaded: event.loaded, + total: size, + }; + } else { + Module.dataFileDownloads[url].loaded = event.loaded; + } + var total = 0; + var loaded = 0; + var num = 0; + for (var download in Module.dataFileDownloads) { + var data = Module.dataFileDownloads[download]; + total += data.total; + loaded += data.loaded; + num++; + } + total = Math.ceil( + (total * Module.expectedDataFileDownloads) / num, + ); + if (Module["setStatus"]) + Module["setStatus"](`Downloading data... (${loaded}/${total})`); + } else if (!Module.dataFileDownloads) { + if (Module["setStatus"]) + Module["setStatus"]("Downloading data..."); + } + }; + xhr.onerror = function (event) { + throw new Error("NetworkError for: " + packageName); + }; + xhr.onload = function (event) { + if ( + xhr.status == 200 || + xhr.status == 304 || + xhr.status == 206 || + (xhr.status == 0 && xhr.response) + ) { + var packageData = xhr.response; + callback(packageData); + } else { + throw new Error(xhr.statusText + " : " + xhr.responseURL); + } + }; + xhr.send(null); + } + function handleError(error) { + console.error("package error:", error); + } + var fetchedCallback = null; + var fetched = Module["getPreloadedPackage"] + ? Module["getPreloadedPackage"]( + REMOTE_PACKAGE_NAME, + REMOTE_PACKAGE_SIZE, + ) + : null; + if (!fetched) + fetchRemotePackage( + REMOTE_PACKAGE_NAME, + REMOTE_PACKAGE_SIZE, + function (data) { + if (fetchedCallback) { + fetchedCallback(data); + fetchedCallback = null; + } else { + fetched = data; + } + }, + handleError, + ); + function runWithFS() { + function assert(check, msg) { + if (!check) throw msg + new Error().stack; + } + Module["FS_createPath"]("/", "usd", true, true); + Module["FS_createPath"]("/usd", "ar", true, true); + Module["FS_createPath"]("/usd/ar", "resources", true, true); + Module["FS_createPath"]("/usd", "hd", true, true); + Module["FS_createPath"]("/usd/hd", "resources", true, true); + Module["FS_createPath"]( + "/usd/hd/resources", + "codegenTemplates", + true, + true, + ); + Module["FS_createPath"]("/usd", "httpResolver", true, true); + Module["FS_createPath"]("/usd/httpResolver", "resources", true, true); + Module["FS_createPath"]("/usd", "ndr", true, true); + Module["FS_createPath"]("/usd/ndr", "resources", true, true); + Module["FS_createPath"]("/usd", "sdf", true, true); + Module["FS_createPath"]("/usd/sdf", "resources", true, true); + Module["FS_createPath"]("/usd", "usd", true, true); + Module["FS_createPath"]("/usd/usd", "resources", true, true); + Module["FS_createPath"]( + "/usd/usd/resources", + "codegenTemplates", + true, + true, + ); + Module["FS_createPath"]("/usd/usd/resources", "usd", true, true); + Module["FS_createPath"]("/usd", "usdGeom", true, true); + Module["FS_createPath"]("/usd/usdGeom", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdGeom/resources", + "usdGeom", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdHydra", true, true); + Module["FS_createPath"]("/usd/usdHydra", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdHydra/resources", + "shaders", + true, + true, + ); + Module["FS_createPath"]( + "/usd/usdHydra/resources", + "usdHydra", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdImaging", true, true); + Module["FS_createPath"]("/usd/usdImaging", "resources", true, true); + Module["FS_createPath"]("/usd", "usdLux", true, true); + Module["FS_createPath"]("/usd/usdLux", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdLux/resources", + "usdLux", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdRender", true, true); + Module["FS_createPath"]("/usd/usdRender", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdRender/resources", + "usdRender", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdShade", true, true); + Module["FS_createPath"]("/usd/usdShade", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdShade/resources", + "usdShade", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdShaders", true, true); + Module["FS_createPath"]("/usd/usdShaders", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdShaders/resources", + "shaders", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdSkel", true, true); + Module["FS_createPath"]("/usd/usdSkel", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdSkel/resources", + "usdSkel", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdVol", true, true); + Module["FS_createPath"]("/usd/usdVol", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdVol/resources", + "usdVol", + true, + true, + ); + function DataRequest(start, end, audio) { + this.start = start; + this.end = end; + this.audio = audio; + } + DataRequest.prototype = { + requests: {}, + open: function (mode, name) { + this.name = name; + this.requests[name] = this; + Module["addRunDependency"](`fp ${this.name}`); + }, + send: function () {}, + onload: function () { + var byteArray = this.byteArray.subarray(this.start, this.end); + this.finish(byteArray); + }, + finish: function (byteArray) { + var that = this; + Module["FS_createDataFile"]( + this.name, + null, + byteArray, + true, + true, + true, + ); + Module["removeRunDependency"](`fp ${that.name}`); + this.requests[this.name] = null; + }, + }; + var files = metadata["files"]; + for (var i = 0; i < files.length; ++i) { + new DataRequest( + files[i]["start"], + files[i]["end"], + files[i]["audio"] || 0, + ).open("GET", files[i]["filename"]); + } + function processPackageData(arrayBuffer) { + assert(arrayBuffer, "Loading data file failed."); + assert( + arrayBuffer.constructor.name === ArrayBuffer.name, + "bad input to processPackageData", + ); + var byteArray = new Uint8Array(arrayBuffer); + DataRequest.prototype.byteArray = byteArray; + var files = metadata["files"]; + for (var i = 0; i < files.length; ++i) { + DataRequest.prototype.requests[files[i].filename].onload(); + } + Module["removeRunDependency"]("datafile_emHdBindings.data"); + } + Module["addRunDependency"]("datafile_emHdBindings.data"); + if (!Module.preloadResults) Module.preloadResults = {}; + Module.preloadResults[PACKAGE_NAME] = { fromCache: false }; + if (fetched) { + processPackageData(fetched); + fetched = null; + } else { + fetchedCallback = processPackageData; + } + } + if (Module["calledRun"]) { + runWithFS(); + } else { + if (!Module["preRun"]) Module["preRun"] = []; + Module["preRun"].push(runWithFS); + } + }; + loadPackage({ + files: [ + { filename: "/usd/ar/resources/plugInfo.json", start: 0, end: 589 }, + { + filename: "/usd/hd/resources/codegenTemplates/schemaClass.cpp", + start: 589, + end: 9620, + }, + { + filename: "/usd/hd/resources/codegenTemplates/schemaClass.h", + start: 9620, + end: 20258, + }, + { + filename: "/usd/hd/resources/plugInfo.json", + start: 20258, + end: 20483, + }, + { + filename: "/usd/httpResolver/resources/plugInfo.json", + start: 20483, + end: 20823, + }, + { + filename: "/usd/ndr/resources/plugInfo.json", + start: 20823, + end: 21397, + }, + { filename: "/usd/plugInfo.json", start: 21397, end: 21448 }, + { + filename: "/usd/sdf/resources/plugInfo.json", + start: 21448, + end: 22544, + }, + { + filename: "/usd/usd/resources/codegenTemplates/api.h", + start: 22544, + end: 24646, + }, + { + filename: "/usd/usd/resources/codegenTemplates/plugInfo.json", + start: 24646, + end: 25003, + }, + { + filename: "/usd/usd/resources/codegenTemplates/schemaClass.cpp", + start: 25003, + end: 37342, + }, + { + filename: "/usd/usd/resources/codegenTemplates/schemaClass.h", + start: 37342, + end: 54229, + }, + { + filename: "/usd/usd/resources/codegenTemplates/tokens.cpp", + start: 54229, + end: 55817, + }, + { + filename: "/usd/usd/resources/codegenTemplates/tokens.h", + start: 55817, + end: 59072, + }, + { + filename: "/usd/usd/resources/codegenTemplates/wrapSchemaClass.cpp", + start: 59072, + end: 68578, + }, + { + filename: "/usd/usd/resources/codegenTemplates/wrapTokens.cpp", + start: 68578, + end: 71099, + }, + { + filename: "/usd/usd/resources/generatedSchema.usda", + start: 71099, + end: 86803, + }, + { + filename: "/usd/usd/resources/plugInfo.json", + start: 86803, + end: 92530, + }, + { + filename: "/usd/usd/resources/usd/schema.usda", + start: 92530, + end: 110774, + }, + { + filename: "/usd/usdGeom/resources/generatedSchema.usda", + start: 110774, + end: 355640, + }, + { + filename: "/usd/usdGeom/resources/plugInfo.json", + start: 355640, + end: 371761, + }, + { + filename: "/usd/usdGeom/resources/usdGeom/schema.usda", + start: 371761, + end: 500520, + }, + { + filename: "/usd/usdHydra/resources/generatedSchema.usda", + start: 500520, + end: 501538, + }, + { + filename: "/usd/usdHydra/resources/plugInfo.json", + start: 501538, + end: 502826, + }, + { + filename: "/usd/usdHydra/resources/shaders/empty.glslfx", + start: 502826, + end: 504049, + }, + { + filename: "/usd/usdHydra/resources/shaders/shaderDefs.usda", + start: 504049, + end: 510806, + }, + { + filename: "/usd/usdHydra/resources/usdHydra/schema.usda", + start: 510806, + end: 518107, + }, + { + filename: "/usd/usdImaging/resources/plugInfo.json", + start: 518107, + end: 531776, + }, + { + filename: "/usd/usdLux/resources/generatedSchema.usda", + start: 531776, + end: 610666, + }, + { + filename: "/usd/usdLux/resources/plugInfo.json", + start: 610666, + end: 620463, + }, + { + filename: "/usd/usdLux/resources/usdLux/schema.usda", + start: 620463, + end: 662394, + }, + { + filename: "/usd/usdRender/resources/generatedSchema.usda", + start: 662394, + end: 685685, + }, + { + filename: "/usd/usdRender/resources/plugInfo.json", + start: 685685, + end: 688784, + }, + { + filename: "/usd/usdRender/resources/usdRender/schema.usda", + start: 688784, + end: 705492, + }, + { + filename: "/usd/usdShade/resources/generatedSchema.usda", + start: 705492, + end: 721492, + }, + { + filename: "/usd/usdShade/resources/plugInfo.json", + start: 721492, + end: 727378, + }, + { + filename: "/usd/usdShade/resources/usdShade/schema.usda", + start: 727378, + end: 754223, + }, + { + filename: "/usd/usdShaders/resources/plugInfo.json", + start: 754223, + end: 754902, + }, + { + filename: "/usd/usdShaders/resources/shaders/previewSurface.glslfx", + start: 754902, + end: 768823, + }, + { + filename: "/usd/usdShaders/resources/shaders/primvarReader.glslfx", + start: 768823, + end: 770046, + }, + { + filename: "/usd/usdShaders/resources/shaders/shaderDefs.usda", + start: 770046, + end: 784976, + }, + { + filename: "/usd/usdShaders/resources/shaders/transform2d.glslfx", + start: 784976, + end: 786199, + }, + { + filename: "/usd/usdShaders/resources/shaders/uvTexture.glslfx", + start: 786199, + end: 787422, + }, + { + filename: "/usd/usdSkel/resources/generatedSchema.usda", + start: 787422, + end: 802913, + }, + { + filename: "/usd/usdSkel/resources/plugInfo.json", + start: 802913, + end: 805907, + }, + { + filename: "/usd/usdSkel/resources/usdSkel/schema.usda", + start: 805907, + end: 816312, + }, + { + filename: "/usd/usdVol/resources/generatedSchema.usda", + start: 816312, + end: 840757, + }, + { + filename: "/usd/usdVol/resources/plugInfo.json", + start: 840757, + end: 843193, + }, + { + filename: "/usd/usdVol/resources/usdVol/schema.usda", + start: 843193, + end: 849069, + }, + ], + remote_package_size: 849069, + }); + })(); + if (!Module["ENVIRONMENT_IS_PTHREAD"]) { + function isMobileDevice() { + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( + navigator.userAgent, + ); + } + const MAX_MEMORY_MOBILE = 1024 * 1024 * 1024; + const MAX_MEMORY_DESKTOP = 4 * 1024 * 1024 * 1024; + const MAX_DEVICE_MEMORY = isMobileDevice() + ? MAX_MEMORY_MOBILE + : MAX_MEMORY_DESKTOP; + Module["wasmMemory"] = new WebAssembly.Memory({ + initial: 16777216 / 65536, + maximum: MAX_DEVICE_MEMORY / 65536, + shared: true, + }); + } + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var ENVIRONMENT_IS_WEB = typeof window == "object"; + var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + var ENVIRONMENT_IS_NODE = + typeof process == "object" && + typeof process.versions == "object" && + typeof process.versions.node == "string"; + var ENVIRONMENT_IS_PTHREAD = Module["ENVIRONMENT_IS_PTHREAD"] || false; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var read_, readAsync, readBinary; + if (ENVIRONMENT_IS_NODE) { + var fs = require("fs"); + var nodePath = require("path"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = nodePath.dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + read_ = (filename, binary) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename) => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + return ret; + }; + readAsync = (filename, onload, onerror, binary = true) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + fs.readFile(filename, binary ? undefined : "utf8", (err, data) => { + if (err) onerror(err); + else onload(binary ? data.buffer : data); + }); + }; + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; + Module["inspect"] = () => "[Emscripten Module object]"; + let nodeWorkerThreads; + try { + nodeWorkerThreads = require("worker_threads"); + } catch (e) { + console.error( + 'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?', + ); + throw e; + } + global.Worker = nodeWorkerThreads.Worker; + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } else { + scriptDirectory = ""; + } + if (!ENVIRONMENT_IS_NODE) { + read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }; + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + }; + } + } else { + } + if (ENVIRONMENT_IS_NODE) { + if (typeof performance == "undefined") { + global.performance = require("perf_hooks").performance; + } + } + var defaultPrint = console.log.bind(console); + var defaultPrintErr = console.error.bind(console); + if (ENVIRONMENT_IS_NODE) { + defaultPrint = (...args) => fs.writeSync(1, args.join(" ") + "\n"); + defaultPrintErr = (...args) => fs.writeSync(2, args.join(" ") + "\n"); + } + var out = Module["print"] || defaultPrint; + var err = Module["printErr"] || defaultPrintErr; + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + if (Module["arguments"]) arguments_ = Module["arguments"]; + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + if (Module["quit"]) quit_ = Module["quit"]; + var wasmBinary; + if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); + } + var wasmMemory; + var wasmModule; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + } + var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + assert( + INITIAL_MEMORY >= 5242880, + "INITIAL_MEMORY should be larger than STACK_SIZE, was " + + INITIAL_MEMORY + + "! (STACK_SIZE=" + + 5242880 + + ")", + ); + if (ENVIRONMENT_IS_PTHREAD) { + wasmMemory = Module["wasmMemory"]; + } else { + if (Module["wasmMemory"]) { + wasmMemory = Module["wasmMemory"]; + } else { + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + maximum: 4294967296 / 65536, + shared: true, + }); + if (!(wasmMemory.buffer instanceof SharedArrayBuffer)) { + err( + "requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag", + ); + if (ENVIRONMENT_IS_NODE) { + err( + "(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)", + ); + } + throw Error("bad memory"); + } + } + } + updateMemoryViews(); + INITIAL_MEMORY = wasmMemory.buffer.byteLength; + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATPOSTRUN__ = []; + var runtimeInitialized = false; + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); + } + function initRuntime() { + runtimeInitialized = true; + if (ENVIRONMENT_IS_PTHREAD) return; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + function postRun() { + if (ENVIRONMENT_IS_PTHREAD) return; + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); + } + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + function getUniqueRunDependency(id) { + return id; + } + function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + } + function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + what = "Aborted(" + what + ")"; + err(what); + // ABORT = true; // this does not allow anything to work after being set, however we're actually okay to try other assets so we shouldn't do this + EXITSTATUS = 1; + what += ". Build with -sASSERTIONS for more info."; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + var dataURIPrefix = "data:application/octet-stream;base64,"; + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + var isFileURI = (filename) => filename.startsWith("file://"); + var wasmBinaryFile; + wasmBinaryFile = "emHdBindings.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + function getBinaryPromise(binaryFile) { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(binaryFile)) { + return fetch(binaryFile, { credentials: "same-origin" }) + .then((response) => { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + binaryFile + "'"; + } + return response["arrayBuffer"](); + }) + .catch(() => getBinarySync(binaryFile)); + } else if (readAsync) { + return new Promise((resolve, reject) => { + readAsync( + binaryFile, + (response) => resolve(new Uint8Array(response)), + reject, + ); + }); + } + } + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => WebAssembly.instantiate(binary, imports)) + .then((instance) => instance) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + abort(reason); + }); + } + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == "function" && + !isDataURI(binaryFile) && + !isFileURI(binaryFile) && + !ENVIRONMENT_IS_NODE && + typeof fetch == "function" + ) { + return fetch(binaryFile, { credentials: "same-origin" }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + function createWasm() { + var info = { a: wasmImports }; + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + registerTLSInit(wasmExports["Hd"]); + wasmTable = wasmExports["Dd"]; + addOnInit(wasmExports["Bd"]); + wasmModule = module; + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + function receiveInstantiationResult(result) { + receiveInstance(result["instance"], result["module"]); + } + if (Module["instantiateWasm"]) { + try { + return Module["instantiateWasm"](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + readyPromiseReject(e); + } + } + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + var tempDouble; + var tempI64; + function __asyncjs__fetch_asset(route, dataPtr) { + return Asyncify.handleAsync(async () => { + const routeString = UTF8ToString(route); + const absoluteUrl = new URL(routeString); + try { + const response = await fetch(absoluteUrl); + if (!response.ok) + throw new Error("Fetch failed: " + response.statusText); + const buffer = await response.arrayBuffer(); + const length = buffer.byteLength; + const ptr = _malloc(length); + GROWABLE_HEAP_U8().set(new Uint8Array(buffer), ptr >>> 0); + Module.HEAP32[dataPtr >> 2] = ptr; + Module.HEAP32[(dataPtr >> 2) + 1] = length; + } catch (err) { + console.error("Error in fetch_asset: ", err); + Module.HEAP32[dataPtr >> 2] = 0; + Module.HEAP32[(dataPtr >> 2) + 1] = 0; + } + }); + } + function addToLoadedFiles(path) { + if (typeof self !== "undefined") { + if (typeof self.loadedFiles === "undefined") { + self.loadedFiles = []; + } + } else { + console.log("Neither window nor self is defined"); + } + self.loadedFiles.push(UTF8ToString(path)); + } + function downloadJS(data, filenamedata) { + const text = UTF8ToString(data); + const filename = UTF8ToString(filenamedata); + let element = document.createElement("a"); + element.setAttribute( + "href", + "data:text/plain;charset=utf-8," + encodeURIComponent(text), + ); + element.setAttribute("download", filename); + element.style.display = "none"; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + } + function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + var terminateWorker = (worker) => { + worker.terminate(); + worker.onmessage = (e) => {}; + }; + var killThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + delete PThread.pthreads[pthread_ptr]; + terminateWorker(worker); + __emscripten_thread_free_data(pthread_ptr); + PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker), 1); + worker.pthread_ptr = 0; + }; + var cancelThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + worker.postMessage({ cmd: "cancel" }); + }; + var cleanupThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + assert(worker); + PThread.returnWorkerToPool(worker); + }; + var zeroMemory = (address, size) => { + GROWABLE_HEAP_U8().fill(0, address, address + size); + return address; + }; + var spawnThread = (threadParams) => { + var worker = PThread.getNewWorker(); + if (!worker) { + return 6; + } + PThread.runningWorkers.push(worker); + PThread.pthreads[threadParams.pthread_ptr] = worker; + worker.pthread_ptr = threadParams.pthread_ptr; + var msg = { + cmd: "run", + start_routine: threadParams.startRoutine, + arg: threadParams.arg, + pthread_ptr: threadParams.pthread_ptr, + }; + if (ENVIRONMENT_IS_NODE) { + worker.unref(); + } + worker.postMessage(msg, threadParams.transferList); + return 0; + }; + var runtimeKeepaliveCounter = 0; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: function () { + var paths = Array.prototype.slice.call(arguments); + return PATH.normalize(paths.join("/")); + }, + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => { + if ( + typeof crypto == "object" && + typeof crypto["getRandomValues"] == "function" + ) { + return (view) => ( + view.set(crypto.getRandomValues(new Uint8Array(view.byteLength))), + view + ); + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + var randomFillSync = crypto_module["randomFillSync"]; + if (randomFillSync) { + return (view) => crypto_module["randomFillSync"](view); + } + var randomBytes = crypto_module["randomBytes"]; + return (view) => (view.set(randomBytes(view.byteLength)), view); + } catch (e) {} + } + abort("initRandomDevice"); + }; + var randomFill = (view) => (randomFill = initRandomFill())(view); + var PATH_FS = { + resolve: function () { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { + idx >>>= 0; + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.slice(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + outIdx >>>= 0; + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++ >>> 0] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++ >>> 0] = 192 | (u >> 6); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++ >>> 0] = 224 | (u >> 12); + heap[outIdx++ >>> 0] = 128 | ((u >> 6) & 63); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++ >>> 0] = 240 | (u >> 18); + heap[outIdx++ >>> 0] = 128 | ((u >> 12) & 63); + heap[outIdx++ >>> 0] = 128 | ((u >> 6) & 63); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } + } + heap[outIdx >>> 0] = 0; + return outIdx - startIdx; + }; + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; + else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + var alignMemory = (size, alignment) => + Math.ceil(size / alignment) * alignment; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + return zeroMemory(ptr, size); + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = [".", ".."]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === GROWABLE_HEAP_I8().buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === GROWABLE_HEAP_I8().buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + GROWABLE_HEAP_I8().set(contents, ptr >>> 0); + } + return { ptr: ptr, allocated: allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ""; + readAsync( + url, + (arrayBuffer) => { + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (event) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + if (onload) onload(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, (byteArray) => processData(byteArray), onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + if (!path) return { path: "", node: null }; + var defaults = { follow_mount: true, recurse_count: 0 }; + opts = Object.assign(defaults, opts); + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + if (!FS.FSStream) { + FS.FSStream = function () { + this.shared = {}; + }; + FS.FSStream.prototype = {}; + Object.defineProperties(FS.FSStream.prototype, { + object: { + get() { + return this.node; + }, + set(val) { + this.node = val; + }, + }, + isRead: { + get() { + return (this.flags & 2097155) !== 1; + }, + }, + isWrite: { + get() { + return (this.flags & 2097155) !== 0; + }, + }, + isAppend: { + get() { + return this.flags & 1024; + }, + }, + flags: { + get() { + return this.shared.flags; + }, + set(val) { + this.shared.flags = val; + }, + }, + position: { + get() { + return this.shared.position; + }, + set(val) { + this.shared.position = val; + }, + }, + }); + } + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [], + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { timestamp: Date.now() }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { size: len, timestamp: Date.now() }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); + }, + open(path, flags, mode) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { follow: !(flags & 131072) }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + munmap: (stream) => 0, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams() { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + }, + ensureErrnoError() { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.name = "ErrnoError"; + this.node = node; + this.setErrno = function (errno) { + this.errno = errno; + }; + this.setErrno(errno); + this.message = "FS error"; + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit() { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS: MEMFS }; + }, + init(input, output, error) { + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit() { + FS.init.initialized = false; + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = + function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = + function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + }, + }, + chunkSize: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + }, + }, + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, GROWABLE_HEAP_I8(), ptr, length, position); + return { ptr: ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + ptr >>>= 0; + return ptr + ? UTF8ArrayToString(GROWABLE_HEAP_U8(), ptr, maxBytesToRead) + : ""; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if ( + e && + e.node && + PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node)) + ) { + return -54; + } + throw e; + } + GROWABLE_HEAP_I32()[(buf >>> 2) >>> 0] = stat.dev; + GROWABLE_HEAP_I32()[((buf + 4) >>> 2) >>> 0] = stat.mode; + GROWABLE_HEAP_U32()[((buf + 8) >>> 2) >>> 0] = stat.nlink; + GROWABLE_HEAP_I32()[((buf + 12) >>> 2) >>> 0] = stat.uid; + GROWABLE_HEAP_I32()[((buf + 16) >>> 2) >>> 0] = stat.gid; + GROWABLE_HEAP_I32()[((buf + 20) >>> 2) >>> 0] = stat.rdev; + (tempI64 = [ + stat.size >>> 0, + ((tempDouble = stat.size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 24) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 28) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_I32()[((buf + 32) >>> 2) >>> 0] = 4096; + GROWABLE_HEAP_I32()[((buf + 36) >>> 2) >>> 0] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + (tempI64 = [ + Math.floor(atime / 1e3) >>> 0, + ((tempDouble = Math.floor(atime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 40) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 44) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 48) >>> 2) >>> 0] = (atime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(mtime / 1e3) >>> 0, + ((tempDouble = Math.floor(mtime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 56) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 60) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 64) >>> 2) >>> 0] = (mtime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(ctime / 1e3) >>> 0, + ((tempDouble = Math.floor(ctime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 72) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 76) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 80) >>> 2) >>> 0] = (ctime % 1e3) * 1e3; + (tempI64 = [ + stat.ino >>> 0, + ((tempDouble = stat.ino), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 88) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 92) >>> 2) >>> 0] = tempI64[1]); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = GROWABLE_HEAP_U8().slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + varargs: undefined, + get() { + var ret = GROWABLE_HEAP_I32()[(+SYSCALLS.varargs >>> 2) >>> 0]; + SYSCALLS.varargs += 4; + return ret; + }, + getp() { + return SYSCALLS.get(); + }, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + }; + function _proc_exit(code) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(0, 1, code); + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + PThread.terminateAllThreads(); + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + } + var exitJS = (status, implicit) => { + EXITSTATUS = status; + if (ENVIRONMENT_IS_PTHREAD) { + exitOnMainThread(status); + throw "unwind"; + } + _proc_exit(status); + }; + var _exit = exitJS; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); + }; + var PThread = { + unusedWorkers: [], + runningWorkers: [], + tlsInitFunctions: [], + pthreads: {}, + init() { + if (ENVIRONMENT_IS_PTHREAD) { + PThread.initWorker(); + } else { + PThread.initMainThread(); + } + }, + initMainThread() { + var pthreadPoolSize = 10; + while (pthreadPoolSize--) { + PThread.allocateUnusedWorker(); + } + addOnPreRun(() => { + addRunDependency("loading-workers"); + PThread.loadWasmModuleToAllWorkers(() => + removeRunDependency("loading-workers"), + ); + }); + }, + initWorker() { + noExitRuntime = false; + }, + setExitStatus: (status) => { + EXITSTATUS = status; + }, + terminateAllThreads__deps: ["$terminateWorker"], + terminateAllThreads: () => { + for (var worker of PThread.runningWorkers) { + terminateWorker(worker); + } + for (var worker of PThread.unusedWorkers) { + terminateWorker(worker); + } + PThread.unusedWorkers = []; + PThread.runningWorkers = []; + PThread.pthreads = []; + }, + returnWorkerToPool: (worker) => { + var pthread_ptr = worker.pthread_ptr; + delete PThread.pthreads[pthread_ptr]; + PThread.unusedWorkers.push(worker); + PThread.runningWorkers.splice( + PThread.runningWorkers.indexOf(worker), + 1, + ); + worker.pthread_ptr = 0; + __emscripten_thread_free_data(pthread_ptr); + }, + receiveObjectTransfer(data) {}, + threadInitTLS() { + PThread.tlsInitFunctions.forEach((f) => f()); + }, + loadWasmModuleToWorker: (worker) => + new Promise((onFinishedLoading) => { + worker.onmessage = (e) => { + var d = e["data"]; + var cmd = d["cmd"]; + if (d["targetThread"] && d["targetThread"] != _pthread_self()) { + var targetWorker = PThread.pthreads[d["targetThread"]]; + if (targetWorker) { + targetWorker.postMessage(d, d["transferList"]); + } else { + err( + `Internal error! Worker sent a message "${cmd}" to target pthread ${d["targetThread"]}, but that thread no longer exists!`, + ); + } + return; + } + if (cmd === "checkMailbox") { + checkMailbox(); + } else if (cmd === "spawnThread") { + spawnThread(d); + } else if (cmd === "cleanupThread") { + cleanupThread(d["thread"]); + } else if (cmd === "killThread") { + killThread(d["thread"]); + } else if (cmd === "cancelThread") { + cancelThread(d["thread"]); + } else if (cmd === "loaded") { + worker.loaded = true; + if (ENVIRONMENT_IS_NODE && !worker.pthread_ptr) { + worker.unref(); + } + onFinishedLoading(worker); + } else if (cmd === "alert") { + alert(`Thread ${d["threadId"]}: ${d["text"]}`); + } else if (d.target === "setimmediate") { + worker.postMessage(d); + } else if (cmd === "callHandler") { + Module[d["handler"]](...d["args"]); + } else if (cmd) { + err(`worker sent an unknown command ${cmd}`); + } + }; + worker.onerror = (e) => { + var message = "worker sent an error!"; + err(`${message} ${e.filename}:${e.lineno}: ${e.message}`); + throw e; + }; + if (ENVIRONMENT_IS_NODE) { + worker.on("message", (data) => worker.onmessage({ data: data })); + worker.on("error", (e) => worker.onerror(e)); + } + var handlers = []; + var knownHandlers = ["onExit", "onAbort", "print", "printErr"]; + for (var handler of knownHandlers) { + if (Module.hasOwnProperty(handler)) { + handlers.push(handler); + } + } + worker.postMessage({ + cmd: "load", + handlers: handlers, + urlOrBlob: Module["mainScriptUrlOrBlob"] || _scriptDir, + wasmMemory: wasmMemory, + wasmModule: wasmModule, + }); + }), + loadWasmModuleToAllWorkers(onMaybeReady) { + if (ENVIRONMENT_IS_PTHREAD) { + return onMaybeReady(); + } + let pthreadPoolReady = Promise.all( + PThread.unusedWorkers.map(PThread.loadWasmModuleToWorker), + ); + pthreadPoolReady.then(onMaybeReady); + }, + allocateUnusedWorker() { + var worker; + var pthreadMainJs = locateFile("emHdBindings.worker.js"); + worker = new Worker(pthreadMainJs); + PThread.unusedWorkers.push(worker); + }, + getNewWorker() { + if (PThread.unusedWorkers.length == 0) { + PThread.allocateUnusedWorker(); + PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]); + } + return PThread.unusedWorkers.pop(); + }, + }; + Module["PThread"] = PThread; + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var establishStackSpace = () => { + var pthread_ptr = _pthread_self(); + var stackHigh = GROWABLE_HEAP_U32()[((pthread_ptr + 52) >>> 2) >>> 0]; + var stackSize = GROWABLE_HEAP_U32()[((pthread_ptr + 56) >>> 2) >>> 0]; + var stackLow = stackHigh - stackSize; + _emscripten_stack_set_limits(stackHigh, stackLow); + stackRestore(stackHigh); + }; + Module["establishStackSpace"] = establishStackSpace; + function exitOnMainThread(returnCode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(1, 0, returnCode); + _exit(returnCode); + } + var invokeEntryPoint = (ptr, arg) => { + var result = ((a1) => dynCall_ii.apply(null, [ptr, a1]))(arg); + function finish(result) { + if (keepRuntimeAlive()) { + PThread.setExitStatus(result); + } else { + __emscripten_thread_exit(result); + } + } + finish(result); + }; + Module["invokeEntryPoint"] = invokeEntryPoint; + var noExitRuntime = Module["noExitRuntime"] || true; + var registerTLSInit = (tlsInitFunc) => { + PThread.tlsInitFunctions.push(tlsInitFunc); + }; + var convertI32PairToI53Checked = (lo, hi) => + (hi + 2097152) >>> 0 < 4194305 - !!lo + ? (lo >>> 0) + hi * 4294967296 + : NaN; + var ___call_sighandler = function (fp, sig) { + fp >>>= 0; + return ((a1) => dynCall_vi.apply(null, [fp, a1]))(sig); + }; + var exceptionCaught = []; + var uncaughtExceptionCount = 0; + function ___cxa_begin_catch(ptr) { + ptr >>>= 0; + var info = new ExceptionInfo(ptr); + if (!info.get_caught()) { + info.set_caught(true); + uncaughtExceptionCount--; + } + info.set_rethrown(false); + exceptionCaught.push(info); + ___cxa_increment_exception_refcount(info.excPtr); + return info.get_exception_ptr(); + } + var exceptionLast = 0; + var ___cxa_end_catch = () => { + _setThrew(0, 0); + var info = exceptionCaught.pop(); + ___cxa_decrement_exception_refcount(info.excPtr); + exceptionLast = 0; + }; + function ExceptionInfo(excPtr) { + this.excPtr = excPtr; + this.ptr = excPtr - 24; + this.set_type = function (type) { + GROWABLE_HEAP_U32()[((this.ptr + 4) >>> 2) >>> 0] = type; + }; + this.get_type = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 4) >>> 2) >>> 0]; + }; + this.set_destructor = function (destructor) { + GROWABLE_HEAP_U32()[((this.ptr + 8) >>> 2) >>> 0] = destructor; + }; + this.get_destructor = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 8) >>> 2) >>> 0]; + }; + this.set_caught = function (caught) { + caught = caught ? 1 : 0; + GROWABLE_HEAP_I8()[((this.ptr + 12) >>> 0) >>> 0] = caught; + }; + this.get_caught = function () { + return GROWABLE_HEAP_I8()[((this.ptr + 12) >>> 0) >>> 0] != 0; + }; + this.set_rethrown = function (rethrown) { + rethrown = rethrown ? 1 : 0; + GROWABLE_HEAP_I8()[((this.ptr + 13) >>> 0) >>> 0] = rethrown; + }; + this.get_rethrown = function () { + return GROWABLE_HEAP_I8()[((this.ptr + 13) >>> 0) >>> 0] != 0; + }; + this.init = function (type, destructor) { + this.set_adjusted_ptr(0); + this.set_type(type); + this.set_destructor(destructor); + }; + this.set_adjusted_ptr = function (adjustedPtr) { + GROWABLE_HEAP_U32()[((this.ptr + 16) >>> 2) >>> 0] = adjustedPtr; + }; + this.get_adjusted_ptr = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 16) >>> 2) >>> 0]; + }; + this.get_exception_ptr = function () { + var isPointer = ___cxa_is_pointer_type(this.get_type()); + if (isPointer) { + return GROWABLE_HEAP_U32()[(this.excPtr >>> 2) >>> 0]; + } + var adjusted = this.get_adjusted_ptr(); + if (adjusted !== 0) return adjusted; + return this.excPtr; + }; + } + function ___resumeException(ptr) { + ptr >>>= 0; + if (!exceptionLast) { + exceptionLast = ptr; + } + throw exceptionLast; + } + var findMatchingCatch = (args) => { + var thrown = exceptionLast; + if (!thrown) { + setTempRet0(0); + return 0; + } + var info = new ExceptionInfo(thrown); + info.set_adjusted_ptr(thrown); + var thrownType = info.get_type(); + if (!thrownType) { + setTempRet0(0); + return thrown; + } + for (var arg in args) { + var caughtType = args[arg]; + if (caughtType === 0 || caughtType === thrownType) { + break; + } + var adjusted_ptr_addr = info.ptr + 16; + if (___cxa_can_catch(caughtType, thrownType, adjusted_ptr_addr)) { + setTempRet0(caughtType); + return thrown; + } + } + setTempRet0(thrownType); + return thrown; + }; + function ___cxa_find_matching_catch_2() { + return findMatchingCatch([]); + } + function ___cxa_find_matching_catch_3(arg0) { + arg0 >>>= 0; + return findMatchingCatch([arg0]); + } + function ___cxa_find_matching_catch_4(arg0, arg1) { + arg0 >>>= 0; + arg1 >>>= 0; + return findMatchingCatch([arg0, arg1]); + } + function ___cxa_get_exception_ptr(ptr) { + ptr >>>= 0; + var rtn = new ExceptionInfo(ptr).get_exception_ptr(); + return rtn; + } + var ___cxa_rethrow = () => { + var info = exceptionCaught.pop(); + if (!info) { + abort("no exception to throw"); + } + var ptr = info.excPtr; + if (!info.get_rethrown()) { + exceptionCaught.push(info); + info.set_rethrown(true); + info.set_caught(false); + uncaughtExceptionCount++; + } + exceptionLast = ptr; + throw exceptionLast; + }; + function ___cxa_rethrow_primary_exception(ptr) { + ptr >>>= 0; + if (!ptr) return; + var info = new ExceptionInfo(ptr); + exceptionCaught.push(info); + info.set_rethrown(true); + ___cxa_rethrow(); + } + function ___cxa_throw(ptr, type, destructor) { + ptr >>>= 0; + type >>>= 0; + destructor >>>= 0; + var info = new ExceptionInfo(ptr); + info.init(type, destructor); + exceptionLast = ptr; + uncaughtExceptionCount++; + throw exceptionLast; + } + var ___cxa_uncaught_exceptions = () => uncaughtExceptionCount; + function ___emscripten_init_main_thread_js(tb) { + tb >>>= 0; + __emscripten_thread_init( + tb, + !ENVIRONMENT_IS_WORKER, + 1, + !ENVIRONMENT_IS_WEB, + 2097152, + false, + ); + PThread.threadInitTLS(); + } + function ___emscripten_thread_cleanup(thread) { + thread >>>= 0; + if (!ENVIRONMENT_IS_PTHREAD) cleanupThread(thread); + else postMessage({ cmd: "cleanupThread", thread: thread }); + } + function pthreadCreateProxied(pthread_ptr, attr, startRoutine, arg) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(2, 1, pthread_ptr, attr, startRoutine, arg); + return ___pthread_create_js(pthread_ptr, attr, startRoutine, arg); + } + function ___pthread_create_js(pthread_ptr, attr, startRoutine, arg) { + pthread_ptr >>>= 0; + attr >>>= 0; + startRoutine >>>= 0; + arg >>>= 0; + if (typeof SharedArrayBuffer == "undefined") { + err( + "Current environment does not support SharedArrayBuffer, pthreads are not available!", + ); + return 6; + } + var transferList = []; + var error = 0; + if (ENVIRONMENT_IS_PTHREAD && (transferList.length === 0 || error)) { + return pthreadCreateProxied(pthread_ptr, attr, startRoutine, arg); + } + if (error) return error; + var threadParams = { + startRoutine: startRoutine, + pthread_ptr: pthread_ptr, + arg: arg, + transferList: transferList, + }; + if (ENVIRONMENT_IS_PTHREAD) { + threadParams.cmd = "spawnThread"; + postMessage(threadParams, transferList); + return 0; + } + return spawnThread(threadParams); + } + function ___syscall_chmod(path, mode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(3, 1, path, mode); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_faccessat(dirfd, path, amode, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(4, 1, dirfd, path, amode, flags); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fadvise64(fd, offset, len, advice) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(5, 0, fd, offset, len, advice); + return 0; + } + function ___syscall_fchmod(fd, mode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(6, 1, fd, mode); + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var setErrNo = (value) => { + GROWABLE_HEAP_I32()[(___errno_location() >>> 2) >>> 0] = value; + return value; + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(7, 1, fd, cmd, varargs); + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.createStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = SYSCALLS.getp(); + var offset = 0; + GROWABLE_HEAP_I16()[((arg + offset) >>> 1) >>> 0] = 2; + return 0; + } + case 6: + case 7: + return 0; + case 16: + case 8: + return -28; + case 9: + setErrNo(28); + return -1; + default: { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(8, 1, fd, buf); + buf >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => + stringToUTF8Array(str, GROWABLE_HEAP_U8(), outPtr, maxBytesToWrite); + function ___syscall_getcwd(buf, size) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(9, 1, buf, size); + buf >>>= 0; + size >>>= 0; + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_getdents64(fd, dirp, count) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(10, 1, fd, dirp, count); + dirp >>>= 0; + count >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (!stream.getdents) { + stream.getdents = FS.readdir(stream.path); + } + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var idx = Math.floor(off / struct_size); + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { parent: true }); + id = lookup.node.id; + type = 4; + } else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) + ? 2 + : FS.isDir(child.mode) + ? 4 + : FS.isLink(child.mode) + ? 10 + : 8; + } + (tempI64 = [ + id >>> 0, + ((tempDouble = id), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((dirp + pos) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((dirp + pos + 4) >>> 2) >>> 0] = tempI64[1]); + (tempI64 = [ + ((idx + 1) * struct_size) >>> 0, + ((tempDouble = (idx + 1) * struct_size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((dirp + pos + 8) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((dirp + pos + 12) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_I16()[((dirp + pos + 16) >>> 1) >>> 0] = 280; + GROWABLE_HEAP_I8()[((dirp + pos + 18) >>> 0) >>> 0] = type; + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(11, 1, fd, op, varargs); + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0] = termios.c_iflag || 0; + GROWABLE_HEAP_I32()[((argp + 4) >>> 2) >>> 0] = + termios.c_oflag || 0; + GROWABLE_HEAP_I32()[((argp + 8) >>> 2) >>> 0] = + termios.c_cflag || 0; + GROWABLE_HEAP_I32()[((argp + 12) >>> 2) >>> 0] = + termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + GROWABLE_HEAP_I8()[((argp + i + 17) >>> 0) >>> 0] = + termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = SYSCALLS.getp(); + var c_iflag = GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0]; + var c_oflag = GROWABLE_HEAP_I32()[((argp + 4) >>> 2) >>> 0]; + var c_cflag = GROWABLE_HEAP_I32()[((argp + 8) >>> 2) >>> 0]; + var c_lflag = GROWABLE_HEAP_I32()[((argp + 12) >>> 2) >>> 0]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(GROWABLE_HEAP_I8()[((argp + i + 17) >>> 0) >>> 0]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag: c_iflag, + c_oflag: c_oflag, + c_cflag: c_cflag, + c_lflag: c_lflag, + c_cc: c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = SYSCALLS.getp(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I16()[(argp >>> 1) >>> 0] = winsize[0]; + GROWABLE_HEAP_I16()[((argp + 2) >>> 1) >>> 0] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_lstat64(path, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(12, 1, path, buf); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_mkdirat(dirfd, path, mode) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(13, 1, dirfd, path, mode); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + path = PATH.normalize(path); + if (path[path.length - 1] === "/") + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_newfstatat(dirfd, path, buf, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(14, 1, dirfd, path, buf, flags); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(15, 1, dirfd, path, flags, varargs); + path >>>= 0; + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? SYSCALLS.get() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(16, 1, dirfd, path, buf, bufsize); + path >>>= 0; + buf >>>= 0; + bufsize >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = GROWABLE_HEAP_I8()[(buf + len) >>> 0]; + stringToUTF8(ret, buf, bufsize + 1); + GROWABLE_HEAP_I8()[(buf + len) >>> 0] = endChar; + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(17, 1, olddirfd, oldpath, newdirfd, newpath); + oldpath >>>= 0; + newpath >>>= 0; + try { + oldpath = SYSCALLS.getStr(oldpath); + newpath = SYSCALLS.getStr(newpath); + oldpath = SYSCALLS.calculateAt(olddirfd, oldpath); + newpath = SYSCALLS.calculateAt(newdirfd, newpath); + FS.rename(oldpath, newpath); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_stat64(path, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(18, 1, path, buf); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_unlinkat(dirfd, path, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(19, 1, dirfd, path, flags); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __embind_register_bigint( + primitiveType, + name, + size, + minRange, + maxRange, + ) { + primitiveType >>>= 0; + name >>>= 0; + size >>>= 0; + } + var embind_init_charCodes = () => { + var codes = new Array(256); + for (var i = 0; i < 256; ++i) { + codes[i] = String.fromCharCode(i); + } + embind_charCodes = codes; + }; + var embind_charCodes; + var readLatin1String = (ptr) => { + var ret = ""; + var c = ptr; + while (GROWABLE_HEAP_U8()[c >>> 0]) { + ret += embind_charCodes[GROWABLE_HEAP_U8()[c++ >>> 0]]; + } + return ret; + }; + var awaitingDependencies = {}; + var registeredTypes = {}; + var typeDependencies = {}; + var BindingError; + var throwBindingError = (message) => { + throw new BindingError(message); + }; + var InternalError; + var throwInternalError = (message) => { + throw new InternalError(message); + }; + var whenDependentTypesAreResolved = ( + myTypes, + dependentTypes, + getTypeConverters, + ) => { + myTypes.forEach(function (type) { + typeDependencies[type] = dependentTypes; + }); + function onComplete(typeConverters) { + var myTypeConverters = getTypeConverters(typeConverters); + if (myTypeConverters.length !== myTypes.length) { + throwInternalError("Mismatched type converter count"); + } + for (var i = 0; i < myTypes.length; ++i) { + registerType(myTypes[i], myTypeConverters[i]); + } + } + var typeConverters = new Array(dependentTypes.length); + var unregisteredTypes = []; + var registered = 0; + dependentTypes.forEach((dt, i) => { + if (registeredTypes.hasOwnProperty(dt)) { + typeConverters[i] = registeredTypes[dt]; + } else { + unregisteredTypes.push(dt); + if (!awaitingDependencies.hasOwnProperty(dt)) { + awaitingDependencies[dt] = []; + } + awaitingDependencies[dt].push(() => { + typeConverters[i] = registeredTypes[dt]; + ++registered; + if (registered === unregisteredTypes.length) { + onComplete(typeConverters); + } + }); + } + }); + if (0 === unregisteredTypes.length) { + onComplete(typeConverters); + } + }; + function sharedRegisterType(rawType, registeredInstance, options = {}) { + var name = registeredInstance.name; + if (!rawType) { + throwBindingError( + `type "${name}" must have a positive integer typeid pointer`, + ); + } + if (registeredTypes.hasOwnProperty(rawType)) { + if (options.ignoreDuplicateRegistrations) { + return; + } else { + throwBindingError(`Cannot register type '${name}' twice`); + } + } + registeredTypes[rawType] = registeredInstance; + delete typeDependencies[rawType]; + if (awaitingDependencies.hasOwnProperty(rawType)) { + var callbacks = awaitingDependencies[rawType]; + delete awaitingDependencies[rawType]; + callbacks.forEach((cb) => cb()); + } + } + function registerType(rawType, registeredInstance, options = {}) { + if (!("argPackAdvance" in registeredInstance)) { + throw new TypeError( + "registerType registeredInstance requires argPackAdvance", + ); + } + return sharedRegisterType(rawType, registeredInstance, options); + } + var GenericWireTypeSize = 8; + function __embind_register_bool(rawType, name, trueValue, falseValue) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: function (wt) { + return !!wt; + }, + toWireType: function (destructors, o) { + return o ? trueValue : falseValue; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: function (pointer) { + return this["fromWireType"](GROWABLE_HEAP_U8()[pointer >>> 0]); + }, + destructorFunction: null, + }); + } + var shallowCopyInternalPointer = (o) => ({ + count: o.count, + deleteScheduled: o.deleteScheduled, + preservePointerOnDelete: o.preservePointerOnDelete, + ptr: o.ptr, + ptrType: o.ptrType, + smartPtr: o.smartPtr, + smartPtrType: o.smartPtrType, + }); + var throwInstanceAlreadyDeleted = (obj) => { + function getInstanceTypeName(handle) { + return handle.$$.ptrType.registeredClass.name; + } + throwBindingError(getInstanceTypeName(obj) + " instance already deleted"); + }; + var finalizationRegistry = false; + var detachFinalizer = (handle) => {}; + var runDestructor = ($$) => { + if ($$.smartPtr) { + $$.smartPtrType.rawDestructor($$.smartPtr); + } else { + $$.ptrType.registeredClass.rawDestructor($$.ptr); + } + }; + var releaseClassHandle = ($$) => { + $$.count.value -= 1; + var toDelete = 0 === $$.count.value; + if (toDelete) { + runDestructor($$); + } + }; + var downcastPointer = (ptr, ptrClass, desiredClass) => { + if (ptrClass === desiredClass) { + return ptr; + } + if (undefined === desiredClass.baseClass) { + return null; + } + var rv = downcastPointer(ptr, ptrClass, desiredClass.baseClass); + if (rv === null) { + return null; + } + return desiredClass.downcast(rv); + }; + var registeredPointers = {}; + var getInheritedInstanceCount = () => + Object.keys(registeredInstances).length; + var getLiveInheritedInstances = () => { + var rv = []; + for (var k in registeredInstances) { + if (registeredInstances.hasOwnProperty(k)) { + rv.push(registeredInstances[k]); + } + } + return rv; + }; + var deletionQueue = []; + var flushPendingDeletes = () => { + while (deletionQueue.length) { + var obj = deletionQueue.pop(); + obj.$$.deleteScheduled = false; + obj["delete"](); + } + }; + var delayFunction; + var setDelayFunction = (fn) => { + delayFunction = fn; + if (deletionQueue.length && delayFunction) { + delayFunction(flushPendingDeletes); + } + }; + var init_embind = () => { + Module["getInheritedInstanceCount"] = getInheritedInstanceCount; + Module["getLiveInheritedInstances"] = getLiveInheritedInstances; + Module["flushPendingDeletes"] = flushPendingDeletes; + Module["setDelayFunction"] = setDelayFunction; + }; + var registeredInstances = {}; + var getBasestPointer = (class_, ptr) => { + if (ptr === undefined) { + throwBindingError("ptr should not be undefined"); + } + while (class_.baseClass) { + ptr = class_.upcast(ptr); + class_ = class_.baseClass; + } + return ptr; + }; + var getInheritedInstance = (class_, ptr) => { + ptr = getBasestPointer(class_, ptr); + return registeredInstances[ptr]; + }; + var makeClassHandle = (prototype, record) => { + if (!record.ptrType || !record.ptr) { + throwInternalError("makeClassHandle requires ptr and ptrType"); + } + var hasSmartPtrType = !!record.smartPtrType; + var hasSmartPtr = !!record.smartPtr; + if (hasSmartPtrType !== hasSmartPtr) { + throwInternalError("Both smartPtrType and smartPtr must be specified"); + } + record.count = { value: 1 }; + return attachFinalizer( + Object.create(prototype, { $$: { value: record } }), + ); + }; + function RegisteredPointer_fromWireType(ptr) { + var rawPointer = this.getPointee(ptr); + if (!rawPointer) { + this.destructor(ptr); + return null; + } + var registeredInstance = getInheritedInstance( + this.registeredClass, + rawPointer, + ); + if (undefined !== registeredInstance) { + if (0 === registeredInstance.$$.count.value) { + registeredInstance.$$.ptr = rawPointer; + registeredInstance.$$.smartPtr = ptr; + return registeredInstance["clone"](); + } else { + var rv = registeredInstance["clone"](); + this.destructor(ptr); + return rv; + } + } + function makeDefaultHandle() { + if (this.isSmartPointer) { + return makeClassHandle(this.registeredClass.instancePrototype, { + ptrType: this.pointeeType, + ptr: rawPointer, + smartPtrType: this, + smartPtr: ptr, + }); + } else { + return makeClassHandle(this.registeredClass.instancePrototype, { + ptrType: this, + ptr: ptr, + }); + } + } + var actualType = this.registeredClass.getActualType(rawPointer); + var registeredPointerRecord = registeredPointers[actualType]; + if (!registeredPointerRecord) { + return makeDefaultHandle.call(this); + } + var toType; + if (this.isConst) { + toType = registeredPointerRecord.constPointerType; + } else { + toType = registeredPointerRecord.pointerType; + } + var dp = downcastPointer( + rawPointer, + this.registeredClass, + toType.registeredClass, + ); + if (dp === null) { + return makeDefaultHandle.call(this); + } + if (this.isSmartPointer) { + return makeClassHandle(toType.registeredClass.instancePrototype, { + ptrType: toType, + ptr: dp, + smartPtrType: this, + smartPtr: ptr, + }); + } else { + return makeClassHandle(toType.registeredClass.instancePrototype, { + ptrType: toType, + ptr: dp, + }); + } + } + var attachFinalizer = (handle) => { + if ("undefined" === typeof FinalizationRegistry) { + attachFinalizer = (handle) => handle; + return handle; + } + finalizationRegistry = new FinalizationRegistry((info) => { + releaseClassHandle(info.$$); + }); + attachFinalizer = (handle) => { + var $$ = handle.$$; + var hasSmartPtr = !!$$.smartPtr; + if (hasSmartPtr) { + var info = { $$: $$ }; + finalizationRegistry.register(handle, info, handle); + } + return handle; + }; + detachFinalizer = (handle) => finalizationRegistry.unregister(handle); + return attachFinalizer(handle); + }; + var init_ClassHandle = () => { + Object.assign(ClassHandle.prototype, { + isAliasOf(other) { + if (!(this instanceof ClassHandle)) { + return false; + } + if (!(other instanceof ClassHandle)) { + return false; + } + var leftClass = this.$$.ptrType.registeredClass; + var left = this.$$.ptr; + other.$$ = other.$$; + var rightClass = other.$$.ptrType.registeredClass; + var right = other.$$.ptr; + while (leftClass.baseClass) { + left = leftClass.upcast(left); + leftClass = leftClass.baseClass; + } + while (rightClass.baseClass) { + right = rightClass.upcast(right); + rightClass = rightClass.baseClass; + } + return leftClass === rightClass && left === right; + }, + clone() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.preservePointerOnDelete) { + this.$$.count.value += 1; + return this; + } else { + var clone = attachFinalizer( + Object.create(Object.getPrototypeOf(this), { + $$: { value: shallowCopyInternalPointer(this.$$) }, + }), + ); + clone.$$.count.value += 1; + clone.$$.deleteScheduled = false; + return clone; + } + }, + delete() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) { + throwBindingError("Object already scheduled for deletion"); + } + detachFinalizer(this); + releaseClassHandle(this.$$); + if (!this.$$.preservePointerOnDelete) { + this.$$.smartPtr = undefined; + this.$$.ptr = undefined; + } + }, + isDeleted() { + return !this.$$.ptr; + }, + deleteLater() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) { + throwBindingError("Object already scheduled for deletion"); + } + deletionQueue.push(this); + if (deletionQueue.length === 1 && delayFunction) { + delayFunction(flushPendingDeletes); + } + this.$$.deleteScheduled = true; + return this; + }, + }); + }; + function ClassHandle() {} + var char_0 = 48; + var char_9 = 57; + var makeLegalFunctionName = (name) => { + if (undefined === name) { + return "_unknown"; + } + name = name.replace(/[^a-zA-Z0-9_]/g, "$"); + var f = name.charCodeAt(0); + if (f >= char_0 && f <= char_9) { + return `_${name}`; + } + return name; + }; + function createNamedFunction(name, body) { + name = makeLegalFunctionName(name); + return { + [name]: function () { + return body.apply(this, arguments); + }, + }[name]; + } + var ensureOverloadTable = (proto, methodName, humanName) => { + if (undefined === proto[methodName].overloadTable) { + var prevFunc = proto[methodName]; + proto[methodName] = function () { + if ( + !proto[methodName].overloadTable.hasOwnProperty(arguments.length) + ) { + throwBindingError( + `Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`, + ); + } + return proto[methodName].overloadTable[arguments.length].apply( + this, + arguments, + ); + }; + proto[methodName].overloadTable = []; + proto[methodName].overloadTable[prevFunc.argCount] = prevFunc; + } + }; + var exposePublicSymbol = (name, value, numArguments) => { + if (Module.hasOwnProperty(name)) { + if ( + undefined === numArguments || + (undefined !== Module[name].overloadTable && + undefined !== Module[name].overloadTable[numArguments]) + ) { + throwBindingError(`Cannot register public name '${name}' twice`); + } + ensureOverloadTable(Module, name, name); + if (Module.hasOwnProperty(numArguments)) { + throwBindingError( + `Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`, + ); + } + Module[name].overloadTable[numArguments] = value; + } else { + Module[name] = value; + if (undefined !== numArguments) { + Module[name].numArguments = numArguments; + } + } + }; + function RegisteredClass( + name, + constructor, + instancePrototype, + rawDestructor, + baseClass, + getActualType, + upcast, + downcast, + ) { + this.name = name; + this.constructor = constructor; + this.instancePrototype = instancePrototype; + this.rawDestructor = rawDestructor; + this.baseClass = baseClass; + this.getActualType = getActualType; + this.upcast = upcast; + this.downcast = downcast; + this.pureVirtualFunctions = []; + } + var upcastPointer = (ptr, ptrClass, desiredClass) => { + while (ptrClass !== desiredClass) { + if (!ptrClass.upcast) { + throwBindingError( + `Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`, + ); + } + ptr = ptrClass.upcast(ptr); + ptrClass = ptrClass.baseClass; + } + return ptr; + }; + function constNoSmartPtrRawPointerToWireType(destructors, handle) { + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + return 0; + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + return ptr; + } + function genericPointerToWireType(destructors, handle) { + var ptr; + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + if (this.isSmartPointer) { + ptr = this.rawConstructor(); + if (destructors !== null) { + destructors.push(this.rawDestructor, ptr); + } + return ptr; + } else { + return 0; + } + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + if (!this.isConst && handle.$$.ptrType.isConst) { + throwBindingError( + `Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + if (this.isSmartPointer) { + if (undefined === handle.$$.smartPtr) { + throwBindingError("Passing raw pointer to smart pointer is illegal"); + } + switch (this.sharingPolicy) { + case 0: + if (handle.$$.smartPtrType === this) { + ptr = handle.$$.smartPtr; + } else { + throwBindingError( + `Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + break; + case 1: + ptr = handle.$$.smartPtr; + break; + case 2: + if (handle.$$.smartPtrType === this) { + ptr = handle.$$.smartPtr; + } else { + var clonedHandle = handle["clone"](); + ptr = this.rawShare( + ptr, + Emval.toHandle(() => clonedHandle["delete"]()), + ); + if (destructors !== null) { + destructors.push(this.rawDestructor, ptr); + } + } + break; + default: + throwBindingError("Unsupporting sharing policy"); + } + } + return ptr; + } + function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) { + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + return 0; + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + if (handle.$$.ptrType.isConst) { + throwBindingError( + `Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + return ptr; + } + function readPointer(pointer) { + return this["fromWireType"](GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0]); + } + var init_RegisteredPointer = () => { + Object.assign(RegisteredPointer.prototype, { + getPointee(ptr) { + if (this.rawGetPointee) { + ptr = this.rawGetPointee(ptr); + } + return ptr; + }, + destructor(ptr) { + if (this.rawDestructor) { + this.rawDestructor(ptr); + } + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: readPointer, + deleteObject(handle) { + if (handle !== null) { + handle["delete"](); + } + }, + fromWireType: RegisteredPointer_fromWireType, + }); + }; + function RegisteredPointer( + name, + registeredClass, + isReference, + isConst, + isSmartPointer, + pointeeType, + sharingPolicy, + rawGetPointee, + rawConstructor, + rawShare, + rawDestructor, + ) { + this.name = name; + this.registeredClass = registeredClass; + this.isReference = isReference; + this.isConst = isConst; + this.isSmartPointer = isSmartPointer; + this.pointeeType = pointeeType; + this.sharingPolicy = sharingPolicy; + this.rawGetPointee = rawGetPointee; + this.rawConstructor = rawConstructor; + this.rawShare = rawShare; + this.rawDestructor = rawDestructor; + if (!isSmartPointer && registeredClass.baseClass === undefined) { + if (isConst) { + this["toWireType"] = constNoSmartPtrRawPointerToWireType; + this.destructorFunction = null; + } else { + this["toWireType"] = nonConstNoSmartPtrRawPointerToWireType; + this.destructorFunction = null; + } + } else { + this["toWireType"] = genericPointerToWireType; + } + } + var replacePublicSymbol = (name, value, numArguments) => { + if (!Module.hasOwnProperty(name)) { + throwInternalError("Replacing nonexistant public symbol"); + } + if ( + undefined !== Module[name].overloadTable && + undefined !== numArguments + ) { + Module[name].overloadTable[numArguments] = value; + } else { + Module[name] = value; + Module[name].argCount = numArguments; + } + }; + var dynCallLegacy = (sig, ptr, args) => { + var f = Module["dynCall_" + sig]; + return args && args.length + ? f.apply(null, [ptr].concat(args)) + : f.call(null, ptr); + }; + var wasmTable; + var dynCall = (sig, ptr, args) => { + var rtn = dynCallLegacy(sig, ptr, args); + return rtn; + }; + var getDynCaller = (sig, ptr) => { + var argCache = []; + return function () { + argCache.length = 0; + Object.assign(argCache, arguments); + return dynCall(sig, ptr, argCache); + }; + }; + var embind__requireFunction = (signature, rawFunction) => { + signature = readLatin1String(signature); + function makeDynCaller() { + return getDynCaller(signature, rawFunction); + } + var fp = makeDynCaller(); + if (typeof fp != "function") { + throwBindingError( + `unknown function pointer with signature ${signature}: ${rawFunction}`, + ); + } + return fp; + }; + var extendError = (baseErrorType, errorName) => { + var errorClass = createNamedFunction(errorName, function (message) { + this.name = errorName; + this.message = message; + var stack = new Error(message).stack; + if (stack !== undefined) { + this.stack = + this.toString() + "\n" + stack.replace(/^Error(:[^\n]*)?\n/, ""); + } + }); + errorClass.prototype = Object.create(baseErrorType.prototype); + errorClass.prototype.constructor = errorClass; + errorClass.prototype.toString = function () { + if (this.message === undefined) { + return this.name; + } else { + return `${this.name}: ${this.message}`; + } + }; + return errorClass; + }; + var UnboundTypeError; + var getTypeName = (type) => { + var ptr = ___getTypeName(type); + var rv = readLatin1String(ptr); + _free(ptr); + return rv; + }; + var throwUnboundTypeError = (message, types) => { + var unboundTypes = []; + var seen = {}; + function visit(type) { + if (seen[type]) { + return; + } + if (registeredTypes[type]) { + return; + } + if (typeDependencies[type]) { + typeDependencies[type].forEach(visit); + return; + } + unboundTypes.push(type); + seen[type] = true; + } + types.forEach(visit); + throw new UnboundTypeError( + `${message}: ` + unboundTypes.map(getTypeName).join([", "]), + ); + }; + function __embind_register_class( + rawType, + rawPointerType, + rawConstPointerType, + baseClassRawType, + getActualTypeSignature, + getActualType, + upcastSignature, + upcast, + downcastSignature, + downcast, + name, + destructorSignature, + rawDestructor, + ) { + rawType >>>= 0; + rawPointerType >>>= 0; + rawConstPointerType >>>= 0; + baseClassRawType >>>= 0; + getActualTypeSignature >>>= 0; + getActualType >>>= 0; + upcastSignature >>>= 0; + upcast >>>= 0; + downcastSignature >>>= 0; + downcast >>>= 0; + name >>>= 0; + destructorSignature >>>= 0; + rawDestructor >>>= 0; + name = readLatin1String(name); + getActualType = embind__requireFunction( + getActualTypeSignature, + getActualType, + ); + if (upcast) { + upcast = embind__requireFunction(upcastSignature, upcast); + } + if (downcast) { + downcast = embind__requireFunction(downcastSignature, downcast); + } + rawDestructor = embind__requireFunction( + destructorSignature, + rawDestructor, + ); + var legalFunctionName = makeLegalFunctionName(name); + exposePublicSymbol(legalFunctionName, function () { + throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [ + baseClassRawType, + ]); + }); + whenDependentTypesAreResolved( + [rawType, rawPointerType, rawConstPointerType], + baseClassRawType ? [baseClassRawType] : [], + function (base) { + base = base[0]; + var baseClass; + var basePrototype; + if (baseClassRawType) { + baseClass = base.registeredClass; + basePrototype = baseClass.instancePrototype; + } else { + basePrototype = ClassHandle.prototype; + } + var constructor = createNamedFunction(legalFunctionName, function () { + if (Object.getPrototypeOf(this) !== instancePrototype) { + throw new BindingError("Use 'new' to construct " + name); + } + if (undefined === registeredClass.constructor_body) { + throw new BindingError(name + " has no accessible constructor"); + } + var body = registeredClass.constructor_body[arguments.length]; + if (undefined === body) { + throw new BindingError( + `Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`, + ); + } + return body.apply(this, arguments); + }); + var instancePrototype = Object.create(basePrototype, { + constructor: { value: constructor }, + }); + constructor.prototype = instancePrototype; + var registeredClass = new RegisteredClass( + name, + constructor, + instancePrototype, + rawDestructor, + baseClass, + getActualType, + upcast, + downcast, + ); + if (registeredClass.baseClass) { + if (registeredClass.baseClass.__derivedClasses === undefined) { + registeredClass.baseClass.__derivedClasses = []; + } + registeredClass.baseClass.__derivedClasses.push(registeredClass); + } + var referenceConverter = new RegisteredPointer( + name, + registeredClass, + true, + false, + false, + ); + var pointerConverter = new RegisteredPointer( + name + "*", + registeredClass, + false, + false, + false, + ); + var constPointerConverter = new RegisteredPointer( + name + " const*", + registeredClass, + false, + true, + false, + ); + registeredPointers[rawType] = { + pointerType: pointerConverter, + constPointerType: constPointerConverter, + }; + replacePublicSymbol(legalFunctionName, constructor); + return [referenceConverter, pointerConverter, constPointerConverter]; + }, + ); + } + var runDestructors = (destructors) => { + while (destructors.length) { + var ptr = destructors.pop(); + var del = destructors.pop(); + del(ptr); + } + }; + function newFunc(constructor, argumentList) { + if (!(constructor instanceof Function)) { + throw new TypeError( + `new_ called with constructor type ${typeof constructor} which is not a function`, + ); + } + var dummy = createNamedFunction( + constructor.name || "unknownFunctionName", + function () {}, + ); + dummy.prototype = constructor.prototype; + var obj = new dummy(); + var r = constructor.apply(obj, argumentList); + return r instanceof Object ? r : obj; + } + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + if (ENVIRONMENT_IS_PTHREAD) __emscripten_thread_exit(EXITSTATUS); + else _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (var x in imports) { + (function (x) { + var original = imports[x]; + var sig = original.sig; + if (typeof original == "function") { + var isAsyncifyImport = original.isAsync || importPattern.test(x); + } + })(x); + } + }, + instrumentWasmExports(exports) { + var ret = {}; + for (var x in exports) { + (function (x) { + var original = exports[x]; + if (typeof original == "function") { + ret[x] = function () { + Asyncify.exportCallStack.push(x); + try { + return original.apply(null, arguments); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + })(x); + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runtimeKeepalivePush(); + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve: resolve, reject: reject }; + }); + }, + allocateData() { + var ptr = _malloc(12 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + GROWABLE_HEAP_U32()[(ptr >>> 2) >>> 0] = stack; + GROWABLE_HEAP_U32()[((ptr + 4) >>> 2) >>> 0] = stack + stackSize; + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + GROWABLE_HEAP_I32()[((ptr + 8) >>> 2) >>> 0] = rewindId; + }, + getDataRewindFunc(ptr) { + var id = GROWABLE_HEAP_I32()[((ptr + 8) >>> 2) >>> 0]; + var name = Asyncify.callStackIdToName[id]; + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var start = Asyncify.getDataRewindFunc(ptr); + runtimeKeepalivePop(); + return start(); + }, + handleSleep(startAsync) { + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach((func) => callUserCallback(func)); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + function craftInvokerFunction( + humanName, + argTypes, + classType, + cppInvokerFunc, + cppTargetFunc, + isAsync, + ) { + var argCount = argTypes.length; + if (argCount < 2) { + throwBindingError( + "argTypes array size mismatch! Must at least get return value and 'this' types!", + ); + } + var isClassMethodFunc = argTypes[1] !== null && classType !== null; + var needsDestructorStack = false; + for (var i = 1; i < argTypes.length; ++i) { + if ( + argTypes[i] !== null && + argTypes[i].destructorFunction === undefined + ) { + needsDestructorStack = true; + break; + } + } + var returns = argTypes[0].name !== "void"; + var argsList = ""; + var argsListWired = ""; + for (var i = 0; i < argCount - 2; ++i) { + argsList += (i !== 0 ? ", " : "") + "arg" + i; + argsListWired += (i !== 0 ? ", " : "") + "arg" + i + "Wired"; + } + var invokerFnBody = `\n return function ${makeLegalFunctionName(humanName)}(${argsList}) {\n if (arguments.length !== ${argCount - 2}) {\n throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');\n }`; + if (needsDestructorStack) { + invokerFnBody += "var destructors = [];\n"; + } + var dtorStack = needsDestructorStack ? "destructors" : "null"; + var args1 = [ + "throwBindingError", + "invoker", + "fn", + "runDestructors", + "retType", + "classParam", + ]; + var args2 = [ + throwBindingError, + cppInvokerFunc, + cppTargetFunc, + runDestructors, + argTypes[0], + argTypes[1], + ]; + if (isClassMethodFunc) { + invokerFnBody += + "var thisWired = classParam.toWireType(" + dtorStack + ", this);\n"; + } + for (var i = 0; i < argCount - 2; ++i) { + invokerFnBody += + "var arg" + + i + + "Wired = argType" + + i + + ".toWireType(" + + dtorStack + + ", arg" + + i + + "); // " + + argTypes[i + 2].name + + "\n"; + args1.push("argType" + i); + args2.push(argTypes[i + 2]); + } + if (isClassMethodFunc) { + argsListWired = + "thisWired" + (argsListWired.length > 0 ? ", " : "") + argsListWired; + } + invokerFnBody += + (returns || isAsync ? "var rv = " : "") + + "invoker(fn" + + (argsListWired.length > 0 ? ", " : "") + + argsListWired + + ");\n"; + args1.push("Asyncify"); + args2.push(Asyncify); + invokerFnBody += "function onDone(" + (returns ? "rv" : "") + ") {\n"; + if (needsDestructorStack) { + invokerFnBody += "runDestructors(destructors);\n"; + } else { + for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) { + var paramName = i === 1 ? "thisWired" : "arg" + (i - 2) + "Wired"; + if (argTypes[i].destructorFunction !== null) { + invokerFnBody += + paramName + + "_dtor(" + + paramName + + "); // " + + argTypes[i].name + + "\n"; + args1.push(paramName + "_dtor"); + args2.push(argTypes[i].destructorFunction); + } + } + } + if (returns) { + invokerFnBody += + "var ret = retType.fromWireType(rv);\n" + "return ret;\n"; + } else { + } + invokerFnBody += "}\n"; + invokerFnBody += + "return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(" + + (returns ? "rv" : "") + + ");\n"; + invokerFnBody += "}\n"; + args1.push(invokerFnBody); + return newFunc(Function, args1).apply(null, args2); + } + var heap32VectorToArray = (count, firstElement) => { + var array = []; + for (var i = 0; i < count; i++) { + array.push(GROWABLE_HEAP_U32()[((firstElement + i * 4) >>> 2) >>> 0]); + } + return array; + }; + var getFunctionName = (signature) => { + signature = signature.trim(); + const argsIndex = signature.indexOf("("); + if (argsIndex !== -1) { + assert( + signature[signature.length - 1] == ")", + "Parentheses for argument names should match.", + ); + return signature.substr(0, argsIndex); + } else { + return signature; + } + }; + function __embind_register_class_class_function( + rawClassType, + methodName, + argCount, + rawArgTypesAddr, + invokerSignature, + rawInvoker, + fn, + isAsync, + ) { + rawClassType >>>= 0; + methodName >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + rawInvoker >>>= 0; + fn >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + methodName = readLatin1String(methodName); + methodName = getFunctionName(methodName); + rawInvoker = embind__requireFunction(invokerSignature, rawInvoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${methodName}`; + function unboundTypesHandler() { + throwUnboundTypeError( + `Cannot call ${humanName} due to unbound types`, + rawArgTypes, + ); + } + if (methodName.startsWith("@@")) { + methodName = Symbol[methodName.substring(2)]; + } + var proto = classType.registeredClass.constructor; + if (undefined === proto[methodName]) { + unboundTypesHandler.argCount = argCount - 1; + proto[methodName] = unboundTypesHandler; + } else { + ensureOverloadTable(proto, methodName, humanName); + proto[methodName].overloadTable[argCount - 1] = unboundTypesHandler; + } + whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) { + var invokerArgsArray = [argTypes[0], null].concat(argTypes.slice(1)); + var func = craftInvokerFunction( + humanName, + invokerArgsArray, + null, + rawInvoker, + fn, + isAsync, + ); + if (undefined === proto[methodName].overloadTable) { + func.argCount = argCount - 1; + proto[methodName] = func; + } else { + proto[methodName].overloadTable[argCount - 1] = func; + } + if (classType.registeredClass.__derivedClasses) { + for (const derivedClass of classType.registeredClass + .__derivedClasses) { + if (!derivedClass.constructor.hasOwnProperty(methodName)) { + derivedClass.constructor[methodName] = func; + } + } + } + return []; + }); + return []; + }); + } + var validateThis = (this_, classType, humanName) => { + if (!(this_ instanceof Object)) { + throwBindingError(`${humanName} with invalid "this": ${this_}`); + } + if (!(this_ instanceof classType.registeredClass.constructor)) { + throwBindingError( + `${humanName} incompatible with "this" of type ${this_.constructor.name}`, + ); + } + if (!this_.$$.ptr) { + throwBindingError( + `cannot call emscripten binding method ${humanName} on deleted object`, + ); + } + return upcastPointer( + this_.$$.ptr, + this_.$$.ptrType.registeredClass, + classType.registeredClass, + ); + }; + function __embind_register_class_class_property( + rawClassType, + fieldName, + rawFieldType, + rawFieldPtr, + getterSignature, + getter, + setterSignature, + setter, + ) { + rawClassType >>>= 0; + fieldName >>>= 0; + rawFieldType >>>= 0; + rawFieldPtr >>>= 0; + getterSignature >>>= 0; + getter >>>= 0; + setterSignature >>>= 0; + setter >>>= 0; + fieldName = readLatin1String(fieldName); + getter = embind__requireFunction(getterSignature, getter); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${fieldName}`; + var desc = { + get() { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [rawFieldType], + ); + }, + enumerable: true, + configurable: true, + }; + if (setter) { + desc.set = () => { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [rawFieldType], + ); + }; + } else { + desc.set = (v) => { + throwBindingError(`${humanName} is a read-only property`); + }; + } + Object.defineProperty( + classType.registeredClass.constructor, + fieldName, + desc, + ); + whenDependentTypesAreResolved([], [rawFieldType], function (fieldType) { + fieldType = fieldType[0]; + var desc = { + get() { + return fieldType["fromWireType"](getter(rawFieldPtr)); + }, + enumerable: true, + }; + if (setter) { + setter = embind__requireFunction(setterSignature, setter); + desc.set = (v) => { + var destructors = []; + setter(rawFieldPtr, fieldType["toWireType"](destructors, v)); + runDestructors(destructors); + }; + } + Object.defineProperty( + classType.registeredClass.constructor, + fieldName, + desc, + ); + return []; + }); + return []; + }); + } + function __embind_register_class_constructor( + rawClassType, + argCount, + rawArgTypesAddr, + invokerSignature, + invoker, + rawConstructor, + ) { + rawClassType >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + invoker >>>= 0; + rawConstructor >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + invoker = embind__requireFunction(invokerSignature, invoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `constructor ${classType.name}`; + if (undefined === classType.registeredClass.constructor_body) { + classType.registeredClass.constructor_body = []; + } + if ( + undefined !== classType.registeredClass.constructor_body[argCount - 1] + ) { + throw new BindingError( + `Cannot register multiple constructors with identical number of parameters (${argCount - 1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`, + ); + } + classType.registeredClass.constructor_body[argCount - 1] = () => { + throwUnboundTypeError( + `Cannot construct ${classType.name} due to unbound types`, + rawArgTypes, + ); + }; + whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => { + argTypes.splice(1, 0, null); + classType.registeredClass.constructor_body[argCount - 1] = + craftInvokerFunction( + humanName, + argTypes, + null, + invoker, + rawConstructor, + ); + return []; + }); + return []; + }); + } + function __embind_register_class_function( + rawClassType, + methodName, + argCount, + rawArgTypesAddr, + invokerSignature, + rawInvoker, + context, + isPureVirtual, + isAsync, + ) { + rawClassType >>>= 0; + methodName >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + rawInvoker >>>= 0; + context >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + methodName = readLatin1String(methodName); + methodName = getFunctionName(methodName); + rawInvoker = embind__requireFunction(invokerSignature, rawInvoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${methodName}`; + if (methodName.startsWith("@@")) { + methodName = Symbol[methodName.substring(2)]; + } + if (isPureVirtual) { + classType.registeredClass.pureVirtualFunctions.push(methodName); + } + function unboundTypesHandler() { + throwUnboundTypeError( + `Cannot call ${humanName} due to unbound types`, + rawArgTypes, + ); + } + var proto = classType.registeredClass.instancePrototype; + var method = proto[methodName]; + if ( + undefined === method || + (undefined === method.overloadTable && + method.className !== classType.name && + method.argCount === argCount - 2) + ) { + unboundTypesHandler.argCount = argCount - 2; + unboundTypesHandler.className = classType.name; + proto[methodName] = unboundTypesHandler; + } else { + ensureOverloadTable(proto, methodName, humanName); + proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler; + } + whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) { + var memberFunction = craftInvokerFunction( + humanName, + argTypes, + classType, + rawInvoker, + context, + isAsync, + ); + if (undefined === proto[methodName].overloadTable) { + memberFunction.argCount = argCount - 2; + proto[methodName] = memberFunction; + } else { + proto[methodName].overloadTable[argCount - 2] = memberFunction; + } + return []; + }); + return []; + }); + } + function __embind_register_class_property( + classType, + fieldName, + getterReturnType, + getterSignature, + getter, + getterContext, + setterArgumentType, + setterSignature, + setter, + setterContext, + ) { + classType >>>= 0; + fieldName >>>= 0; + getterReturnType >>>= 0; + getterSignature >>>= 0; + getter >>>= 0; + getterContext >>>= 0; + setterArgumentType >>>= 0; + setterSignature >>>= 0; + setter >>>= 0; + setterContext >>>= 0; + fieldName = readLatin1String(fieldName); + getter = embind__requireFunction(getterSignature, getter); + whenDependentTypesAreResolved([], [classType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${fieldName}`; + var desc = { + get() { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [getterReturnType, setterArgumentType], + ); + }, + enumerable: true, + configurable: true, + }; + if (setter) { + desc.set = () => + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [getterReturnType, setterArgumentType], + ); + } else { + desc.set = (v) => + throwBindingError(humanName + " is a read-only property"); + } + Object.defineProperty( + classType.registeredClass.instancePrototype, + fieldName, + desc, + ); + whenDependentTypesAreResolved( + [], + setter ? [getterReturnType, setterArgumentType] : [getterReturnType], + function (types) { + var getterReturnType = types[0]; + var desc = { + get() { + var ptr = validateThis(this, classType, humanName + " getter"); + return getterReturnType["fromWireType"]( + getter(getterContext, ptr), + ); + }, + enumerable: true, + }; + if (setter) { + setter = embind__requireFunction(setterSignature, setter); + var setterArgumentType = types[1]; + desc.set = function (v) { + var ptr = validateThis(this, classType, humanName + " setter"); + var destructors = []; + setter( + setterContext, + ptr, + setterArgumentType["toWireType"](destructors, v), + ); + runDestructors(destructors); + }; + } + Object.defineProperty( + classType.registeredClass.instancePrototype, + fieldName, + desc, + ); + return []; + }, + ); + return []; + }); + } + function handleAllocatorInit() { + Object.assign(HandleAllocator.prototype, { + get(id) { + return this.allocated[id]; + }, + has(id) { + return this.allocated[id] !== undefined; + }, + allocate(handle) { + var id = this.freelist.pop() || this.allocated.length; + this.allocated[id] = handle; + return id; + }, + free(id) { + this.allocated[id] = undefined; + this.freelist.push(id); + }, + }); + } + function HandleAllocator() { + this.allocated = [undefined]; + this.freelist = []; + } + var emval_handles = new HandleAllocator(); + function __emval_decref(handle) { + handle >>>= 0; + if ( + handle >= emval_handles.reserved && + 0 === --emval_handles.get(handle).refcount + ) { + emval_handles.free(handle); + } + } + var count_emval_handles = () => { + var count = 0; + for ( + var i = emval_handles.reserved; + i < emval_handles.allocated.length; + ++i + ) { + if (emval_handles.allocated[i] !== undefined) { + ++count; + } + } + return count; + }; + var init_emval = () => { + emval_handles.allocated.push( + { value: undefined }, + { value: null }, + { value: true }, + { value: false }, + ); + emval_handles.reserved = emval_handles.allocated.length; + Module["count_emval_handles"] = count_emval_handles; + }; + var Emval = { + toValue: (handle) => { + if (!handle) { + throwBindingError("Cannot use deleted val. handle = " + handle); + } + return emval_handles.get(handle).value; + }, + toHandle: (value) => { + switch (value) { + case undefined: + return 1; + case null: + return 2; + case true: + return 3; + case false: + return 4; + default: { + return emval_handles.allocate({ refcount: 1, value: value }); + } + } + }, + }; + function simpleReadValueFromPointer(pointer) { + return this["fromWireType"](GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0]); + } + var __embind_register_emval = function (rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: (handle) => { + var rv = Emval.toValue(handle); + __emval_decref(handle); + return rv; + }, + toWireType: (destructors, value) => Emval.toHandle(value), + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: simpleReadValueFromPointer, + destructorFunction: null, + }); + }; + var enumReadValueFromPointer = (name, width, signed) => { + switch (width) { + case 1: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I8()[(pointer >>> 0) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U8()[(pointer >>> 0) >>> 0], + ); + }; + case 2: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I16()[(pointer >>> 1) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U16()[(pointer >>> 1) >>> 0], + ); + }; + case 4: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0], + ); + }; + default: + throw new TypeError(`invalid integer width (${width}): ${name}`); + } + }; + function __embind_register_enum(rawType, name, size, isSigned) { + rawType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + function ctor() {} + ctor.values = {}; + registerType(rawType, { + name: name, + constructor: ctor, + fromWireType: function (c) { + return this.constructor.values[c]; + }, + toWireType: (destructors, c) => c.value, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: enumReadValueFromPointer(name, size, isSigned), + destructorFunction: null, + }); + exposePublicSymbol(name, ctor); + } + var requireRegisteredType = (rawType, humanName) => { + var impl = registeredTypes[rawType]; + if (undefined === impl) { + throwBindingError( + humanName + " has unknown type " + getTypeName(rawType), + ); + } + return impl; + }; + function __embind_register_enum_value(rawEnumType, name, enumValue) { + rawEnumType >>>= 0; + name >>>= 0; + enumValue >>>= 0; + var enumType = requireRegisteredType(rawEnumType, "enum"); + name = readLatin1String(name); + var Enum = enumType.constructor; + var Value = Object.create(enumType.constructor.prototype, { + value: { value: enumValue }, + constructor: { + value: createNamedFunction( + `${enumType.name}_${name}`, + function () {}, + ), + }, + }); + Enum.values[enumValue] = Value; + Enum[name] = Value; + } + var embindRepr = (v) => { + if (v === null) { + return "null"; + } + var t = typeof v; + if (t === "object" || t === "array" || t === "function") { + return v.toString(); + } else { + return "" + v; + } + }; + var floatReadValueFromPointer = (name, width) => { + switch (width) { + case 4: + return function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_F32()[(pointer >>> 2) >>> 0], + ); + }; + case 8: + return function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_F64()[(pointer >>> 3) >>> 0], + ); + }; + default: + throw new TypeError(`invalid float width (${width}): ${name}`); + } + }; + var __embind_register_float = function (rawType, name, size) { + rawType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: (value) => value, + toWireType: (destructors, value) => value, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: floatReadValueFromPointer(name, size), + destructorFunction: null, + }); + }; + function __embind_register_function( + name, + argCount, + rawArgTypesAddr, + signature, + rawInvoker, + fn, + isAsync, + ) { + name >>>= 0; + rawArgTypesAddr >>>= 0; + signature >>>= 0; + rawInvoker >>>= 0; + fn >>>= 0; + var argTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + name = readLatin1String(name); + name = getFunctionName(name); + rawInvoker = embind__requireFunction(signature, rawInvoker); + exposePublicSymbol( + name, + function () { + throwUnboundTypeError( + `Cannot call ${name} due to unbound types`, + argTypes, + ); + }, + argCount - 1, + ); + whenDependentTypesAreResolved([], argTypes, function (argTypes) { + var invokerArgsArray = [argTypes[0], null].concat(argTypes.slice(1)); + replacePublicSymbol( + name, + craftInvokerFunction( + name, + invokerArgsArray, + null, + rawInvoker, + fn, + isAsync, + ), + argCount - 1, + ); + return []; + }); + } + var integerReadValueFromPointer = (name, width, signed) => { + switch (width) { + case 1: + return signed + ? (pointer) => GROWABLE_HEAP_I8()[(pointer >>> 0) >>> 0] + : (pointer) => GROWABLE_HEAP_U8()[(pointer >>> 0) >>> 0]; + case 2: + return signed + ? (pointer) => GROWABLE_HEAP_I16()[(pointer >>> 1) >>> 0] + : (pointer) => GROWABLE_HEAP_U16()[(pointer >>> 1) >>> 0]; + case 4: + return signed + ? (pointer) => GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0] + : (pointer) => GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0]; + default: + throw new TypeError(`invalid integer width (${width}): ${name}`); + } + }; + function __embind_register_integer( + primitiveType, + name, + size, + minRange, + maxRange, + ) { + primitiveType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + if (maxRange === -1) { + maxRange = 4294967295; + } + var fromWireType = (value) => value; + if (minRange === 0) { + var bitshift = 32 - 8 * size; + fromWireType = (value) => (value << bitshift) >>> bitshift; + } + var isUnsignedType = name.includes("unsigned"); + var checkAssertions = (value, toTypeName) => {}; + var toWireType; + if (isUnsignedType) { + toWireType = function (destructors, value) { + checkAssertions(value, this.name); + return value >>> 0; + }; + } else { + toWireType = function (destructors, value) { + checkAssertions(value, this.name); + return value; + }; + } + registerType(primitiveType, { + name: name, + fromWireType: fromWireType, + toWireType: toWireType, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: integerReadValueFromPointer( + name, + size, + minRange !== 0, + ), + destructorFunction: null, + }); + } + function __embind_register_memory_view(rawType, dataTypeIndex, name) { + rawType >>>= 0; + name >>>= 0; + var typeMapping = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + ]; + var TA = typeMapping[dataTypeIndex]; + function decodeMemoryView(handle) { + var size = GROWABLE_HEAP_U32()[(handle >>> 2) >>> 0]; + var data = GROWABLE_HEAP_U32()[((handle + 4) >>> 2) >>> 0]; + return new TA(GROWABLE_HEAP_I8().buffer, data, size); + } + name = readLatin1String(name); + registerType( + rawType, + { + name: name, + fromWireType: decodeMemoryView, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: decodeMemoryView, + }, + { ignoreDuplicateRegistrations: true }, + ); + } + function __embind_register_smart_ptr( + rawType, + rawPointeeType, + name, + sharingPolicy, + getPointeeSignature, + rawGetPointee, + constructorSignature, + rawConstructor, + shareSignature, + rawShare, + destructorSignature, + rawDestructor, + ) { + rawType >>>= 0; + rawPointeeType >>>= 0; + name >>>= 0; + getPointeeSignature >>>= 0; + rawGetPointee >>>= 0; + constructorSignature >>>= 0; + rawConstructor >>>= 0; + shareSignature >>>= 0; + rawShare >>>= 0; + destructorSignature >>>= 0; + rawDestructor >>>= 0; + name = readLatin1String(name); + rawGetPointee = embind__requireFunction( + getPointeeSignature, + rawGetPointee, + ); + rawConstructor = embind__requireFunction( + constructorSignature, + rawConstructor, + ); + rawShare = embind__requireFunction(shareSignature, rawShare); + rawDestructor = embind__requireFunction( + destructorSignature, + rawDestructor, + ); + whenDependentTypesAreResolved( + [rawType], + [rawPointeeType], + function (pointeeType) { + pointeeType = pointeeType[0]; + var registeredPointer = new RegisteredPointer( + name, + pointeeType.registeredClass, + false, + false, + true, + pointeeType, + sharingPolicy, + rawGetPointee, + rawConstructor, + rawShare, + rawDestructor, + ); + return [registeredPointer]; + }, + ); + } + function __embind_register_std_string(rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + var stdStringIsUTF8 = name === "std::string"; + registerType(rawType, { + name: name, + fromWireType(value) { + var length = GROWABLE_HEAP_U32()[(value >>> 2) >>> 0]; + var payload = value + 4; + var str; + if (stdStringIsUTF8) { + var decodeStartPtr = payload; + for (var i = 0; i <= length; ++i) { + var currentBytePtr = payload + i; + if ( + i == length || + GROWABLE_HEAP_U8()[currentBytePtr >>> 0] == 0 + ) { + var maxRead = currentBytePtr - decodeStartPtr; + var stringSegment = UTF8ToString(decodeStartPtr, maxRead); + if (str === undefined) { + str = stringSegment; + } else { + str += String.fromCharCode(0); + str += stringSegment; + } + decodeStartPtr = currentBytePtr + 1; + } + } + } else { + var a = new Array(length); + for (var i = 0; i < length; ++i) { + a[i] = String.fromCharCode( + GROWABLE_HEAP_U8()[(payload + i) >>> 0], + ); + } + str = a.join(""); + } + _free(value); + return str; + }, + toWireType(destructors, value) { + if (value instanceof ArrayBuffer) { + value = new Uint8Array(value); + } + var length; + var valueIsOfTypeString = typeof value == "string"; + if ( + !( + valueIsOfTypeString || + value instanceof Uint8Array || + value instanceof Uint8ClampedArray || + value instanceof Int8Array + ) + ) { + throwBindingError("Cannot pass non-string to std::string"); + } + if (stdStringIsUTF8 && valueIsOfTypeString) { + length = lengthBytesUTF8(value); + } else { + length = value.length; + } + var base = _malloc(4 + length + 1); + var ptr = base + 4; + GROWABLE_HEAP_U32()[(base >>> 2) >>> 0] = length; + if (stdStringIsUTF8 && valueIsOfTypeString) { + stringToUTF8(value, ptr, length + 1); + } else { + if (valueIsOfTypeString) { + for (var i = 0; i < length; ++i) { + var charCode = value.charCodeAt(i); + if (charCode > 255) { + _free(ptr); + throwBindingError( + "String has UTF-16 code units that do not fit in 8 bits", + ); + } + GROWABLE_HEAP_U8()[(ptr + i) >>> 0] = charCode; + } + } else { + for (var i = 0; i < length; ++i) { + GROWABLE_HEAP_U8()[(ptr + i) >>> 0] = value[i]; + } + } + } + if (destructors !== null) { + destructors.push(_free, base); + } + return base; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: readPointer, + destructorFunction(ptr) { + _free(ptr); + }, + }); + } + var UTF16Decoder = + typeof TextDecoder != "undefined" + ? new TextDecoder("utf-16le") + : undefined; + var UTF16ToString = (ptr, maxBytesToRead) => { + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && GROWABLE_HEAP_U16()[idx >>> 0]) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) + return UTF16Decoder.decode(GROWABLE_HEAP_U8().slice(ptr, endPtr)); + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = GROWABLE_HEAP_I16()[((ptr + i * 2) >>> 1) >>> 0]; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + }; + var stringToUTF16 = (str, outPtr, maxBytesToWrite) => { + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = + maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + GROWABLE_HEAP_I16()[(outPtr >>> 1) >>> 0] = codeUnit; + outPtr += 2; + } + GROWABLE_HEAP_I16()[(outPtr >>> 1) >>> 0] = 0; + return outPtr - startPtr; + }; + var lengthBytesUTF16 = (str) => str.length * 2; + var UTF32ToString = (ptr, maxBytesToRead) => { + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = GROWABLE_HEAP_I32()[((ptr + i * 4) >>> 2) >>> 0]; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } else { + str += String.fromCharCode(utf32); + } + } + return str; + }; + var stringToUTF32 = (str, outPtr, maxBytesToWrite) => { + outPtr >>>= 0; + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = + (65536 + ((codeUnit & 1023) << 10)) | (trailSurrogate & 1023); + } + GROWABLE_HEAP_I32()[(outPtr >>> 2) >>> 0] = codeUnit; + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + GROWABLE_HEAP_I32()[(outPtr >>> 2) >>> 0] = 0; + return outPtr - startPtr; + }; + var lengthBytesUTF32 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; + }; + var __embind_register_std_wstring = function (rawType, charSize, name) { + rawType >>>= 0; + charSize >>>= 0; + name >>>= 0; + name = readLatin1String(name); + var decodeString, encodeString, getHeap, lengthBytesUTF, shift; + if (charSize === 2) { + decodeString = UTF16ToString; + encodeString = stringToUTF16; + lengthBytesUTF = lengthBytesUTF16; + getHeap = () => GROWABLE_HEAP_U16(); + shift = 1; + } else if (charSize === 4) { + decodeString = UTF32ToString; + encodeString = stringToUTF32; + lengthBytesUTF = lengthBytesUTF32; + getHeap = () => GROWABLE_HEAP_U32(); + shift = 2; + } + registerType(rawType, { + name: name, + fromWireType: (value) => { + var length = GROWABLE_HEAP_U32()[(value >>> 2) >>> 0]; + var HEAP = getHeap(); + var str; + var decodeStartPtr = value + 4; + for (var i = 0; i <= length; ++i) { + var currentBytePtr = value + 4 + i * charSize; + if (i == length || HEAP[currentBytePtr >>> shift] == 0) { + var maxReadBytes = currentBytePtr - decodeStartPtr; + var stringSegment = decodeString(decodeStartPtr, maxReadBytes); + if (str === undefined) { + str = stringSegment; + } else { + str += String.fromCharCode(0); + str += stringSegment; + } + decodeStartPtr = currentBytePtr + charSize; + } + } + _free(value); + return str; + }, + toWireType: (destructors, value) => { + if (!(typeof value == "string")) { + throwBindingError( + `Cannot pass non-string to C++ string type ${name}`, + ); + } + var length = lengthBytesUTF(value); + var ptr = _malloc(4 + length + charSize); + GROWABLE_HEAP_U32()[ptr >>> 2] = length >> shift; + encodeString(value, ptr + 4, length + charSize); + if (destructors !== null) { + destructors.push(_free, ptr); + } + return ptr; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: simpleReadValueFromPointer, + destructorFunction(ptr) { + _free(ptr); + }, + }); + }; + var __embind_register_void = function (rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + isVoid: true, + name: name, + argPackAdvance: 0, + fromWireType: () => undefined, + toWireType: (destructors, o) => undefined, + }); + }; + var nowIsMonotonic = true; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + function __emscripten_thread_mailbox_await(pthread_ptr) { + pthread_ptr >>>= 0; + if (typeof Atomics.waitAsync === "function") { + var wait = Atomics.waitAsync( + GROWABLE_HEAP_I32(), + pthread_ptr >>> 2, + pthread_ptr, + ); + wait.value.then(checkMailbox); + var waitingAsync = pthread_ptr + 128; + Atomics.store(GROWABLE_HEAP_I32(), waitingAsync >>> 2, 1); + } + } + Module["__emscripten_thread_mailbox_await"] = + __emscripten_thread_mailbox_await; + var checkMailbox = () => { + var pthread_ptr = _pthread_self(); + if (pthread_ptr) { + __emscripten_thread_mailbox_await(pthread_ptr); + callUserCallback(() => __emscripten_check_mailbox()); + } + }; + Module["checkMailbox"] = checkMailbox; + var __emscripten_notify_mailbox_postmessage = function ( + targetThreadId, + currThreadId, + mainThreadId, + ) { + targetThreadId >>>= 0; + currThreadId >>>= 0; + mainThreadId >>>= 0; + if (targetThreadId == currThreadId) { + setTimeout(() => checkMailbox()); + } else if (ENVIRONMENT_IS_PTHREAD) { + postMessage({ targetThread: targetThreadId, cmd: "checkMailbox" }); + } else { + var worker = PThread.pthreads[targetThreadId]; + if (!worker) { + return; + } + worker.postMessage({ cmd: "checkMailbox" }); + } + }; + var withStackSave = (f) => { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; + }; + var proxyToMainThread = function (index, sync) { + var numCallArgs = arguments.length - 2; + var outerArgs = arguments; + return withStackSave(() => { + var serializedNumCallArgs = numCallArgs; + var args = stackAlloc(serializedNumCallArgs * 8); + var b = args >>> 3; + for (var i = 0; i < numCallArgs; i++) { + var arg = outerArgs[2 + i]; + GROWABLE_HEAP_F64()[(b + i) >>> 0] = arg; + } + return __emscripten_run_on_main_thread_js( + index, + serializedNumCallArgs, + args, + sync, + ); + }); + }; + var proxiedJSCallArgs = []; + function __emscripten_receive_on_main_thread_js( + index, + callingThread, + numCallArgs, + args, + ) { + callingThread >>>= 0; + args >>>= 0; + proxiedJSCallArgs.length = numCallArgs; + var b = args >>> 3; + for (var i = 0; i < numCallArgs; i++) { + proxiedJSCallArgs[i] = GROWABLE_HEAP_F64()[(b + i) >>> 0]; + } + var func = proxiedFunctionTable[index]; + PThread.currentProxiedOperationCallerThread = callingThread; + var rtn = func.apply(null, proxiedJSCallArgs); + PThread.currentProxiedOperationCallerThread = 0; + return rtn; + } + function __emscripten_runtime_keepalive_clear() { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(20, 1); + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + } + function __emscripten_thread_set_strongref(thread) { + thread >>>= 0; + if (ENVIRONMENT_IS_NODE) { + PThread.pthreads[thread].ref(); + } + } + function __emval_as(handle, returnType, destructorsRef) { + handle >>>= 0; + returnType >>>= 0; + destructorsRef >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + var destructors = []; + var rd = Emval.toHandle(destructors); + GROWABLE_HEAP_U32()[(destructorsRef >>> 2) >>> 0] = rd; + return returnType["toWireType"](destructors, handle); + } + function __emval_as_int64(handle, returnType) { + handle >>>= 0; + returnType >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + return returnType["toWireType"](null, handle); + } + function __emval_as_uint64(handle, returnType) { + handle >>>= 0; + returnType >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + return returnType["toWireType"](null, handle); + } + var emval_lookupTypes = (argCount, argTypes) => { + var a = new Array(argCount); + for (var i = 0; i < argCount; ++i) { + a[i] = requireRegisteredType( + GROWABLE_HEAP_U32()[((argTypes + i * 4) >>> 2) >>> 0], + "parameter " + i, + ); + } + return a; + }; + function __emval_call(handle, argCount, argTypes, argv) { + handle >>>= 0; + argTypes >>>= 0; + argv >>>= 0; + handle = Emval.toValue(handle); + var types = emval_lookupTypes(argCount, argTypes); + var args = new Array(argCount); + for (var i = 0; i < argCount; ++i) { + var type = types[i]; + args[i] = type["readValueFromPointer"](argv); + argv += type["argPackAdvance"]; + } + var rv = handle.apply(undefined, args); + return Emval.toHandle(rv); + } + var emval_symbols = {}; + var getStringOrSymbol = (address) => { + var symbol = emval_symbols[address]; + if (symbol === undefined) { + return readLatin1String(address); + } + return symbol; + }; + var emval_methodCallers = []; + function __emval_call_method( + caller, + handle, + methodName, + destructorsRef, + args, + ) { + caller >>>= 0; + handle >>>= 0; + methodName >>>= 0; + destructorsRef >>>= 0; + args >>>= 0; + caller = emval_methodCallers[caller]; + handle = Emval.toValue(handle); + methodName = getStringOrSymbol(methodName); + var destructors = []; + var result = caller(handle, methodName, destructors, args); + if (destructors.length) { + GROWABLE_HEAP_U32()[(destructorsRef >>> 2) >>> 0] = + Emval.toHandle(destructors); + } + return result; + } + function __emval_equals(first, second) { + first >>>= 0; + second >>>= 0; + first = Emval.toValue(first); + second = Emval.toValue(second); + return first == second; + } + var emval_get_global = () => { + if (typeof globalThis == "object") { + return globalThis; + } + return (function () { + return Function; + })()("return this")(); + }; + function __emval_get_global(name) { + name >>>= 0; + if (name === 0) { + return Emval.toHandle(emval_get_global()); + } else { + name = getStringOrSymbol(name); + return Emval.toHandle(emval_get_global()[name]); + } + } + var emval_addMethodCaller = (caller) => { + var id = emval_methodCallers.length; + emval_methodCallers.push(caller); + return id; + }; + function __emval_get_method_caller(argCount, argTypes) { + argTypes >>>= 0; + var types = emval_lookupTypes(argCount, argTypes); + var retType = types.shift(); + argCount--; + var params = ["retType"]; + var args = [retType]; + var argsList = ""; + for (var i = 0; i < argCount; ++i) { + argsList += (i !== 0 ? ", " : "") + "arg" + i; + params.push("argType" + i); + args.push(types[i]); + } + var signatureName = + retType.name + "_$" + types.map((t) => t.name).join("_") + "$"; + var functionName = makeLegalFunctionName("methodCaller_" + signatureName); + var functionBody = + "return function " + + functionName + + "(handle, name, destructors, args) {\n"; + var offset = 0; + for (var i = 0; i < argCount; ++i) { + functionBody += + " var arg" + + i + + " = argType" + + i + + ".readValueFromPointer(args" + + (offset ? "+" + offset : "") + + ");\n"; + offset += types[i]["argPackAdvance"]; + } + functionBody += " var rv = handle[name](" + argsList + ");\n"; + for (var i = 0; i < argCount; ++i) { + if (types[i]["deleteObject"]) { + functionBody += " argType" + i + ".deleteObject(arg" + i + ");\n"; + } + } + if (!retType.isVoid) { + functionBody += " return retType.toWireType(destructors, rv);\n"; + } + functionBody += "};\n"; + params.push(functionBody); + var invokerFunction = newFunc(Function, params).apply(null, args); + return emval_addMethodCaller(invokerFunction); + } + function __emval_get_property(handle, key) { + handle >>>= 0; + key >>>= 0; + handle = Emval.toValue(handle); + key = Emval.toValue(key); + return Emval.toHandle(handle[key]); + } + function __emval_incref(handle) { + handle >>>= 0; + if (handle > 4) { + emval_handles.get(handle).refcount += 1; + } + } + function __emval_instanceof(object, constructor) { + object >>>= 0; + constructor >>>= 0; + object = Emval.toValue(object); + constructor = Emval.toValue(constructor); + return object instanceof constructor; + } + function __emval_new_array() { + return Emval.toHandle([]); + } + function __emval_new_cstring(v) { + v >>>= 0; + return Emval.toHandle(getStringOrSymbol(v)); + } + function __emval_new_object() { + return Emval.toHandle({}); + } + function __emval_run_destructors(handle) { + handle >>>= 0; + var destructors = Emval.toValue(handle); + runDestructors(destructors); + __emval_decref(handle); + } + function __emval_set_property(handle, key, value) { + handle >>>= 0; + key >>>= 0; + value >>>= 0; + handle = Emval.toValue(handle); + key = Emval.toValue(key); + value = Emval.toValue(value); + handle[key] = value; + } + function __emval_take_value(type, arg) { + type >>>= 0; + arg >>>= 0; + type = requireRegisteredType(type, "_emval_take_value"); + var v = type["readValueFromPointer"](arg); + return Emval.toHandle(v); + } + function __emval_typeof(handle) { + handle >>>= 0; + handle = Emval.toValue(handle); + return Emval.toHandle(typeof handle); + } + function __mmap_js( + len, + prot, + flags, + fd, + offset_low, + offset_high, + allocated, + addr, + ) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 21, + 1, + len, + prot, + flags, + fd, + offset_low, + offset_high, + allocated, + addr, + ); + len >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + allocated >>>= 0; + addr >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + GROWABLE_HEAP_I32()[(allocated >>> 2) >>> 0] = res.allocated; + GROWABLE_HEAP_U32()[(addr >>> 2) >>> 0] = ptr; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset_low, offset_high) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 22, + 1, + addr, + len, + prot, + flags, + fd, + offset_low, + offset_high, + ); + addr >>>= 0; + len >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + FS.munmap(stream); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var _emscripten_get_now; + _emscripten_get_now = () => performance.timeOrigin + performance.now(); + function __setitimer_js(which, timeout_ms) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(23, 1, which, timeout_ms); + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id: id, timeout_ms: timeout_ms }; + return 0; + } + var _abort = () => { + abort(""); + }; + var warnOnce = (text) => { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } + }; + var _emscripten_check_blocking_allowed = () => {}; + var _emscripten_date_now = () => Date.now(); + var _emscripten_exit_with_live_runtime = () => { + runtimeKeepalivePush(); + throw "unwind"; + }; + function _emscripten_force_exit(status) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(24, 1, status); + __emscripten_runtime_keepalive_clear(); + _exit(status); + } + var getHeapMax = () => 4294901760; + function _emscripten_get_heap_max() { + return getHeapMax(); + } + var _emscripten_num_logical_cores = () => { + if (ENVIRONMENT_IS_NODE) return require("os").cpus().length; + return navigator["hardwareConcurrency"]; + }; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = (size - b.byteLength + 65535) / 65536; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize >>>= 0; + var oldSize = GROWABLE_HEAP_U8().length; + if (requestedSize <= oldSize) { + return false; + } + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + var alignUp = (x, multiple) => + x + ((multiple - (x % multiple)) % multiple); + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignUp(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + } + var ENV = {}; + var getExecutableName = () => thisProgram || "./this.program"; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == "object" && + navigator.languages && + navigator.languages[0]) || + "C" + ).replace("-", "_") + ".UTF-8"; + var env = { + USER: "web_user", + LOGNAME: "web_user", + PATH: "/", + PWD: "/", + HOME: "/home/web_user", + LANG: lang, + _: getExecutableName(), + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + GROWABLE_HEAP_I8()[(buffer++ >>> 0) >>> 0] = str.charCodeAt(i); + } + GROWABLE_HEAP_I8()[(buffer >>> 0) >>> 0] = 0; + }; + var _environ_get = function (__environ, environ_buf) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(25, 1, __environ, environ_buf); + __environ >>>= 0; + environ_buf >>>= 0; + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + GROWABLE_HEAP_U32()[((__environ + i * 4) >>> 2) >>> 0] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + var _environ_sizes_get = function (penviron_count, penviron_buf_size) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(26, 1, penviron_count, penviron_buf_size); + penviron_count >>>= 0; + penviron_buf_size >>>= 0; + var strings = getEnvStrings(); + GROWABLE_HEAP_U32()[(penviron_count >>> 2) >>> 0] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + GROWABLE_HEAP_U32()[(penviron_buf_size >>> 2) >>> 0] = bufSize; + return 0; + }; + function _fd_close(fd) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(27, 1, fd); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_fdstat_get(fd, pbuf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(28, 1, fd, pbuf); + pbuf >>>= 0; + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + GROWABLE_HEAP_I8()[(pbuf >>> 0) >>> 0] = type; + GROWABLE_HEAP_I16()[((pbuf + 2) >>> 1) >>> 0] = flags; + (tempI64 = [ + rightsBase >>> 0, + ((tempDouble = rightsBase), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((pbuf + 8) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((pbuf + 12) >>> 2) >>> 0] = tempI64[1]); + (tempI64 = [ + rightsInheriting >>> 0, + ((tempDouble = rightsInheriting), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((pbuf + 16) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((pbuf + 20) >>> 2) >>> 0] = tempI64[1]); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = GROWABLE_HEAP_U32()[(iov >>> 2) >>> 0]; + var len = GROWABLE_HEAP_U32()[((iov + 4) >>> 2) >>> 0]; + iov += 8; + var curr = FS.read(stream, GROWABLE_HEAP_I8(), ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset !== "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 29, + 1, + fd, + iov, + iovcnt, + offset_low, + offset_high, + pnum, + ); + iov >>>= 0; + iovcnt >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + pnum >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt, offset); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = GROWABLE_HEAP_U32()[(iov >>> 2) >>> 0]; + var len = GROWABLE_HEAP_U32()[((iov + 4) >>> 2) >>> 0]; + iov += 8; + var curr = FS.write(stream, GROWABLE_HEAP_I8(), ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (typeof offset !== "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 30, + 1, + fd, + iov, + iovcnt, + offset_low, + offset_high, + pnum, + ); + iov >>>= 0; + iovcnt >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + pnum >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt, offset); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_read(fd, iov, iovcnt, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(31, 1, fd, iov, iovcnt, pnum); + iov >>>= 0; + iovcnt >>>= 0; + pnum >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 32, + 1, + fd, + offset_low, + offset_high, + whence, + newOffset, + ); + var offset = convertI32PairToI53Checked(offset_low, offset_high); + newOffset >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + (tempI64 = [ + stream.position >>> 0, + ((tempDouble = stream.position), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[(newOffset >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((newOffset + 4) >>> 2) >>> 0] = tempI64[1]); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_write(fd, iov, iovcnt, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(33, 1, fd, iov, iovcnt, pnum); + iov >>>= 0; + iovcnt >>>= 0; + pnum >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _llvm_eh_typeid_for(type) { + type >>>= 0; + return type; + } + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + var arraySum = (array, index) => { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) {} + return sum; + }; + var MONTH_DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var MONTH_DAYS_REGULAR = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var addDays = (date, days) => { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = (leap ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR)[ + currentMonth + ]; + if (days > daysInCurrentMonth - newDate.getDate()) { + days -= daysInCurrentMonth - newDate.getDate() + 1; + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth + 1); + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear() + 1); + } + } else { + newDate.setDate(newDate.getDate() + days); + return newDate; + } + } + return newDate; + }; + var writeArrayToMemory = (array, buffer) => { + GROWABLE_HEAP_I8().set(array, buffer >>> 0); + }; + function _strftime(s, maxsize, format, tm) { + s >>>= 0; + maxsize >>>= 0; + format >>>= 0; + tm >>>= 0; + var tm_zone = GROWABLE_HEAP_U32()[((tm + 40) >>> 2) >>> 0]; + var date = { + tm_sec: GROWABLE_HEAP_I32()[(tm >>> 2) >>> 0], + tm_min: GROWABLE_HEAP_I32()[((tm + 4) >>> 2) >>> 0], + tm_hour: GROWABLE_HEAP_I32()[((tm + 8) >>> 2) >>> 0], + tm_mday: GROWABLE_HEAP_I32()[((tm + 12) >>> 2) >>> 0], + tm_mon: GROWABLE_HEAP_I32()[((tm + 16) >>> 2) >>> 0], + tm_year: GROWABLE_HEAP_I32()[((tm + 20) >>> 2) >>> 0], + tm_wday: GROWABLE_HEAP_I32()[((tm + 24) >>> 2) >>> 0], + tm_yday: GROWABLE_HEAP_I32()[((tm + 28) >>> 2) >>> 0], + tm_isdst: GROWABLE_HEAP_I32()[((tm + 32) >>> 2) >>> 0], + tm_gmtoff: GROWABLE_HEAP_I32()[((tm + 36) >>> 2) >>> 0], + tm_zone: tm_zone ? UTF8ToString(tm_zone) : "", + }; + var pattern = UTF8ToString(format); + var EXPANSION_RULES_1 = { + "%c": "%a %b %d %H:%M:%S %Y", + "%D": "%m/%d/%y", + "%F": "%Y-%m-%d", + "%h": "%b", + "%r": "%I:%M:%S %p", + "%R": "%H:%M", + "%T": "%H:%M:%S", + "%x": "%m/%d/%y", + "%X": "%H:%M:%S", + "%Ec": "%c", + "%EC": "%C", + "%Ex": "%m/%d/%y", + "%EX": "%H:%M:%S", + "%Ey": "%y", + "%EY": "%Y", + "%Od": "%d", + "%Oe": "%e", + "%OH": "%H", + "%OI": "%I", + "%Om": "%m", + "%OM": "%M", + "%OS": "%S", + "%Ou": "%u", + "%OU": "%U", + "%OV": "%V", + "%Ow": "%w", + "%OW": "%W", + "%Oy": "%y", + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace( + new RegExp(rule, "g"), + EXPANSION_RULES_1[rule], + ); + } + var WEEKDAYS = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ]; + var MONTHS = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ]; + function leadingSomething(value, digits, character) { + var str = typeof value == "number" ? value.toString() : value || ""; + while (str.length < digits) { + str = character[0] + str; + } + return str; + } + function leadingNulls(value, digits) { + return leadingSomething(value, digits, "0"); + } + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + var compare; + if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) { + if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) { + compare = sgn(date1.getDate() - date2.getDate()); + } + } + return compare; + } + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: + return new Date(janFourth.getFullYear() - 1, 11, 29); + case 1: + return janFourth; + case 2: + return new Date(janFourth.getFullYear(), 0, 3); + case 3: + return new Date(janFourth.getFullYear(), 0, 2); + case 4: + return new Date(janFourth.getFullYear(), 0, 1); + case 5: + return new Date(janFourth.getFullYear() - 1, 11, 31); + case 6: + return new Date(janFourth.getFullYear() - 1, 11, 30); + } + } + function getWeekBasedYear(date) { + var thisDate = addDays( + new Date(date.tm_year + 1900, 0, 1), + date.tm_yday, + ); + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear() + 1; + } + return thisDate.getFullYear(); + } + return thisDate.getFullYear() - 1; + } + var EXPANSION_RULES_2 = { + "%a": (date) => WEEKDAYS[date.tm_wday].substring(0, 3), + "%A": (date) => WEEKDAYS[date.tm_wday], + "%b": (date) => MONTHS[date.tm_mon].substring(0, 3), + "%B": (date) => MONTHS[date.tm_mon], + "%C": (date) => { + var year = date.tm_year + 1900; + return leadingNulls((year / 100) | 0, 2); + }, + "%d": (date) => leadingNulls(date.tm_mday, 2), + "%e": (date) => leadingSomething(date.tm_mday, 2, " "), + "%g": (date) => getWeekBasedYear(date).toString().substring(2), + "%G": (date) => getWeekBasedYear(date), + "%H": (date) => leadingNulls(date.tm_hour, 2), + "%I": (date) => { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; + else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + "%j": (date) => + leadingNulls( + date.tm_mday + + arraySum( + isLeapYear(date.tm_year + 1900) + ? MONTH_DAYS_LEAP + : MONTH_DAYS_REGULAR, + date.tm_mon - 1, + ), + 3, + ), + "%m": (date) => leadingNulls(date.tm_mon + 1, 2), + "%M": (date) => leadingNulls(date.tm_min, 2), + "%n": () => "\n", + "%p": (date) => { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return "AM"; + } + return "PM"; + }, + "%S": (date) => leadingNulls(date.tm_sec, 2), + "%t": () => "\t", + "%u": (date) => date.tm_wday || 7, + "%U": (date) => { + var days = date.tm_yday + 7 - date.tm_wday; + return leadingNulls(Math.floor(days / 7), 2); + }, + "%V": (date) => { + var val = Math.floor( + (date.tm_yday + 7 - ((date.tm_wday + 6) % 7)) / 7, + ); + if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) { + val++; + } + if (!val) { + val = 52; + var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7; + if ( + dec31 == 4 || + (dec31 == 5 && isLeapYear((date.tm_year % 400) - 1)) + ) { + val++; + } + } else if (val == 53) { + var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7; + if (jan1 != 4 && (jan1 != 3 || !isLeapYear(date.tm_year))) val = 1; + } + return leadingNulls(val, 2); + }, + "%w": (date) => date.tm_wday, + "%W": (date) => { + var days = date.tm_yday + 7 - ((date.tm_wday + 6) % 7); + return leadingNulls(Math.floor(days / 7), 2); + }, + "%y": (date) => (date.tm_year + 1900).toString().substring(2), + "%Y": (date) => date.tm_year + 1900, + "%z": (date) => { + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + off = (off / 60) * 100 + (off % 60); + return (ahead ? "+" : "-") + String("0000" + off).slice(-4); + }, + "%Z": (date) => date.tm_zone, + "%%": () => "%", + }; + pattern = pattern.replace(/%%/g, "\0\0"); + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace( + new RegExp(rule, "g"), + EXPANSION_RULES_2[rule](date), + ); + } + } + pattern = pattern.replace(/\0\0/g, "%"); + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + writeArrayToMemory(bytes, s); + return bytes.length - 1; + } + function _strftime_l(s, maxsize, format, tm, loc) { + s >>>= 0; + maxsize >>>= 0; + format >>>= 0; + tm >>>= 0; + loc >>>= 0; + return _strftime(s, maxsize, format, tm); + } + PThread.init(); + var FSNode = function (parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + }; + var readMode = 292 | 73; + var writeMode = 146; + Object.defineProperties(FSNode.prototype, { + read: { + get: function () { + return (this.mode & readMode) === readMode; + }, + set: function (val) { + val ? (this.mode |= readMode) : (this.mode &= ~readMode); + }, + }, + write: { + get: function () { + return (this.mode & writeMode) === writeMode; + }, + set: function (val) { + val ? (this.mode |= writeMode) : (this.mode &= ~writeMode); + }, + }, + isFolder: { + get: function () { + return FS.isDir(this.mode); + }, + }, + isDevice: { + get: function () { + return FS.isChrdev(this.mode); + }, + }, + }); + FS.FSNode = FSNode; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["FS_createPath"] = FS.createPath; + Module["FS_createDataFile"] = FS.createDataFile; + Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + Module["FS_unlink"] = FS.unlink; + Module["FS_createLazyFile"] = FS.createLazyFile; + Module["FS_createDevice"] = FS.createDevice; + embind_init_charCodes(); + BindingError = Module["BindingError"] = class BindingError extends Error { + constructor(message) { + super(message); + this.name = "BindingError"; + } + }; + InternalError = Module["InternalError"] = class InternalError extends ( + Error + ) { + constructor(message) { + super(message); + this.name = "InternalError"; + } + }; + init_ClassHandle(); + init_embind(); + init_RegisteredPointer(); + UnboundTypeError = Module["UnboundTypeError"] = extendError( + Error, + "UnboundTypeError", + ); + handleAllocatorInit(); + init_emval(); + var proxiedFunctionTable = [ + _proc_exit, + exitOnMainThread, + pthreadCreateProxied, + ___syscall_chmod, + ___syscall_faccessat, + ___syscall_fadvise64, + ___syscall_fchmod, + ___syscall_fcntl64, + ___syscall_fstat64, + ___syscall_getcwd, + ___syscall_getdents64, + ___syscall_ioctl, + ___syscall_lstat64, + ___syscall_mkdirat, + ___syscall_newfstatat, + ___syscall_openat, + ___syscall_readlinkat, + ___syscall_renameat, + ___syscall_stat64, + ___syscall_unlinkat, + __emscripten_runtime_keepalive_clear, + __mmap_js, + __munmap_js, + __setitimer_js, + _emscripten_force_exit, + _environ_get, + _environ_sizes_get, + _fd_close, + _fd_fdstat_get, + _fd_pread, + _fd_pwrite, + _fd_read, + _fd_seek, + _fd_write, + ]; + var wasmImports = { + Qb: __asyncjs__fetch_asset, + Lc: ___call_sighandler, + r: ___cxa_begin_catch, + D: ___cxa_end_catch, + b: ___cxa_find_matching_catch_2, + l: ___cxa_find_matching_catch_3, + Na: ___cxa_find_matching_catch_4, + nb: ___cxa_get_exception_ptr, + Ua: ___cxa_rethrow, + Bc: ___cxa_rethrow_primary_exception, + y: ___cxa_throw, + Cc: ___cxa_uncaught_exceptions, + Rc: ___emscripten_init_main_thread_js, + bb: ___emscripten_thread_cleanup, + Nc: ___pthread_create_js, + f: ___resumeException, + gb: ___syscall_chmod, + $c: ___syscall_faccessat, + _b: ___syscall_fadvise64, + Xc: ___syscall_fchmod, + hb: ___syscall_fcntl64, + Wc: ___syscall_fstat64, + Sc: ___syscall_getcwd, + Kc: ___syscall_getdents64, + cd: ___syscall_ioctl, + Tc: ___syscall_lstat64, + Pc: ___syscall_mkdirat, + Uc: ___syscall_newfstatat, + eb: ___syscall_openat, + Jc: ___syscall_readlinkat, + Ic: ___syscall_renameat, + Vc: ___syscall_stat64, + Ec: ___syscall_unlinkat, + cc: __embind_register_bigint, + gd: __embind_register_bool, + H: __embind_register_class, + da: __embind_register_class_class_function, + wa: __embind_register_class_class_property, + N: __embind_register_class_constructor, + z: __embind_register_class_function, + x: __embind_register_class_property, + fd: __embind_register_emval, + sb: __embind_register_enum, + Ea: __embind_register_enum_value, + jb: __embind_register_float, + ld: __embind_register_function, + oa: __embind_register_integer, + T: __embind_register_memory_view, + qa: __embind_register_smart_ptr, + ib: __embind_register_std_string, + Wa: __embind_register_std_wstring, + hd: __embind_register_void, + _c: __emscripten_get_now_is_monotonic, + Fc: __emscripten_notify_mailbox_postmessage, + Oc: __emscripten_receive_on_main_thread_js, + Mc: __emscripten_runtime_keepalive_clear, + Qc: __emscripten_thread_mailbox_await, + Zc: __emscripten_thread_set_strongref, + ra: __emval_as, + lc: __emval_as_int64, + kc: __emval_as_uint64, + Ha: __emval_call, + la: __emval_call_method, + yd: __emval_decref, + kd: __emval_equals, + od: __emval_get_global, + ka: __emval_get_method_caller, + Ad: __emval_get_property, + $a: __emval_incref, + pd: __emval_instanceof, + Ub: __emval_new_array, + Rb: __emval_new_cstring, + Tb: __emval_new_object, + Vb: __emval_run_destructors, + Sb: __emval_set_property, + F: __emval_take_value, + qd: __emval_typeof, + $b: __mmap_js, + ac: __munmap_js, + ab: __setitimer_js, + fa: _abort, + Pb: addToLoadedFiles, + rd: downloadJS, + cb: _emscripten_check_blocking_allowed, + fb: _emscripten_date_now, + Yc: _emscripten_exit_with_live_runtime, + tb: _emscripten_force_exit, + Gc: _emscripten_get_heap_max, + ba: _emscripten_get_now, + Hc: _emscripten_num_logical_cores, + Dc: _emscripten_resize_heap, + dd: _environ_get, + ed: _environ_sizes_get, + xa: _exit, + Ia: _fd_close, + db: _fd_fdstat_get, + Zb: _fd_pread, + Yb: _fd_pwrite, + bd: _fd_read, + bc: _fd_seek, + Va: _fd_write, + ub: invoke_dddd, + jd: invoke_ddiiiii, + s: invoke_di, + P: invoke_did, + nd: invoke_didii, + pa: invoke_dif, + Ta: invoke_dii, + sa: invoke_diii, + mc: invoke_dj, + Aa: invoke_fi, + Kb: invoke_fid, + Gb: invoke_fif, + mb: invoke_fii, + Sa: invoke_fiii, + xd: invoke_fiiid, + k: invoke_i, + Ab: invoke_idddii, + Bb: invoke_idddiii, + La: invoke_iddii, + Ma: invoke_iddiii, + zb: invoke_idi, + Fa: invoke_idii, + ob: invoke_idiiiiii, + Ja: invoke_idiiiiiii, + Eb: invoke_ifii, + c: invoke_ii, + Q: invoke_iid, + J: invoke_iidd, + _a: invoke_iiddddddiiii, + xb: invoke_iidi, + na: invoke_iidii, + aa: invoke_iidiii, + vd: invoke_iidiiii, + Za: invoke_iidiiiii, + M: invoke_iif, + ta: invoke_iiffi, + id: invoke_iifi, + e: invoke_iii, + q: invoke_iiid, + sd: invoke_iiidd, + ma: invoke_iiidddii, + td: invoke_iiiddi, + zd: invoke_iiiddii, + ca: invoke_iiidi, + w: invoke_iiidii, + vb: invoke_iiidiiidiiiidiif, + wb: invoke_iiidiiiii, + ya: invoke_iiiff, + Ra: invoke_iiifi, + h: invoke_iiii, + R: invoke_iiiid, + I: invoke_iiiiddd, + wd: invoke_iiiidii, + ua: invoke_iiiidiii, + md: invoke_iiiidiiii, + yb: invoke_iiiidiiiiii, + Hb: invoke_iiiifffffiiff, + m: invoke_iiiii, + L: invoke_iiiiid, + Ca: invoke_iiiiidiiii, + o: invoke_iiiiii, + Pa: invoke_iiiiiid, + B: invoke_iiiiiii, + rb: invoke_iiiiiiidddi, + C: invoke_iiiiiiii, + ud: invoke_iiiiiiiidi, + A: invoke_iiiiiiiii, + va: invoke_iiiiiiiiii, + kb: invoke_iiiiiiiiiii, + Da: invoke_iiiiiiiiiiii, + za: invoke_iiiiiiiiiiiii, + Oa: invoke_iiiiiiiiiiiiii, + Cb: invoke_iiiiiiiiiiiiiiiiiiii, + Xb: invoke_iiiiij, + dc: invoke_iiiij, + ec: invoke_iiiijii, + gc: invoke_iiiijjii, + sc: invoke_iiijj, + rc: invoke_iiijji, + jc: invoke_iij, + zc: invoke_j, + wc: invoke_ji, + pc: invoke_jii, + yc: invoke_jiii, + Wb: invoke_jiiii, + xc: invoke_jiij, + p: invoke_v, + Z: invoke_vd, + pb: invoke_vdiii, + Fb: invoke_vfiiii, + j: invoke_vi, + _: invoke_vid, + Mb: invoke_vidddi, + Jb: invoke_viddi, + Qa: invoke_vidi, + ea: invoke_vidii, + Ka: invoke_vidiii, + qb: invoke_vidiiii, + U: invoke_vif, + V: invoke_vifii, + d: invoke_vii, + W: invoke_viid, + Lb: invoke_viiddddi, + Nb: invoke_viiddi, + ja: invoke_viidi, + Xa: invoke_viidii, + t: invoke_viif, + g: invoke_viii, + Y: invoke_viiid, + Ob: invoke_viiiddddi, + O: invoke_viiidi, + ha: invoke_viiidii, + Ba: invoke_viiidiiiii, + Db: invoke_viiif, + i: invoke_viiii, + E: invoke_viiiid, + ia: invoke_viiiidi, + Ya: invoke_viiiidiiiiii, + n: invoke_viiiii, + S: invoke_viiiiid, + X: invoke_viiiiidi, + v: invoke_viiiiii, + G: invoke_viiiiiii, + Ib: invoke_viiiiiiid, + K: invoke_viiiiiiii, + $: invoke_viiiiiiiii, + ga: invoke_viiiiiiiiii, + lb: invoke_viiiiiiiiiiiii, + Ga: invoke_viiiiiiiiiiiiiii, + ic: invoke_viiiijii, + fc: invoke_viiijii, + hc: invoke_viiijjii, + vc: invoke_viij, + nc: invoke_viiji, + qc: invoke_vij, + uc: invoke_viji, + tc: invoke_vijii, + oc: invoke_vijji, + u: _llvm_eh_typeid_for, + a: wasmMemory || Module["wasmMemory"], + ad: _proc_exit, + Ac: _strftime_l, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports["Bd"])(); + var _pthread_self = (Module["_pthread_self"] = () => + (_pthread_self = Module["_pthread_self"] = wasmExports["Cd"])()); + var ___cxa_free_exception = (a0) => + (___cxa_free_exception = wasmExports["__cxa_free_exception"])(a0); + var _free = (a0) => (_free = wasmExports["Ed"])(a0); + var _malloc = (a0) => (_malloc = wasmExports["Fd"])(a0); + var ___errno_location = () => (___errno_location = wasmExports["Gd"])(); + var __emscripten_tls_init = (Module["__emscripten_tls_init"] = () => + (__emscripten_tls_init = Module["__emscripten_tls_init"] = + wasmExports["Hd"])()); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = wasmExports["Id"])(a0, a1); + var ___getTypeName = (a0) => (___getTypeName = wasmExports["Jd"])(a0); + var __embind_initialize_bindings = (Module["__embind_initialize_bindings"] = + () => + (__embind_initialize_bindings = Module["__embind_initialize_bindings"] = + wasmExports["Kd"])()); + var __emscripten_thread_init = (Module["__emscripten_thread_init"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (__emscripten_thread_init = Module["__emscripten_thread_init"] = + wasmExports["Ld"])(a0, a1, a2, a3, a4, a5)); + var __emscripten_thread_crashed = (Module["__emscripten_thread_crashed"] = + () => + (__emscripten_thread_crashed = Module["__emscripten_thread_crashed"] = + wasmExports["Md"])()); + var _emscripten_main_thread_process_queued_calls = () => + (_emscripten_main_thread_process_queued_calls = + wasmExports["emscripten_main_thread_process_queued_calls"])(); + var _emscripten_main_runtime_thread_id = () => + (_emscripten_main_runtime_thread_id = + wasmExports["emscripten_main_runtime_thread_id"])(); + var __emscripten_run_on_main_thread_js = (a0, a1, a2, a3) => + (__emscripten_run_on_main_thread_js = wasmExports["Nd"])(a0, a1, a2, a3); + var __emscripten_thread_free_data = (a0) => + (__emscripten_thread_free_data = wasmExports["Od"])(a0); + var __emscripten_thread_exit = (Module["__emscripten_thread_exit"] = (a0) => + (__emscripten_thread_exit = Module["__emscripten_thread_exit"] = + wasmExports["Pd"])(a0)); + var __emscripten_timeout = (a0, a1) => + (__emscripten_timeout = wasmExports["Qd"])(a0, a1); + var __emscripten_check_mailbox = (Module["__emscripten_check_mailbox"] = + () => + (__emscripten_check_mailbox = Module["__emscripten_check_mailbox"] = + wasmExports["Rd"])()); + var _setThrew = (a0, a1) => (_setThrew = wasmExports["Sd"])(a0, a1); + var setTempRet0 = (a0) => (setTempRet0 = wasmExports["Td"])(a0); + var _emscripten_stack_set_limits = (a0, a1) => + (_emscripten_stack_set_limits = wasmExports["Ud"])(a0, a1); + var stackSave = () => (stackSave = wasmExports["Vd"])(); + var stackRestore = (a0) => (stackRestore = wasmExports["Wd"])(a0); + var stackAlloc = (a0) => (stackAlloc = wasmExports["Xd"])(a0); + var ___cxa_decrement_exception_refcount = (a0) => + (___cxa_decrement_exception_refcount = wasmExports["Yd"])(a0); + var ___cxa_increment_exception_refcount = (a0) => + (___cxa_increment_exception_refcount = wasmExports["Zd"])(a0); + var ___cxa_can_catch = (a0, a1, a2) => + (___cxa_can_catch = wasmExports["_d"])(a0, a1, a2); + var ___cxa_is_pointer_type = (a0) => + (___cxa_is_pointer_type = wasmExports["$d"])(a0); + var dynCall_iii = (Module["dynCall_iii"] = (a0, a1, a2) => + (dynCall_iii = Module["dynCall_iii"] = wasmExports["ae"])(a0, a1, a2)); + var dynCall_iiii = (Module["dynCall_iiii"] = (a0, a1, a2, a3) => + (dynCall_iiii = Module["dynCall_iiii"] = wasmExports["be"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vi = (Module["dynCall_vi"] = (a0, a1) => + (dynCall_vi = Module["dynCall_vi"] = wasmExports["ce"])(a0, a1)); + var dynCall_ii = (Module["dynCall_ii"] = (a0, a1) => + (dynCall_ii = Module["dynCall_ii"] = wasmExports["de"])(a0, a1)); + var dynCall_iiiiii = (Module["dynCall_iiiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiiii = Module["dynCall_iiiiii"] = wasmExports["ee"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vii = (Module["dynCall_vii"] = (a0, a1, a2) => + (dynCall_vii = Module["dynCall_vii"] = wasmExports["fe"])(a0, a1, a2)); + var dynCall_i = (Module["dynCall_i"] = (a0) => + (dynCall_i = Module["dynCall_i"] = wasmExports["ge"])(a0)); + var dynCall_viiiii = (Module["dynCall_viiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiiii = Module["dynCall_viiiii"] = wasmExports["he"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_v = (Module["dynCall_v"] = (a0) => + (dynCall_v = Module["dynCall_v"] = wasmExports["ie"])(a0)); + var dynCall_viii = (Module["dynCall_viii"] = (a0, a1, a2, a3) => + (dynCall_viii = Module["dynCall_viii"] = wasmExports["je"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vid = (Module["dynCall_vid"] = (a0, a1, a2) => + (dynCall_vid = Module["dynCall_vid"] = wasmExports["ke"])(a0, a1, a2)); + var dynCall_di = (Module["dynCall_di"] = (a0, a1) => + (dynCall_di = Module["dynCall_di"] = wasmExports["le"])(a0, a1)); + var dynCall_iiiii = (Module["dynCall_iiiii"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiii = Module["dynCall_iiiii"] = wasmExports["me"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiii = (Module["dynCall_viiii"] = (a0, a1, a2, a3, a4) => + (dynCall_viiii = Module["dynCall_viiii"] = wasmExports["ne"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viid = (Module["dynCall_viid"] = (a0, a1, a2, a3) => + (dynCall_viid = Module["dynCall_viid"] = wasmExports["oe"])( + a0, + a1, + a2, + a3, + )); + var dynCall_dii = (Module["dynCall_dii"] = (a0, a1, a2) => + (dynCall_dii = Module["dynCall_dii"] = wasmExports["pe"])(a0, a1, a2)); + var dynCall_viiid = (Module["dynCall_viiid"] = (a0, a1, a2, a3, a4) => + (dynCall_viiid = Module["dynCall_viiid"] = wasmExports["qe"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiid = (Module["dynCall_iiiid"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiid = Module["dynCall_iiiid"] = wasmExports["re"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiii = (Module["dynCall_iiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiiiiii = Module["dynCall_iiiiiiii"] = wasmExports["se"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiiii = (Module["dynCall_viiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiiii = Module["dynCall_viiiiii"] = wasmExports["te"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiiiii = (Module["dynCall_iiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiiii = Module["dynCall_iiiiiii"] = wasmExports["ue"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_diii = (Module["dynCall_diii"] = (a0, a1, a2, a3) => + (dynCall_diii = Module["dynCall_diii"] = wasmExports["ve"])( + a0, + a1, + a2, + a3, + )); + var dynCall_j = (Module["dynCall_j"] = (a0) => + (dynCall_j = Module["dynCall_j"] = wasmExports["we"])(a0)); + var dynCall_iiid = (Module["dynCall_iiid"] = (a0, a1, a2, a3) => + (dynCall_iiid = Module["dynCall_iiid"] = wasmExports["xe"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiiid = (Module["dynCall_iiiiid"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiiid = Module["dynCall_iiiiid"] = wasmExports["ye"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vd = (Module["dynCall_vd"] = (a0, a1) => + (dynCall_vd = Module["dynCall_vd"] = wasmExports["ze"])(a0, a1)); + var dynCall_iiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_iiiiiiiiiiii = Module["dynCall_iiiiiiiiiiii"] = + wasmExports["Ae"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iid = (Module["dynCall_iid"] = (a0, a1, a2) => + (dynCall_iid = Module["dynCall_iid"] = wasmExports["Be"])(a0, a1, a2)); + var dynCall_viidi = (Module["dynCall_viidi"] = (a0, a1, a2, a3, a4) => + (dynCall_viidi = Module["dynCall_viidi"] = wasmExports["Ce"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iidiii = (Module["dynCall_iidiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iidiii = Module["dynCall_iidiii"] = wasmExports["De"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiiiiiii = (Module["dynCall_iiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiiiiiii = Module["dynCall_iiiiiiiii"] = wasmExports["Ee"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiiiiiiii = (Module["dynCall_iiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiiiiii = Module["dynCall_iiiiiiiiii"] = wasmExports["Fe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiidi = (Module["dynCall_iiidi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiidi = Module["dynCall_iiidi"] = wasmExports["Ge"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fiii = (Module["dynCall_fiii"] = (a0, a1, a2, a3) => + (dynCall_fiii = Module["dynCall_fiii"] = wasmExports["He"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiifi = (Module["dynCall_iiifi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiifi = Module["dynCall_iiifi"] = wasmExports["Ie"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viif = (Module["dynCall_viif"] = (a0, a1, a2, a3) => + (dynCall_viif = Module["dynCall_viif"] = wasmExports["Je"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiffi = (Module["dynCall_iiffi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiffi = Module["dynCall_iiffi"] = wasmExports["Ke"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fif = (Module["dynCall_fif"] = (a0, a1, a2) => + (dynCall_fif = Module["dynCall_fif"] = wasmExports["Le"])(a0, a1, a2)); + var dynCall_iif = (Module["dynCall_iif"] = (a0, a1, a2) => + (dynCall_iif = Module["dynCall_iif"] = wasmExports["Me"])(a0, a1, a2)); + var dynCall_dif = (Module["dynCall_dif"] = (a0, a1, a2) => + (dynCall_dif = Module["dynCall_dif"] = wasmExports["Ne"])(a0, a1, a2)); + var dynCall_viiiiiii = (Module["dynCall_viiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiiiiii = Module["dynCall_viiiiiii"] = wasmExports["Oe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiiiiii = (Module["dynCall_viiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiiiiii = Module["dynCall_viiiiiiii"] = wasmExports["Pe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iidii = (Module["dynCall_iidii"] = (a0, a1, a2, a3, a4) => + (dynCall_iidii = Module["dynCall_iidii"] = wasmExports["Qe"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiidiiiii = (Module["dynCall_viiidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiidiiiii = Module["dynCall_viiidiiiii"] = wasmExports["Re"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiiidi = (Module["dynCall_viiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiidi = Module["dynCall_viiiidi"] = wasmExports["Se"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiidii = (Module["dynCall_viiidii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiidii = Module["dynCall_viiidii"] = wasmExports["Te"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiiid = (Module["dynCall_viiiid"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiiid = Module["dynCall_viiiid"] = wasmExports["Ue"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiidiii = (Module["dynCall_iiiidiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiidiii = Module["dynCall_iiiidiii"] = wasmExports["Ve"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iiiiidiiii = (Module["dynCall_iiiiidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiidiiii = Module["dynCall_iiiiidiiii"] = wasmExports["We"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiiiid = (Module["dynCall_viiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiiid = Module["dynCall_viiiiid"] = wasmExports["Xe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiiiidi = (Module["dynCall_viiiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiiiidi = Module["dynCall_viiiiidi"] = wasmExports["Ye"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiddddi = (Module["dynCall_viiiddddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiddddi = Module["dynCall_viiiddddi"] = wasmExports["Ze"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiddi = (Module["dynCall_viiddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiddi = Module["dynCall_viiddi"] = wasmExports["_e"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vidddi = (Module["dynCall_vidddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vidddi = Module["dynCall_vidddi"] = wasmExports["$e"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viiddddi = (Module["dynCall_viiddddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiddddi = Module["dynCall_viiddddi"] = wasmExports["af"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_fid = (Module["dynCall_fid"] = (a0, a1, a2) => + (dynCall_fid = Module["dynCall_fid"] = wasmExports["bf"])(a0, a1, a2)); + var dynCall_iiiiiid = (Module["dynCall_iiiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiiid = Module["dynCall_iiiiiid"] = wasmExports["cf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vif = (Module["dynCall_vif"] = (a0, a1, a2) => + (dynCall_vif = Module["dynCall_vif"] = wasmExports["df"])(a0, a1, a2)); + var dynCall_viiidi = (Module["dynCall_viiidi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiidi = Module["dynCall_viiidi"] = wasmExports["ef"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viddi = (Module["dynCall_viddi"] = (a0, a1, a2, a3, a4) => + (dynCall_viddi = Module["dynCall_viddi"] = wasmExports["ff"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiid = (Module["dynCall_viiiiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiiiiid = Module["dynCall_viiiiiiid"] = wasmExports["gf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_jiij = (Module["dynCall_jiij"] = (a0, a1, a2, a3, a4) => + (dynCall_jiij = Module["dynCall_jiij"] = wasmExports["hf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_ji = (Module["dynCall_ji"] = (a0, a1) => + (dynCall_ji = Module["dynCall_ji"] = wasmExports["jf"])(a0, a1)); + var dynCall_iiiifffffiiff = (Module["dynCall_iiiifffffiiff"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) => + (dynCall_iiiifffffiiff = Module["dynCall_iiiifffffiiff"] = + wasmExports["kf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + )); + var dynCall_jif = (Module["dynCall_jif"] = (a0, a1, a2) => + (dynCall_jif = Module["dynCall_jif"] = wasmExports["lf"])(a0, a1, a2)); + var dynCall_vifii = (Module["dynCall_vifii"] = (a0, a1, a2, a3, a4) => + (dynCall_vifii = Module["dynCall_vifii"] = wasmExports["mf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vfiiii = (Module["dynCall_vfiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vfiiii = Module["dynCall_vfiiii"] = wasmExports["nf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_ifii = (Module["dynCall_ifii"] = (a0, a1, a2, a3) => + (dynCall_ifii = Module["dynCall_ifii"] = wasmExports["of"])( + a0, + a1, + a2, + a3, + )); + var dynCall_jiiijji = (Module["dynCall_jiiijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_jiiijji = Module["dynCall_jiiijji"] = wasmExports["pf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiif = (Module["dynCall_viiif"] = (a0, a1, a2, a3, a4) => + (dynCall_viiif = Module["dynCall_viiif"] = wasmExports["qf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiiiiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiiiiiiiiii"] = + ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ) => + (dynCall_iiiiiiiiiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiiiiiiiiii"] = + wasmExports["rf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + )); + var dynCall_viiiiiiiiii = (Module["dynCall_viiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_viiiiiiiiii = Module["dynCall_viiiiiiiiii"] = wasmExports["sf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_viiiiiiiii = (Module["dynCall_viiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiiiiiiii = Module["dynCall_viiiiiiiii"] = wasmExports["tf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) => + (dynCall_iiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiii"] = + wasmExports["uf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + )); + var dynCall_ff = (Module["dynCall_ff"] = (a0, a1) => + (dynCall_ff = Module["dynCall_ff"] = wasmExports["vf"])(a0, a1)); + var dynCall_fff = (Module["dynCall_fff"] = (a0, a1, a2) => + (dynCall_fff = Module["dynCall_fff"] = wasmExports["wf"])(a0, a1, a2)); + var dynCall_iiijiii = (Module["dynCall_iiijiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiijiii = Module["dynCall_iiijiii"] = wasmExports["xf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_jii = (Module["dynCall_jii"] = (a0, a1, a2) => + (dynCall_jii = Module["dynCall_jii"] = wasmExports["yf"])(a0, a1, a2)); + var dynCall_iiij = (Module["dynCall_iiij"] = (a0, a1, a2, a3, a4) => + (dynCall_iiij = Module["dynCall_iiij"] = wasmExports["zf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiji = (Module["dynCall_iiiji"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiji = Module["dynCall_iiiji"] = wasmExports["Af"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) => + (dynCall_iiiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiiii"] = + wasmExports["Bf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + )); + var dynCall_iiddddddiiii = (Module["dynCall_iiddddddiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_iiddddddiiii = Module["dynCall_iiddddddiiii"] = + wasmExports["Cf"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iidiiiii = (Module["dynCall_iidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iidiiiii = Module["dynCall_iidiiiii"] = wasmExports["Df"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iddiii = (Module["dynCall_iddiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iddiii = Module["dynCall_iddiii"] = wasmExports["Ef"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iddii = (Module["dynCall_iddii"] = (a0, a1, a2, a3, a4) => + (dynCall_iddii = Module["dynCall_iddii"] = wasmExports["Ff"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_idddiii = (Module["dynCall_idddiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_idddiii = Module["dynCall_idddiii"] = wasmExports["Gf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_idddii = (Module["dynCall_idddii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_idddii = Module["dynCall_idddii"] = wasmExports["Hf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_idii = (Module["dynCall_idii"] = (a0, a1, a2, a3) => + (dynCall_idii = Module["dynCall_idii"] = wasmExports["If"])( + a0, + a1, + a2, + a3, + )); + var dynCall_idi = (Module["dynCall_idi"] = (a0, a1, a2) => + (dynCall_idi = Module["dynCall_idi"] = wasmExports["Jf"])(a0, a1, a2)); + var dynCall_fiiid = (Module["dynCall_fiiid"] = (a0, a1, a2, a3, a4) => + (dynCall_fiiid = Module["dynCall_fiiid"] = wasmExports["Kf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iidi = (Module["dynCall_iidi"] = (a0, a1, a2, a3) => + (dynCall_iidi = Module["dynCall_iidi"] = wasmExports["Lf"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiidii = (Module["dynCall_iiiidii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiidii = Module["dynCall_iiiidii"] = wasmExports["Mf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiidiiiiii = (Module["dynCall_iiiidiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiidiiiiii = Module["dynCall_iiiidiiiiii"] = wasmExports["Nf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_iiidiiiii = (Module["dynCall_iiidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiidiiiii = Module["dynCall_iiidiiiii"] = wasmExports["Of"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiidiiidiiiidiif = (Module["dynCall_iiidiiidiiiidiif"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) => + (dynCall_iiidiiidiiiidiif = Module["dynCall_iiidiiidiiiidiif"] = + wasmExports["Pf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + )); + var dynCall_dddd = (Module["dynCall_dddd"] = (a0, a1, a2, a3) => + (dynCall_dddd = Module["dynCall_dddd"] = wasmExports["Qf"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iidiiii = (Module["dynCall_iidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iidiiii = Module["dynCall_iidiiii"] = wasmExports["Rf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiddii = (Module["dynCall_iiiddii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiddii = Module["dynCall_iiiddii"] = wasmExports["Sf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiiiiiidi = (Module["dynCall_iiiiiiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiiiidi = Module["dynCall_iiiiiiiidi"] = wasmExports["Tf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiddi = (Module["dynCall_iiiddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiddi = Module["dynCall_iiiddi"] = wasmExports["Uf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiidd = (Module["dynCall_iiidd"] = (a0, a1, a2, a3, a4) => + (dynCall_iiidd = Module["dynCall_iiidd"] = wasmExports["Vf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiif = (Module["dynCall_iiiif"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiif = Module["dynCall_iiiif"] = wasmExports["Wf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fi = (Module["dynCall_fi"] = (a0, a1) => + (dynCall_fi = Module["dynCall_fi"] = wasmExports["Xf"])(a0, a1)); + var dynCall_did = (Module["dynCall_did"] = (a0, a1, a2) => + (dynCall_did = Module["dynCall_did"] = wasmExports["Yf"])(a0, a1, a2)); + var dynCall_iiidii = (Module["dynCall_iiidii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiidii = Module["dynCall_iiidii"] = wasmExports["Zf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiidddii = (Module["dynCall_iiidddii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiidddii = Module["dynCall_iiidddii"] = wasmExports["_f"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_didii = (Module["dynCall_didii"] = (a0, a1, a2, a3, a4) => + (dynCall_didii = Module["dynCall_didii"] = wasmExports["$f"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiidddi = (Module["dynCall_iiiiiiidddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiiiiidddi = Module["dynCall_iiiiiiidddi"] = wasmExports["ag"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_iidd = (Module["dynCall_iidd"] = (a0, a1, a2, a3) => + (dynCall_iidd = Module["dynCall_iidd"] = wasmExports["bg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_viij = (Module["dynCall_viij"] = (a0, a1, a2, a3, a4) => + (dynCall_viij = Module["dynCall_viij"] = wasmExports["cg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viji = (Module["dynCall_viji"] = (a0, a1, a2, a3, a4) => + (dynCall_viji = Module["dynCall_viji"] = wasmExports["dg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vijii = (Module["dynCall_vijii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vijii = Module["dynCall_vijii"] = wasmExports["eg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiijj = (Module["dynCall_iiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiijj = Module["dynCall_iiijj"] = wasmExports["fg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiijji = (Module["dynCall_iiijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiijji = Module["dynCall_iiijji"] = wasmExports["gg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_vij = (Module["dynCall_vij"] = (a0, a1, a2, a3) => + (dynCall_vij = Module["dynCall_vij"] = wasmExports["hg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vijji = (Module["dynCall_vijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_vijji = Module["dynCall_vijji"] = wasmExports["ig"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiji = (Module["dynCall_viiji"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiji = Module["dynCall_viiji"] = wasmExports["jg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_jiii = (Module["dynCall_jiii"] = (a0, a1, a2, a3) => + (dynCall_jiii = Module["dynCall_jiii"] = wasmExports["kg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiiddd = (Module["dynCall_iiiiddd"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiddd = Module["dynCall_iiiiddd"] = wasmExports["lg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vidii = (Module["dynCall_vidii"] = (a0, a1, a2, a3, a4) => + (dynCall_vidii = Module["dynCall_vidii"] = wasmExports["mg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vidiiii = (Module["dynCall_vidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_vidiiii = Module["dynCall_vidiiii"] = wasmExports["ng"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vidiii = (Module["dynCall_vidiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vidiii = Module["dynCall_vidiii"] = wasmExports["og"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_dj = (Module["dynCall_dj"] = (a0, a1, a2) => + (dynCall_dj = Module["dynCall_dj"] = wasmExports["pg"])(a0, a1, a2)); + var dynCall_vdiii = (Module["dynCall_vdiii"] = (a0, a1, a2, a3, a4) => + (dynCall_vdiii = Module["dynCall_vdiii"] = wasmExports["qg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_idiiiiii = (Module["dynCall_idiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_idiiiiii = Module["dynCall_idiiiiii"] = wasmExports["rg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_idiiiiiii = (Module["dynCall_idiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_idiiiiiii = Module["dynCall_idiiiiiii"] = wasmExports["sg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiidiiii = (Module["dynCall_iiiidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiidiiii = Module["dynCall_iiiidiiii"] = wasmExports["tg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiiidiiiiii = (Module["dynCall_viiiidiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_viiiidiiiiii = Module["dynCall_viiiidiiiiii"] = + wasmExports["ug"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iiiff = (Module["dynCall_iiiff"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiff = Module["dynCall_iiiff"] = wasmExports["vg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiiiiii = (Module["dynCall_viiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_viiiiiiiiiii = Module["dynCall_viiiiiiiiiii"] = + wasmExports["wg"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iij = (Module["dynCall_iij"] = (a0, a1, a2, a3) => + (dynCall_iij = Module["dynCall_iij"] = wasmExports["xg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vidi = (Module["dynCall_vidi"] = (a0, a1, a2, a3) => + (dynCall_vidi = Module["dynCall_vidi"] = wasmExports["yg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_fii = (Module["dynCall_fii"] = (a0, a1, a2) => + (dynCall_fii = Module["dynCall_fii"] = wasmExports["zg"])(a0, a1, a2)); + var dynCall_viiiiiiiiiiiii = (Module["dynCall_viiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) => + (dynCall_viiiiiiiiiiiii = Module["dynCall_viiiiiiiiiiiii"] = + wasmExports["Ag"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + )); + var dynCall_iiiiiiiiiii = (Module["dynCall_iiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiiiiiiiii = Module["dynCall_iiiiiiiiiii"] = wasmExports["Bg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_viidii = (Module["dynCall_viidii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viidii = Module["dynCall_viidii"] = wasmExports["Cg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viiiijii = (Module["dynCall_viiiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiijii = Module["dynCall_viiiijii"] = wasmExports["Dg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiijjii = (Module["dynCall_viiijjii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiijjii = Module["dynCall_viiijjii"] = wasmExports["Eg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiijjii = (Module["dynCall_iiiijjii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiijjii = Module["dynCall_iiiijjii"] = wasmExports["Fg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiijii = (Module["dynCall_viiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiijii = Module["dynCall_viiijii"] = wasmExports["Gg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iiiijii = (Module["dynCall_iiiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiijii = Module["dynCall_iiiijii"] = wasmExports["Hg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_ddiiiii = (Module["dynCall_ddiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_ddiiiii = Module["dynCall_ddiiiii"] = wasmExports["Ig"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iifi = (Module["dynCall_iifi"] = (a0, a1, a2, a3) => + (dynCall_iifi = Module["dynCall_iifi"] = wasmExports["Jg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiij = (Module["dynCall_iiiij"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiij = Module["dynCall_iiiij"] = wasmExports["Kg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_jiji = (Module["dynCall_jiji"] = (a0, a1, a2, a3, a4) => + (dynCall_jiji = Module["dynCall_jiji"] = wasmExports["Lg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiij = (Module["dynCall_iiiiij"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiij = Module["dynCall_iiiiij"] = wasmExports["Mg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viijii = (Module["dynCall_viijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viijii = Module["dynCall_viijii"] = wasmExports["Ng"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_jiiii = (Module["dynCall_jiiii"] = (a0, a1, a2, a3, a4) => + (dynCall_jiiii = Module["dynCall_jiiii"] = wasmExports["Og"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiiiiiiiiii = (Module["dynCall_viiiiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) => + (dynCall_viiiiiiiiiiiiiii = Module["dynCall_viiiiiiiiiiiiiii"] = + wasmExports["Pg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + )); + var dynCall_iiiiijj = (Module["dynCall_iiiiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiiijj = Module["dynCall_iiiiijj"] = wasmExports["Qg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiiiijj = (Module["dynCall_iiiiiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = wasmExports["Rg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _asyncify_start_unwind = (a0) => + (_asyncify_start_unwind = wasmExports["Sg"])(a0); + var _asyncify_stop_unwind = () => + (_asyncify_stop_unwind = wasmExports["Tg"])(); + var _asyncify_start_rewind = (a0) => + (_asyncify_start_rewind = wasmExports["Ug"])(a0); + var _asyncify_stop_rewind = () => + (_asyncify_stop_rewind = wasmExports["Vg"])(); + var ___start_em_js = (Module["___start_em_js"] = 3895468); + var ___stop_em_js = (Module["___stop_em_js"] = 3896792); + function invoke_iii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vi(index, a1) { + var sp = stackSave(); + try { + dynCall_vi(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ii(index, a1) { + var sp = stackSave(); + try { + return dynCall_ii(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vii(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_i(index) { + var sp = stackSave(); + try { + return dynCall_i(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viii(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_v(index) { + var sp = stackSave(); + try { + dynCall_v(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vid(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiidi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiidi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viid(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viid(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viidi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viidi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiid(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iiid(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_di(index, a1) { + var sp = stackSave(); + try { + return dynCall_di(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iid(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiid(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiiid(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vd(index, a1) { + var sp = stackSave(); + try { + dynCall_vd(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iidiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_fiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiifi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiifi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiffi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiffi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viif(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viif(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_diii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_diii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iidii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiid(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiiid(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiidi(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiidi(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiidiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiidi(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiiiidi(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiidii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiid(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiiid(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidi(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_vidi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiddddi(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiddddi(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vidddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiddddi(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiddddi(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fid(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiid(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiiid(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vif(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viddi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viddi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiid(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiiiiid(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiifffffiiff( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) { + var sp = stackSave(); + try { + return dynCall_iiiifffffiiff( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vifii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vifii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vfiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vfiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ifii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_ifii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiif(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiif(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fi(index, a1) { + var sp = stackSave(); + try { + return dynCall_fi(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiddddddiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + return dynCall_iiddddddiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iidiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiddii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiddii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iddiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iddiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iddii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iddii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idddiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_idddiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idddii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_idddii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_idii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idi(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_idi(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fiiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_fiiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidi(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iidi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiidii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidiiidiiiidiif( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) { + var sp = stackSave(); + try { + return dynCall_iiidiiidiiiidiif( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dddd(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_dddd(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iidiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiidi(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiidi(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidd(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiidd(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_did(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_did(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiidii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidddii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiidddii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_didii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_didii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiidddi( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiidddi( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidd(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iidd(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiddd(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiddd(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vidii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_vidiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vidiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vdiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vdiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_idiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_idiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + dynCall_viiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiff(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiff(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viidii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viidii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ddiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_ddiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iifi(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iifi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_j(index) { + var sp = stackSave(); + try { + return dynCall_j(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_jiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiij(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_jiij(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ji(index, a1) { + var sp = stackSave(); + try { + return dynCall_ji(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viij(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viij(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viji(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viji(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vijii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vijii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiijj(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiijj(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiijji(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiijji(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vij(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_vij(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_jii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vijji(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_vijji(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiji(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiji(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dj(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dj(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iij(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iij(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiijii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiijii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiijii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiijii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiijii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiijii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiij(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiij(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiij(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiij(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_jiiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_p = (f) => () => f() >>> 0; + var makeWrapper_pp = (f) => (a0) => f(a0) >>> 0; + var makeWrapper_ppp = (f) => (a0, a1) => f(a0, a1) >>> 0; + wasmExports["Cd"] = makeWrapper_p(wasmExports["Cd"]); + wasmExports["Fd"] = makeWrapper_pp(wasmExports["Fd"]); + wasmExports["Gd"] = makeWrapper_p(wasmExports["Gd"]); + wasmExports["Id"] = makeWrapper_ppp(wasmExports["Id"]); + wasmExports["Jd"] = makeWrapper_pp(wasmExports["Jd"]); + wasmExports["Vd"] = makeWrapper_p(wasmExports["Vd"]); + wasmExports["Xd"] = makeWrapper_pp(wasmExports["Xd"]); + return wasmExports; + } + Module["addRunDependency"] = addRunDependency; + Module["removeRunDependency"] = removeRunDependency; + Module["FS_createPath"] = FS.createPath; + Module["FS_createLazyFile"] = FS.createLazyFile; + Module["FS_createDevice"] = FS.createDevice; + Module["wasmMemory"] = wasmMemory; + Module["keepRuntimeAlive"] = keepRuntimeAlive; + Module["ExitStatus"] = ExitStatus; + Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + Module["FS_createDataFile"] = FS.createDataFile; + Module["FS_unlink"] = FS.unlink; + Module["PThread"] = PThread; + Module["FS_readdir"]=FS.readdir; + Module["FS_analyzePath"]=FS.analyzePath; + var calledRun; + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + function run() { + if (runDependencies > 0) { + return; + } + if (ENVIRONMENT_IS_PTHREAD) { + readyPromiseResolve(Module); + initRuntime(); + startWorker(Module); + return; + } + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function () { + setTimeout(function () { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + run(); + + return moduleArg.ready; + }; +})(); +if (typeof exports === "object" && typeof module === "object") + module.exports = getUsdModule; +else if (typeof define === "function" && define["amd"]) + define([], () => getUsdModule); + +globalThis["NEEDLE:USD:GET"] = getUsdModule; \ No newline at end of file diff --git a/web/threeVisualizer/assets/emHdBindings-D9OMRJgz.data b/web/threeVisualizer/assets/emHdBindings-D9OMRJgz.data new file mode 100644 index 0000000..168e611 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings-D9OMRJgz.data @@ -0,0 +1,19331 @@ +{ + "Plugins": [ + { + "Info": { + "Types": { + "ArResolver": {}, + "ArDefaultResolver": { + "bases": [ + "ArResolver" + ], + "implementsContexts": true + }, + "ArPackageResolver": {} + } + }, + "LibraryPath": "", + "Name": "ar", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +// +// Copyright 2023 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#include "{{ INCLUDE_PATH }}/{{ FILE_NAME }}.h" + +#include "pxr/imaging/hd/retainedDataSource.h" + +{%- if IMPL_SCHEMA_INCLUDES is defined -%} +{%- for t in IMPL_SCHEMA_INCLUDES %} +#include "{{ t | expand }}.h" +{%- endfor -%} +{%- endif %} + +#include "pxr/base/trace/trace.h" + +// --(BEGIN CUSTOM CODE: Includes)-- +{%- if 'Includes' in CUSTOM_CODE_IMPL %} +{{ CUSTOM_CODE_IMPL['Includes'] }} +{%- endif %} +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +TF_DEFINE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens, + {{ SCHEMA_CLASS_NAME|snake }}_TOKENS); + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +{%- if 'Schema Methods' in CUSTOM_CODE_IMPL %} +{{ CUSTOM_CODE_IMPL['Schema Methods'] }} +{%- endif %} +// --(END CUSTOM CODE: Schema Methods)-- + +{%- if GENERIC_MEMBER is defined -%} +{%- set name, type_name, opt_dict = GENERIC_MEMBER -%} +{%- if opt_dict.get('GETTER', True) %} + +TfTokenVector +{{ SCHEMA_CLASS_NAME }}::Get{{ name | capitalizeFirst }}Names() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + if (_container) { + return _container->GetNames(); + } else { + return {}; + } +} + +{{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} +{{ SCHEMA_CLASS_NAME }}::Get{{ name | capitalizeFirst }}(const TfToken &name) +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + {%- if type_name.endswith('Schema') %} + return {{type_name}}( + _GetTypedDataSource<{{ type_name | underlyingDataSource}}>(name)); + {%- else %} + return _GetTypedDataSource<{{ type_name | underlyingDataSource}}>(name); + {%- endif %} +} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endif -%} {# if GENERIC_MEMBER is defiend #} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict.get('GETTER', True) %} + +{{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} +{{ SCHEMA_CLASS_NAME }}::Get{{ name|capitalizeFirst }}() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + return {% if type_name.endswith('Schema') %}{{ type_name }}({% endif %}_GetTypedDataSource<{{type_name | underlyingDataSource}}>( + {{SCHEMA_CLASS_NAME}}Tokens->{{ name }}){% if type_name.endswith('Schema') %}){% endif %}; +} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if GENERIC_MEMBER is defined %} + +/*static*/ +HdContainerDataSourceHandle +{{SCHEMA_CLASS_NAME}}::BuildRetained( + const size_t count, + const TfToken * const names, + const HdDataSourceBaseHandle * const values) +{ + return HdRetainedContainerDataSource::New(count, names, values); +} +{%- else -%} +{%- if MEMBERS %} + +/*static*/ +HdContainerDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + const {{type_name | underlyingDataSource}}Handle &{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} +) +{ + TfToken _names[{{MEMBERS|length}}]; + HdDataSourceBaseHandle _values[{{MEMBERS|length}}]; + + size_t _count = 0; +{%- for name, type_name, opt_dict in MEMBERS %} + + if ({{name}}) { + _names[_count] = {{SCHEMA_CLASS_NAME}}Tokens->{{name}}; + _values[_count++] = {{name}}; + } +{%- endfor %} + return HdRetainedContainerDataSource::New(_count, _names, _values); +} + +{%- for name, type_name, opt_dict in MEMBERS %} + +{{ SCHEMA_CLASS_NAME }}::Builder & +{{ SCHEMA_CLASS_NAME }}::Builder::Set{{ name|capitalizeFirst }}( + const {{ type_name | underlyingDataSource}}Handle &{{name}}) +{ + _{{name}} = {{name}}; + return *this; +} +{%- endfor %} + +HdContainerDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::Builder::Build() +{ + return {{ SCHEMA_CLASS_NAME }}::BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + _{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} + ); +} +{%- endif -%} {# else of if MEMBERS #} +{%- endif -%} {# else of if GENERIC_MEMBER is defined #} + +{%- if SCHEMA_TOKEN is defined %} + +/*static*/ +{{ SCHEMA_CLASS_NAME }} +{{ SCHEMA_CLASS_NAME }}::GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer) +{ + return {{ SCHEMA_CLASS_NAME }}( + fromParentContainer + ? HdContainerDataSource::Cast(fromParentContainer->Get( + {{SCHEMA_CLASS_NAME}}Tokens->{{SCHEMA_TOKEN}})) + : nullptr); +} + +/*static*/ +const TfToken & +{{ SCHEMA_CLASS_NAME }}::GetSchemaToken() +{ + return {{SCHEMA_CLASS_NAME}}Tokens->{{SCHEMA_TOKEN}}; +} +{%- endif -%} + +{%- if ADD_DEFAULT_LOCATOR is defined %} + +/*static*/ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::GetDefaultLocator() +{ +{%- if LOCATOR_PREFIX is defined %} + static const HdDataSourceLocator locator = + {{ LOCATOR_PREFIX }}.Append(GetSchemaToken()); +{%- else %} + static const HdDataSourceLocator locator(GetSchemaToken()); +{%- endif %} + return locator; +} +{%- endif -%} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict['ADD_LOCATOR'] %} + +/* static */ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::Get{{ name |capitalizeFirst }}Locator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + {{SCHEMA_CLASS_NAME}}Tokens->{{name}}); + return locator; +} +{%- endif -%} {# if opt_dict['ADD_LOCATOR'] #} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if STATIC_LOCATOR_ACCESSORS is defined -%} +{%- for name, tokens in STATIC_LOCATOR_ACCESSORS %} + +/*static*/ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::Get{{name|capitalizeFirst}}Locator() +{ + static const HdDataSourceLocator locator( + {%- for t in tokens -%} + {%if t is string %}{{SCHEMA_CLASS_NAME}}Tokens->{{ t }}{% else %}{{ t[0] }}SchemaTokens->{{ t[1] }}{% endif %}{%if loop.last == False %},{% endif -%} + {%- endfor %} + ); + return locator; +} +{%- endfor -%} +{%- endif -%} {# if STATIC_LOCATOR_ACCESSORS is defined #} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS %} + +/*static*/ +HdTokenDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::Build{{typeName|capitalizeFirst}}DataSource( + const TfToken &{{typeName}}) +{ +{% for token in tokens %} + if ({{typeName}} == {{SCHEMA_CLASS_NAME}}Tokens->{{ token | tokenName }}) { + static const HdRetainedTypedSampledDataSource::Handle ds = + HdRetainedTypedSampledDataSource::New({{typeName}}); + return ds; + } +{%- endfor %} + // fallback for unknown token + return HdRetainedTypedSampledDataSource::New({{typeName}}); +} +{%- endfor -%} +{%- endif %} {# if STATIC_TOKEN_DATASOURCE_BUILDERS is defined #} + +PXR_NAMESPACE_CLOSE_SCOPE +// +// Copyright 2023 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#ifndef {{ HEADER_GUARD|snake }}_{{ FILE_NAME|snake }}_H +#define {{ HEADER_GUARD|snake }}_{{ FILE_NAME|snake }}_H + +/// \file + +#include "{{ INCLUDE_PATH }}/api.h" + +{%- if SCHEMA_INCLUDES is defined -%} +{%- for t in SCHEMA_INCLUDES %} +#include "{{ t | expand }}.h" +{%- endfor -%} +{%- endif %} + +#include "pxr/imaging/hd/schema.h" +{%- if VERSION_GUARD_CONST_GETTER %} +#include "pxr/imaging/hd/version.h" +{%- endif %} + +// --(BEGIN CUSTOM CODE: Includes)-- +{%- if 'Includes' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Includes'] }} +{%- endif %} +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +// --(BEGIN CUSTOM CODE: Declares)-- +{%- if 'Declares' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Declares'] }} +{%- endif %} +// --(END CUSTOM CODE: Declares)-- + +#define {{ SCHEMA_CLASS_NAME|snake }}_TOKENS \ + +{%- if SCHEMA_TOKEN is defined %} + ({{SCHEMA_TOKEN}}) \ +{%- endif -%} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if SCHEMA_TOKEN is not defined or name != SCHEMA_TOKEN %} + ({{name}}) \ +{%- endif -%} +{%- endfor -%} +{%- endif -%} + +{%- if EXTRA_TOKENS is defined -%} +{%- for t in EXTRA_TOKENS %} + ({{t}}) \ +{%- endfor -%} +{%- endif -%} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS -%} +{%- for token in tokens %} + ({{token}}) \ +{%- endfor -%} +{%- endfor -%} +{%- endif %} + +TF_DECLARE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens, {{ LIBRARY_API }}, + {{ SCHEMA_CLASS_NAME|snake }}_TOKENS); + +//----------------------------------------------------------------------------- + +{% if DOC is defined -%} +{{ DOC | expand | makeComment }} +{%- endif %} +class {{ SCHEMA_CLASS_NAME }} : public HdSchema +{ +public: + /// \name Schema retrieval + /// @{ + + {{ SCHEMA_CLASS_NAME }}(HdContainerDataSourceHandle container) + : HdSchema(container) {} + +{%- if SCHEMA_TOKEN is defined %} + + /// Retrieves a container data source with the schema's default name token + /// "{{ SCHEMA_TOKEN }}" from the parent container and constructs a + /// {{SCHEMA_CLASS_NAME}} instance. + /// Because the requested container data source may not exist, the result + /// should be checked with IsDefined() or a bool comparison before use. + {{ LIBRARY_API }} + static {{ SCHEMA_CLASS_NAME }} GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer); +{%- endif %} + + /// @} + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +{%- if 'Schema Methods' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Schema Methods'] }} +{%- endif %} +// --(END CUSTOM CODE: Schema Methods)-- + + /// \name Member accessor + /// @{ +{%- if GENERIC_MEMBER is defined -%} +{%- set name, type_name, opt_dict = GENERIC_MEMBER -%} +{%- if opt_dict.get('GETTER', True) %} + + {{ LIBRARY_API }} + TfTokenVector Get{{ name | capitalizeFirst }}Names() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{% endif -%} {# if VERSION_GUARD_CONST_GETTER #} + +{%- if 'DOC' in opt_dict -%} +{%- for l in (opt_dict['DOC'].split()|join(' ')|wordwrap(width=70)).split('\n') %} + /// {{l}} +{%- endfor -%} +{%- endif %} + {{ LIBRARY_API }} + {{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} Get{{ name|capitalizeFirst }}(const TfToken &name) +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{%- endif -%} {# if VERSION_GUARD_CONST_GETTER #} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endif -%} {# if GENERIC_MEMBER is defined #} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict.get('GETTER', True) %} +{% if 'DOC' in opt_dict -%} +{%- for l in (opt_dict['DOC'].split()|join(' ')|wordwrap(width=70)).split('\n') %} + /// {{l}} +{%- endfor -%} +{%- endif %} + {{ LIBRARY_API }} + {{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} Get{{ name|capitalizeFirst }}() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{%- endif -%} {# if VERSION_GUARD_CONST_GETTER #} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endfor -%} +{%- endif %} {# if MEMBERS is defined #} + + /// @} + +{%- if SCHEMA_TOKEN is defined %} + + /// \name Schema location + /// @{ + + /// Returns a token where the container representing this schema is found in + /// a container by default. + {{ LIBRARY_API }} + static const TfToken &GetSchemaToken(); + +{%- if ADD_DEFAULT_LOCATOR is defined %} + + /// Returns an HdDataSourceLocator (relative to the prim-level data source) + /// where the container representing this schema is found by default. + {{ LIBRARY_API }} + static const HdDataSourceLocator &GetDefaultLocator(); +{%- endif %} + + /// @} +{%- endif -%} + + +{%- if self.member_locators() | trim %} + + /// \name Data source locators for members + /// + /// The following methods return an HdDataSourceLocator (relative to the + /// prim-level data source) where the data source for a member can be found. + /// + /// This is often useful for checking intersection against the + /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied. + /// @{ + +{%- block member_locators -%} +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict['ADD_LOCATOR'] %} + + /// Prim-level relative data source locator to locate {{ name }}. + {{ LIBRARY_API }} + static const HdDataSourceLocator &Get{{ name |capitalizeFirst }}Locator(); +{%- endif -%} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if STATIC_LOCATOR_ACCESSORS is defined -%} +{%- for name, tokens in STATIC_LOCATOR_ACCESSORS %} + + /// Additional prim-level relative data source locator to locate + /// {{ name }}. + {{ LIBRARY_API }} + static const HdDataSourceLocator &Get{{name | capitalizeFirst}}Locator(); +{%- endfor -%} +{%- endif -%} +{%- endblock member_locators %} + /// @} +{%- endif %} {# if self.member_locators() | trim #} + + /// \name Schema construction + /// @{ + +{%- if GENERIC_MEMBER is defined %} + {{ LIBRARY_API }} + static HdContainerDataSourceHandle + BuildRetained( + size_t count, + const TfToken *names, + const HdDataSourceBaseHandle *values); +{%- else -%} +{%- if MEMBERS %} + + /// \deprecated Use Builder instead. + /// + /// Builds a container data source which includes the provided child data + /// sources. Parameters with nullptr values are excluded. This is a + /// low-level interface. For cases in which it's desired to define + /// the container with a sparse set of child fields, the Builder class + /// is often more convenient and readable. + {{ LIBRARY_API }} + static HdContainerDataSourceHandle + BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + const {{ type_name | underlyingDataSource }}Handle &{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} + ); + + /// \class {{ SCHEMA_CLASS_NAME }}::Builder + /// + /// Utility class for setting sparse sets of child data source fields to be + /// filled as arguments into BuildRetained. Because all setter methods + /// return a reference to the instance, this can be used in the "builder + /// pattern" form. + class Builder + { + public: +{%- for name, type_name, opt_dict in MEMBERS %} + {{ LIBRARY_API }} + Builder &Set{{ name|capitalizeFirst }}( + const {{ type_name | underlyingDataSource}}Handle &{{name}}); +{%- endfor %} + + /// Returns a container data source containing the members set thus far. + {{ LIBRARY_API }} + HdContainerDataSourceHandle Build(); + + private: +{%- for name, type_name, opt_dict in MEMBERS %} + {{ type_name | underlyingDataSource}}Handle _{{name}}; +{%- endfor %} + + }; +{%- endif -%} {# else of if MEMBERS #} +{%- endif -%} {# else of if GENERIC_MEMBER is defined #} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS %} + + /// Returns token data source for use as {{typeName}} value. + /// + /// The following values will be stored statically and reused for future + /// calls: +{%- for token in tokens %} + /// - {{SCHEMA_CLASS_NAME}}Tokens->{{ token | tokenName }} +{%- endfor %} + {{ LIBRARY_API }} + static HdTokenDataSourceHandle Build{{typeName|capitalizeFirst}}DataSource( + const TfToken &{{typeName}}); +{%- endfor -%} +{%- endif %} + + /// @} +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif +{ + "Plugins": [ + { + "Info": {}, + "LibraryPath": "", + "Name": "hd", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "HttpResolver": { + "bases": ["ArDefaultResolver"] + } + } + }, + "Name": "HttpResolver", + "LibraryPath": "", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "NdrDiscoveryPlugin": {}, + "_NdrFilesystemDiscoveryPlugin" : { + "bases": ["NdrDiscoveryPlugin"], + "displayName": "Filesystem Discovery" + }, + "NdrParserPlugin": {} + } + }, + "LibraryPath": "", + "Name": "ndr", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Includes": [ + "*/resources/" + ] +} +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "payloadAssetDependencies": { + "appliesTo": "prims", + "displayGroup": "Pipeline", + "type": "asset[]" + } + }, + "Types": { + "SdfFileFormat": { + "displayName": "Sdf file format base class", + "target": "sdf" + }, + "SdfTextFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "Sdf Text File Format", + "extensions": [ + "sdf" + ], + "formatId": "sdf" + } + } + }, + "LibraryPath": "", + "Name": "sdf", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +// +// Copyright 2017 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(libraryName) }}_API_H +#define {{ Upper(libraryName) }}_API_H + +#include "pxr/base/arch/export.h" + +#if defined(PXR_STATIC) +# define {{ Upper(libraryName) }}_API +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) +# define {{ Upper(libraryName) }}_LOCAL +#else +# if defined({{ Upper(libraryName) }}_EXPORTS) +# define {{ Upper(libraryName) }}_API ARCH_EXPORT +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) +# else +# define {{ Upper(libraryName) }}_API ARCH_IMPORT +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) +# endif +# define {{ Upper(libraryName) }}_LOCAL ARCH_HIDDEN +#endif + +#endif +{ + "Plugins": [ + { + "Info": { + "Types": { + } + }, + "LibraryPath": "@PLUG_INFO_LIBRARY_PATH@", + "Name": "{{ libraryName }}", + "ResourcePath": "@PLUG_INFO_RESOURCE_PATH@", + "Root": "@PLUG_INFO_ROOT@", + "Type": "library" + } + ] +} +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/{{ cls.GetHeaderFile() }}" +#include "pxr/usd/usd/schemaRegistry.h" +#include "pxr/usd/usd/typed.h" + +#include "pxr/usd/sdf/types.h" +#include "pxr/usd/sdf/assetPath.h" + +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} +#include "pxr/base/tf/staticTokens.h" + +{% endif %} +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +// Register the schema with the TfType system. +TF_REGISTRY_FUNCTION(TfType) +{ + TfType::Define<{{ cls.cppClassName }}, + TfType::Bases< {{ cls.parentCppClassName }} > >(); + +{% if cls.isConcrete %} + // Register the usd prim typename as an alias under UsdSchemaBase. This + // enables one to call + // TfType::Find().FindDerivedByName("{{ cls.usdPrimTypeName }}") + // to find TfType<{{ cls.cppClassName }}>, which is how IsA queries are + // answered. + TfType::AddAlias("{{ cls.usdPrimTypeName }}"); +{% endif %} +} + +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} +TF_DEFINE_PRIVATE_TOKENS( + _schemaTokens, + ({{ cls.propertyNamespacePrefix }}) +); + +{% endif %} +/* virtual */ +{{ cls.cppClassName }}::~{{ cls.cppClassName }}() +{ +} + +{% if not cls.isAPISchemaBase %} +/* static */ +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Get(const UsdStagePtr &stage, const SdfPath &path) +{ + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return {{ cls.cppClassName }}(); + } +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + TfToken name; + if (!Is{{ cls.usdPrimTypeName }}Path(path, &name)) { + TF_CODING_ERROR("Invalid {{ cls.propertyNamespacePrefix }} path <%s>.", path.GetText()); + return {{ cls.cppClassName }}(); + } + return {{ cls.cppClassName }}(stage->GetPrimAtPath(path.GetPrimPath()), name); +{% else %} + return {{ cls.cppClassName }}(stage->GetPrimAtPath(path)); +{% endif %} +} + +{% if cls.isMultipleApply %} +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Get(const UsdPrim &prim, const TfToken &name) +{ + return {{ cls.cppClassName }}(prim, name); +} + +/* static */ +std::vector<{{ cls.cppClassName }}> +{{ cls.cppClassName }}::GetAll(const UsdPrim &prim) +{ + std::vector<{{ cls.cppClassName }}> schemas; + + for (const auto &schemaName : + UsdAPISchemaBase::_GetMultipleApplyInstanceNames(prim, _GetStaticTfType())) { + schemas.emplace_back(prim, schemaName); + } + + return schemas; +} + +{% endif %} +{% endif %} +{% if cls.isConcrete %} +/* static */ +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Define( + const UsdStagePtr &stage, const SdfPath &path) +{ + static TfToken usdPrimTypeName("{{ cls.usdPrimTypeName }}"); + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return {{ cls.cppClassName }}(); + } + return {{ cls.cppClassName }}( + stage->DefinePrim(path, usdPrimTypeName)); +} +{% endif %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +/* static */ +bool +{{ cls.cppClassName }}::IsSchemaPropertyBaseName(const TfToken &baseName) +{ + static TfTokenVector attrsAndRels = { +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} + UsdSchemaRegistry::GetMultipleApplyNameTemplateBaseName( + {{ tokensPrefix }}Tokens->{{ attr.name }}), +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName] %} + UsdSchemaRegistry::GetMultipleApplyNameTemplateBaseName( + {{ tokensPrefix }}Tokens->{{ rel.name }}), +{% endfor %} + }; + + return find(attrsAndRels.begin(), attrsAndRels.end(), baseName) + != attrsAndRels.end(); +} + +/* static */ +bool +{{ cls.cppClassName }}::Is{{ cls.usdPrimTypeName }}Path( + const SdfPath &path, TfToken *name) +{ + if (!path.IsPropertyPath()) { + return false; + } + + std::string propertyName = path.GetName(); + TfTokenVector tokens = SdfPath::TokenizeIdentifierAsTokens(propertyName); + + // The baseName of the {{ cls.usdPrimTypename }} path can't be one of the + // schema properties. We should validate this in the creation (or apply) + // API. + TfToken baseName = *tokens.rbegin(); + if (IsSchemaPropertyBaseName(baseName)) { + return false; + } + + if (tokens.size() >= 2 + && tokens[0] == _schemaTokens->{{ cls.propertyNamespacePrefix }}) { + *name = TfToken(propertyName.substr( + _schemaTokens->{{ cls.propertyNamespacePrefix }}.GetString().size() + 1)); + return true; + } + + return false; +} +{% endif %} + +/* virtual */ +UsdSchemaKind {{ cls.cppClassName }}::_GetSchemaKind() const +{ + return {{ cls.cppClassName }}::schemaKind; +} +{% if cls.isAppliedAPISchema %} + +/* static */ +bool +{% if not cls.isMultipleApply %} +{{ cls.cppClassName }}::CanApply( + const UsdPrim &prim, std::string *whyNot) +{% else %} +{{ cls.cppClassName }}::CanApply( + const UsdPrim &prim, const TfToken &name, std::string *whyNot) +{% endif %} +{ +{% if cls.isMultipleApply %} + return prim.CanApplyAPI<{{ cls.cppClassName }}>(name, whyNot); +{% else %} + return prim.CanApplyAPI<{{ cls.cppClassName }}>(whyNot); +{% endif %} +} + +/* static */ +{{ cls.cppClassName }} +{% if not cls.isMultipleApply %} +{{ cls.cppClassName }}::Apply(const UsdPrim &prim) +{% else %} +{{ cls.cppClassName }}::Apply(const UsdPrim &prim, const TfToken &name) +{% endif %} +{ +{% if cls.isMultipleApply %} + if (prim.ApplyAPI<{{ cls.cppClassName }}>(name)) { + return {{ cls.cppClassName }}(prim, name); + } +{% else %} + if (prim.ApplyAPI<{{ cls.cppClassName }}>()) { + return {{ cls.cppClassName }}(prim); + } +{% endif %} + return {{ cls.cppClassName }}(); +} +{% endif %} + +/* static */ +const TfType & +{{ cls.cppClassName }}::_GetStaticTfType() +{ + static TfType tfType = TfType::Find<{{ cls.cppClassName }}>(); + return tfType; +} + +/* static */ +bool +{{ cls.cppClassName }}::_IsTypedSchema() +{ + static bool isTyped = _GetStaticTfType().IsA(); + return isTyped; +} + +/* virtual */ +const TfType & +{{ cls.cppClassName }}::_GetTfType() const +{ + return _GetStaticTfType(); +} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +/// Returns the property name prefixed with the correct namespace prefix, which +/// is composed of the the API's propertyNamespacePrefix metadata and the +/// instance name of the API. +static inline +TfToken +_GetNamespacedPropertyName(const TfToken instanceName, const TfToken propName) +{ + return UsdSchemaRegistry::MakeMultipleApplyNameInstance(propName, instanceName); +} +{% endif %} + +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if attr.apiName != '' %} +{% if attr.apiGet != "custom" %} +UsdAttribute +{{ cls.cppClassName }}::Get{{ Proper(attr.apiName) }}Attr() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().GetAttribute( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ attr.name }})); +{% else %} + return GetPrim().GetAttribute({{ tokensPrefix }}Tokens->{{ attr.name }}); +{% endif %} +} +{% endif %} + +UsdAttribute +{{ cls.cppClassName }}::Create{{ Proper(attr.apiName) }}Attr(VtValue const &defaultValue, bool writeSparsely) const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return UsdSchemaBase::_CreateAttr( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ attr.name }}), +{% else %} + return UsdSchemaBase::_CreateAttr({{ tokensPrefix }}Tokens->{{ attr.name }}, +{% endif %} + {{ attr.usdType }}, + /* custom = */ {{ "true" if attr.custom else "false" }}, + {{ attr.variability }}, + defaultValue, + writeSparsely); +} + +{% endif %} +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName] %} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if rel.apiName != '' %} +{% if rel.apiGet != "custom" %} +UsdRelationship +{{ cls.cppClassName }}::Get{{ Proper(rel.apiName) }}Rel() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().GetRelationship( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ rel.name }})); +{% else %} + return GetPrim().GetRelationship({{ tokensPrefix }}Tokens->{{ rel.name }}); +{% endif %} +} +{% endif %} + +UsdRelationship +{{ cls.cppClassName }}::Create{{ Proper(rel.apiName) }}Rel() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().CreateRelationship( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ rel.name }}), +{% else %} + return GetPrim().CreateRelationship({{ tokensPrefix }}Tokens->{{rel.name}}, +{% endif %} + /* custom = */ {{ "true" if rel.custom else "false" }}); +} + +{% endif %} +{% endfor %} +{% if cls.attrOrder|length > 0 %} +namespace { +static inline TfTokenVector +_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right) +{ + TfTokenVector result; + result.reserve(left.size() + right.size()); + result.insert(result.end(), left.begin(), left.end()); + result.insert(result.end(), right.begin(), right.end()); + return result; +} +} + +{% endif %} +/*static*/ +const TfTokenVector& +{{ cls.cppClassName }}::GetSchemaAttributeNames(bool includeInherited) +{ +{% if cls.attrOrder|length > 0 %} + static TfTokenVector localNames = { +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} +{% if attr.apiName != '' %} + {{ tokensPrefix }}Tokens->{{ attr.name }}, +{% endif %} +{% endfor %} + }; + static TfTokenVector allNames = + _ConcatenateAttributeNames( + {{ cls.parentCppClassName }}::GetSchemaAttributeNames(true), + localNames); +{% else %} + static TfTokenVector localNames; + static TfTokenVector allNames = + {{ cls.parentCppClassName }}::GetSchemaAttributeNames(true); +{% endif %} + + if (includeInherited) + return allNames; + else + return localNames; +} + +{% if cls.isMultipleApply %} +/*static*/ +TfTokenVector +{{ cls.cppClassName }}::GetSchemaAttributeNames( + bool includeInherited, const TfToken &instanceName) +{ + const TfTokenVector &attrNames = GetSchemaAttributeNames(includeInherited); + if (instanceName.IsEmpty()) { + return attrNames; + } + TfTokenVector result; + result.reserve(attrNames.size()); + for (const TfToken &attrName : attrNames) { + result.push_back( + UsdSchemaRegistry::MakeMultipleApplyNameInstance(attrName, instanceName)); + } + return result; +} + +{% endif %} +{% if useExportAPI %} +{{ namespaceClose }} + +{% endif %} +// ===================================================================== // +// Feel free to add custom code below this line. It will be preserved by +// the code generator. +{% if useExportAPI %} +// +// Just remember to wrap code in the appropriate delimiters: +// '{{ namespaceOpen }}', '{{ namespaceClose }}'. +{% endif %} +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(libraryName) }}_GENERATED_{{ Upper(cls.className) }}_H +#define {{ Upper(libraryName) }}_GENERATED_{{ Upper(cls.className) }}_H + +/// \file {{ libraryName }}/{{ cls.GetHeaderFile() }} + +{% if useExportAPI %} +#include "pxr/pxr.h" +#include "{{ libraryPath }}/api.h" +{% endif %} +#include "{{ cls.parentLibPath }}/{{ cls.GetParentHeaderFile() }}" +#include "pxr/usd/usd/prim.h" +#include "pxr/usd/usd/stage.h" +{% if cls.tokens -%} +#include "{{ libraryPath }}/tokens.h" +{% endif %} +{% if cls.extraIncludes -%} +{{ cls.extraIncludes }} +{% endif %} + +#include "pxr/base/vt/value.h" + +#include "pxr/base/gf/vec3d.h" +#include "pxr/base/gf/vec3f.h" +#include "pxr/base/gf/matrix4d.h" + +#include "pxr/base/tf/token.h" +#include "pxr/base/tf/type.h" + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +class SdfAssetPath; + +// -------------------------------------------------------------------------- // +// {{ Upper(cls.usdPrimTypeName) }}{{' ' * (74 - cls.usdPrimTypeName|count)}} // +// -------------------------------------------------------------------------- // + +/// \class {{ cls.cppClassName }} +/// +{% if cls.doc -%} +/// {{ cls.doc }} +{% endif %} +{% if cls.doc and hasTokenAttrs -%} +/// +{%endif%} +{% if hasTokenAttrs -%} +/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below +/// that are text/tokens, the actual token is published and defined in \ref {{ tokensPrefix }}Tokens. +/// So to set an attribute to the value "rightHanded", use {{ tokensPrefix }}Tokens->rightHanded +/// as the value. +{% endif %} +/// +class {{ cls.cppClassName }} : public {{ cls.parentCppClassName }} +{ +public: + /// Compile time constant representing what kind of schema this class is. + /// + /// \sa UsdSchemaKind + static const UsdSchemaKind schemaKind = {{cls.schemaKindEnumValue }}; + +{% if cls.isMultipleApply %} + /// Construct a {{ cls.cppClassName }} on UsdPrim \p prim with + /// name \p name . Equivalent to + /// {{ cls.cppClassName }}::Get( + /// prim.GetStage(), + /// prim.GetPath().AppendProperty( + /// "{{ cls.propertyNamespacePrefix }}:name")); + /// + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit {{ cls.cppClassName }}( + const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken()) + : {{ cls.parentCppClassName }}(prim, /*instanceName*/ name) + { } + + /// Construct a {{ cls.cppClassName }} on the prim held by \p schemaObj with + /// name \p name. Should be preferred over + /// {{ cls.cppClassName }}(schemaObj.GetPrim(), name), as it preserves + /// SchemaBase state. + explicit {{ cls.cppClassName }}( + const UsdSchemaBase& schemaObj, const TfToken &name) + : {{ cls.parentCppClassName }}(schemaObj, /*instanceName*/ name) + { } +{% else %} + /// Construct a {{ cls.cppClassName }} on UsdPrim \p prim . + /// Equivalent to {{ cls.cppClassName }}::Get(prim.GetStage(), prim.GetPath()) + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit {{ cls.cppClassName }}(const UsdPrim& prim=UsdPrim()) + : {{ cls.parentCppClassName }}(prim) + { + } + + /// Construct a {{ cls.cppClassName }} on the prim held by \p schemaObj . + /// Should be preferred over {{ cls.cppClassName }}(schemaObj.GetPrim()), + /// as it preserves SchemaBase state. + explicit {{ cls.cppClassName }}(const UsdSchemaBase& schemaObj) + : {{ cls.parentCppClassName }}(schemaObj) + { + } +{% endif %} + + /// Destructor. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + virtual ~{{ cls.cppClassName }}() {%- if cls.isAPISchemaBase %} = 0{% endif %}; + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes. Does not include attributes that + /// may be authored by custom/extended methods of the schemas involved. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static const TfTokenVector & + GetSchemaAttributeNames(bool includeInherited=true); +{% if cls.isMultipleApply %} + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes for a given instance name. Does not + /// include attributes that may be authored by custom/extended methods of + /// the schemas involved. The names returned will have the proper namespace + /// prefix. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static TfTokenVector + GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName); + + /// Returns the name of this multiple-apply schema instance + TfToken GetName() const { + return _GetInstanceName(); + } +{% endif %} +{% if not cls.isAPISchemaBase %} + + /// Return a {{ cls.cppClassName }} holding the prim adhering to this + /// schema at \p path on \p stage. If no prim exists at \p path on + /// \p stage, or if the prim at that path does not adhere to this schema, +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + /// return an invalid schema object. \p path must be of the format + /// .{{ cls.propertyNamespacePrefix }}:name . + /// + /// This is shorthand for the following: + /// + /// \code + /// TfToken name = SdfPath::StripNamespace(path.GetToken()); + /// {{ cls.cppClassName }}( + /// stage->GetPrimAtPath(path.GetPrimPath()), name); + /// \endcode +{% else %} + /// return an invalid schema object. This is shorthand for the following: + /// + /// \code + /// {{ cls.cppClassName }}(stage->GetPrimAtPath(path)); + /// \endcode +{% endif %} + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Get(const UsdStagePtr &stage, const SdfPath &path); +{% if cls.isMultipleApply %} + + /// Return a {{ cls.cppClassName }} with name \p name holding the + /// prim \p prim. Shorthand for {{ cls.cppClassName }}(prim, name); + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Get(const UsdPrim &prim, const TfToken &name); + + /// Return a vector of all named instances of {{ cls.cppClassName }} on the + /// given \p prim. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static std::vector<{{ cls.cppClassName }}> + GetAll(const UsdPrim &prim); +{% endif %} +{% endif %} + +{% if cls.isConcrete %} + /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path + /// is defined (according to UsdPrim::IsDefined()) on this stage. + /// + /// If a prim adhering to this schema at \p path is already defined on this + /// stage, return that prim. Otherwise author an \a SdfPrimSpec with + /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for + /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s + /// with \p specifier == \a SdfSpecifierDef and empty typeName at the + /// current EditTarget for any nonexistent, or existing but not \a Defined + /// ancestors. + /// + /// The given \a path must be an absolute prim path that does not contain + /// any variant selections. + /// + /// If it is impossible to author any of the necessary PrimSpecs, (for + /// example, in case \a path cannot map to the current UsdEditTarget's + /// namespace) issue an error and return an invalid \a UsdPrim. + /// + /// Note that this method may return a defined prim whose typeName does not + /// specify this schema class, in case a stronger typeName opinion overrides + /// the opinion at the current EditTarget. + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Define(const UsdStagePtr &stage, const SdfPath &path); +{% endif %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + /// Checks if the given name \p baseName is the base name of a property + /// of {{ cls.usdPrimTypeName }}. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + IsSchemaPropertyBaseName(const TfToken &baseName); + + /// Checks if the given path \p path is of an API schema of type + /// {{ cls.usdPrimTypeName }}. If so, it stores the instance name of + /// the schema in \p name and returns true. Otherwise, it returns false. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + Is{{ cls.usdPrimTypeName }}Path(const SdfPath &path, TfToken *name); +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + /// Returns true if this single-apply API schema can be applied to + /// the given \p prim. If this schema can not be a applied to the prim, + /// this returns false and, if provided, populates \p whyNot with the + /// reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + CanApply(const UsdPrim &prim, std::string *whyNot=nullptr); + + /// Applies this single-apply API schema to the given \p prim. + /// This information is stored by adding "{{ cls.primName }}" to the + /// token-valued, listOp metadata \em apiSchemas on the prim. + /// + /// \return A valid {{ cls.cppClassName }} object is returned upon success. + /// An invalid (or empty) {{ cls.cppClassName }} object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for conditions + /// resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Apply(const UsdPrim &prim); +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + /// Returns true if this multiple-apply API schema can be applied, + /// with the given instance name, \p name, to the given \p prim. If this + /// schema can not be a applied the prim, this returns false and, if + /// provided, populates \p whyNot with the reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + CanApply(const UsdPrim &prim, const TfToken &name, + std::string *whyNot=nullptr); + + /// Applies this multiple-apply API schema to the given \p prim + /// along with the given instance name, \p name. + /// + /// This information is stored by adding "{{ cls.primName }}:name" + /// to the token-valued, listOp metadata \em apiSchemas on the prim. + /// For example, if \p name is 'instance1', the token + /// '{{ cls.primName }}:instance1' is added to 'apiSchemas'. + /// + /// \return A valid {{ cls.cppClassName }} object is returned upon success. + /// An invalid (or empty) {{ cls.cppClassName }} object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for + /// conditions resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Apply(const UsdPrim &prim, const TfToken &name); +{% endif %} + +protected: + /// Returns the kind of schema this class belongs to. + /// + /// \sa UsdSchemaKind + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdSchemaKind _GetSchemaKind() const override; + +private: + // needs to invoke _GetStaticTfType. + friend class UsdSchemaRegistry; + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static const TfType &_GetStaticTfType(); + + static bool _IsTypedSchema(); + + // override SchemaBase virtuals. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + const TfType &_GetTfType() const override; + +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName]%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if attr.apiName != '' %} +public: + // --------------------------------------------------------------------- // + // {{ Upper(attr.apiName) }} + // --------------------------------------------------------------------- // + /// {{ attr.doc }} + /// +{% if attr.details %} + /// | || + /// | -- | -- | +{% for detail in attr.details %} + /// | {{ detail[0] }} | {{ detail[1] }} | +{% endfor %} +{% endif %} + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdAttribute Get{{ Proper(attr.apiName) }}Attr() const; + + /// See Get{{ Proper(attr.apiName) }}Attr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdAttribute Create{{ Proper(attr.apiName) }}Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; + +{% endif %} +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName]%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if rel.apiName != '' %} +public: + // --------------------------------------------------------------------- // + // {{ Upper(rel.apiName) }} + // --------------------------------------------------------------------- // + /// {{ rel.doc }} + /// +{% for detail in rel.details %} + /// \n {{ detail[0] }}: {{ detail[1] }} +{% endfor %} + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdRelationship Get{{ Proper(rel.apiName) }}Rel() const; + + /// See Get{{ Proper(rel.apiName) }}Rel(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdRelationship Create{{ Proper(rel.apiName) }}Rel() const; +{% endif %} + +{% endfor %} +public: + // ===================================================================== // + // Feel free to add custom code below this line, it will be preserved by + // the code generator. + // + // Just remember to: + // - Close the class declaration with }; +{% if useExportAPI %} + // - Close the namespace with {{ namespaceClose }} +{% endif %} + // - Close the include guard with #endif + // ===================================================================== // + // --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/tokens.h" + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +{{ tokensPrefix }}TokensType::{{ tokensPrefix }}TokensType() : +{% for token in tokens %} + {{ token.id }}("{{ token.value }}", TfToken::Immortal), +{% endfor %} + allTokens({ +{% for token in tokens %} + {{ token.id }}{% if not loop.last %},{% endif %} + +{% endfor %} + }) +{ +} + +TfStaticData<{{ tokensPrefix }}TokensType> {{ tokensPrefix }}Tokens; +{% if useExportAPI %} + +{{ namespaceClose }} +{% endif %} +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(tokensPrefix) }}_TOKENS_H +#define {{ Upper(tokensPrefix) }}_TOKENS_H + +/// \file {{ libraryName }}/tokens.h + +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// +// This is an automatically generated file (by usdGenSchema.py). +// Do not hand-edit! +// +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +{% if useExportAPI %} +#include "pxr/pxr.h" +#include "{{ libraryPath }}/api.h" +{% endif %} +#include "pxr/base/tf/staticData.h" +#include "pxr/base/tf/token.h" +#include + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} + +/// \class {{ tokensPrefix }}TokensType +/// +/// \link {{ tokensPrefix }}Tokens \endlink provides static, efficient +/// \link TfToken TfTokens\endlink for use in all public USD API. +/// +/// These tokens are auto-generated from the module's schema, representing +/// property names, for when you need to fetch an attribute or relationship +/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient +/// manner, and allow the compiler to verify that you spelled the name +/// correctly. +/// +/// {{ tokensPrefix }}Tokens also contains all of the \em allowedTokens values +/// declared for schema builtin attributes of 'token' scene description type. +{% if tokens %} +/// Use {{ tokensPrefix }}Tokens like so: +/// +/// \code +/// gprim.GetMyTokenValuedAttr().Set({{ tokensPrefix }}Tokens->{{ tokens[0].id }}); +/// \endcode +{% endif %} +struct {{ tokensPrefix }}TokensType { + {% if useExportAPI %}{{ Upper(libraryName) }}_API {% endif %}{{ tokensPrefix }}TokensType(); +{% for token in tokens %} + /// \brief "{{ token.value }}" + /// + /// {{ token.desc }} + const TfToken {{ token.id }}; +{% endfor %} + /// A vector of all of the tokens listed above. + const std::vector allTokens; +}; + +/// \var {{ tokensPrefix }}Tokens +/// +/// A global variable with static, efficient \link TfToken TfTokens\endlink +/// for use in all public USD API. \sa {{ tokensPrefix }}TokensType +extern{% if useExportAPI %} {{ Upper(libraryName) }}_API{% endif %} TfStaticData<{{ tokensPrefix }}TokensType> {{ tokensPrefix }}Tokens; +{% if useExportAPI %} + +{{ namespaceClose }} +{% endif %} + +#endif +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/{{ cls.GetHeaderFile() }}" +#include "pxr/usd/usd/schemaBase.h" + +#include "pxr/usd/sdf/primSpec.h" + +#include "pxr/usd/usd/pyConversions.h" +{% if cls.isAppliedAPISchema %} +#include "pxr/base/tf/pyAnnotatedBoolResult.h" +{% endif %} +#include "pxr/base/tf/pyContainerConversions.h" +#include "pxr/base/tf/pyResultConversions.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/base/tf/wrapTypeHelpers.h" + +#include + +#include + +using namespace boost::python; + +{% if useExportAPI %} +{{ namespaceUsing }} + +namespace { + +{% endif %} +#define WRAP_CUSTOM \ + template static void _CustomWrapCode(Cls &_class) + +// fwd decl. +WRAP_CUSTOM; + +{% for attrName in cls.attrOrder -%} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API if apiName is not empty string. #} +{% if attr.apiName != '' %} + +static UsdAttribute +_Create{{ Proper(attr.apiName) }}Attr({{ cls.cppClassName }} &self, + object defaultVal, bool writeSparsely) { + return self.Create{{ Proper(attr.apiName) }}Attr( + UsdPythonToSdfType(defaultVal, {{ attr.usdType }}), writeSparsely); +} +{% endif %} +{% endfor %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +static bool _WrapIs{{ cls.usdPrimTypeName }}Path(const SdfPath &path) { + TfToken collectionName; + return {{ cls.cppClassName }}::Is{{ cls.usdPrimTypeName }}Path( + path, &collectionName); +} +{% endif %} +{% if not cls.isAPISchemaBase %} + +static std::string +_Repr(const {{ cls.cppClassName }} &self) +{ + std::string primRepr = TfPyRepr(self.GetPrim()); +{% if cls.isMultipleApply %} + std::string instanceName = TfPyRepr(self.GetName()); + return TfStringPrintf( + "{{ libraryName[0]|upper }}{{ libraryName[1:] }}.{{ cls.className }}(%s, '%s')", + primRepr.c_str(), instanceName.c_str()); +{% else %} + return TfStringPrintf( + "{{ libraryName[0]|upper }}{{ libraryName[1:] }}.{{ cls.className }}(%s)", + primRepr.c_str()); +{% endif %} +} +{% endif %} +{% if cls.isAppliedAPISchema %} + +struct {{ cls.cppClassName }}_CanApplyResult : + public TfPyAnnotatedBoolResult +{ + {{ cls.cppClassName }}_CanApplyResult(bool val, std::string const &msg) : + TfPyAnnotatedBoolResult(val, msg) {} +}; + +{% if cls.isMultipleApply %} +static {{ cls.cppClassName }}_CanApplyResult +_WrapCanApply(const UsdPrim& prim, const TfToken& name) +{ + std::string whyNot; + bool result = {{ cls.cppClassName }}::CanApply(prim, name, &whyNot); + return {{ cls.cppClassName }}_CanApplyResult(result, whyNot); +} +{% else %} +static {{ cls.cppClassName }}_CanApplyResult +_WrapCanApply(const UsdPrim& prim) +{ + std::string whyNot; + bool result = {{ cls.cppClassName }}::CanApply(prim, &whyNot); + return {{ cls.cppClassName }}_CanApplyResult(result, whyNot); +} +{% endif %} +{% endif %} +{% if useExportAPI %} + +} // anonymous namespace +{% endif %} + +void wrap{{ cls.cppClassName }}() +{ + typedef {{ cls.cppClassName }} This; + +{% if cls.isAppliedAPISchema %} + {{ cls.cppClassName }}_CanApplyResult::Wrap<{{ cls.cppClassName }}_CanApplyResult>( + "_CanApplyResult", "whyNot"); + +{% endif %} +{% if cls.isAPISchemaBase %} + class_< This , bases<{{ cls.parentCppClassName }}>, boost::noncopyable> cls ("APISchemaBase", "", no_init); +{% else %} + class_ > + cls("{{ cls.className }}"); +{% endif %} + + cls +{% if not cls.isAPISchemaBase %} +{% if cls.isMultipleApply %} + .def(init((arg("prim"), arg("name")))) + .def(init((arg("schemaObj"), arg("name")))) +{% else %} + .def(init(arg("prim"))) + .def(init(arg("schemaObj"))) +{% endif %} +{% endif %} + .def(TfTypePythonClass()) + +{% if not cls.isAPISchemaBase %} +{% if cls.isMultipleApply %} + .def("Get", + ({{ cls.cppClassName }}(*)(const UsdStagePtr &stage, + const SdfPath &path)) + &This::Get, + (arg("stage"), arg("path"))) + .def("Get", + ({{ cls.cppClassName }}(*)(const UsdPrim &prim, + const TfToken &name)) + &This::Get, + (arg("prim"), arg("name"))) +{% else %} + .def("Get", &This::Get, (arg("stage"), arg("path"))) +{% endif %} + .staticmethod("Get") +{% endif %} +{% if cls.isMultipleApply %} + + .def("GetAll", + (std::vector<{{ cls.cppClassName }}>(*)(const UsdPrim &prim)) + &This::GetAll, + arg("prim"), + return_value_policy()) + .staticmethod("GetAll") +{% endif %} +{% if cls.isConcrete %} + + .def("Define", &This::Define, (arg("stage"), arg("path"))) + .staticmethod("Define") +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + .def("CanApply", &_WrapCanApply, (arg("prim"))) + .staticmethod("CanApply") +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + .def("CanApply", &_WrapCanApply, (arg("prim"), arg("name"))) + .staticmethod("CanApply") +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + .def("Apply", &This::Apply, (arg("prim"))) + .staticmethod("Apply") +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + .def("Apply", &This::Apply, (arg("prim"), arg("name"))) + .staticmethod("Apply") +{% endif %} + +{% if cls.isMultipleApply %} + .def("GetSchemaAttributeNames", + (const TfTokenVector &(*)(bool))&This::GetSchemaAttributeNames, + arg("includeInherited")=true, + return_value_policy()) + .def("GetSchemaAttributeNames", + (TfTokenVector(*)(bool, const TfToken &)) + &This::GetSchemaAttributeNames, + arg("includeInherited"), + arg("instanceName"), + return_value_policy()) +{% else %} + .def("GetSchemaAttributeNames", + &This::GetSchemaAttributeNames, + arg("includeInherited")=true, + return_value_policy()) +{% endif %} + .staticmethod("GetSchemaAttributeNames") + + .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find, + return_value_policy()) + .staticmethod("_GetStaticTfType") + + .def(!self) + +{% for attrName in cls.attrOrder -%} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API if apiName is not empty string. #} +{% if attr.apiName != '' %} + + .def("Get{{ Proper(attr.apiName) }}Attr", + &This::Get{{ Proper(attr.apiName) }}Attr) + .def("Create{{ Proper(attr.apiName) }}Attr", + &_Create{{ Proper(attr.apiName) }}Attr, + (arg("defaultValue")=object(), + arg("writeSparsely")=false)) +{% endif %} +{% endfor %} + +{% for relName in cls.relOrder -%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% set rel = cls.rels[relName] %} +{% if rel.apiName != '' %} + + .def("Get{{ Proper(rel.apiName) }}Rel", + &This::Get{{ Proper(rel.apiName) }}Rel) + .def("Create{{ Proper(rel.apiName) }}Rel", + &This::Create{{ Proper(rel.apiName) }}Rel) +{% endif %} +{% endfor %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + .def("Is{{ cls.usdPrimTypeName }}Path", _WrapIs{{ cls.usdPrimTypeName }}Path) + .staticmethod("Is{{ cls.usdPrimTypeName }}Path") +{% endif %} +{% if not cls.isAPISchemaBase %} + .def("__repr__", ::_Repr) +{% endif %} + ; + + _CustomWrapCode(cls); +} + +// ===================================================================== // +// Feel free to add custom code below this line, it will be preserved by +// the code generator. The entry point for your custom code should look +// minimally like the following: +// +// WRAP_CUSTOM { +// _class +// .def("MyCustomMethod", ...) +// ; +// } +// +// Of course any other ancillary or support code may be provided. +{% if useExportAPI %} +// +// Just remember to wrap code in the appropriate delimiters: +// 'namespace {', '}'. +// +{% endif %} +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +// GENERATED FILE. DO NOT EDIT. +#include +#include "{{ libraryPath }}/tokens.h" + +{% if useExportAPI %} +{{ namespaceUsing }} + +{% endif %} +namespace { + +// Helper to return a static token as a string. We wrap tokens as Python +// strings and for some reason simply wrapping the token using def_readonly +// bypasses to-Python conversion, leading to the error that there's no +// Python type for the C++ TfToken type. So we wrap this functor instead. +class _WrapStaticToken { +public: + _WrapStaticToken(const TfToken* token) : _token(token) { } + + std::string operator()() const + { + return _token->GetString(); + } + +private: + const TfToken* _token; +}; + +template +void +_AddToken(T& cls, const char* name, const TfToken& token) +{ + cls.add_static_property(name, + boost::python::make_function( + _WrapStaticToken(&token), + boost::python::return_value_policy< + boost::python::return_by_value>(), + boost::mpl::vector1())); +} + +} // anonymous + +void wrap{{ tokensPrefix }}Tokens() +{ + boost::python::class_<{{ tokensPrefix }}TokensType, boost::noncopyable> + cls("Tokens", boost::python::no_init); +{% for token in tokens %} + _AddToken(cls, "{{ token.id }}", {{ tokensPrefix }}Tokens->{{ token.id }}); +{% endfor %} +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "Typed" ( + doc = '''The base class for all typed schemas (those that can impart a + typeName to a UsdPrim), and therefore the base class for all + concrete, instantiable "IsA" schemas. + + UsdTyped implements a typeName-based query for its override of + UsdSchemaBase::_IsCompatible(). It provides no other behavior.''' +) +{ +} + +class "APISchemaBase" ( + doc = """The base class for all API schemas. + + An API schema provides an interface to a prim's qualities, but does not + specify a typeName for the underlying prim. The prim's qualities include + its inheritance structure, attributes, relationships etc. Since it cannot + provide a typeName, an API schema is considered to be non-concrete. + + To auto-generate an API schema using usdGenSchema, simply leave the + typeName empty and make it inherit from \"/APISchemaBase\" or from another + API schema. See UsdModelAPI, UsdClipsAPI and UsdCollectionAPI for examples. + + API schemas are classified into applied and non-applied API schemas. + The author of an API schema has to decide on the type of API schema + at the time of its creation by setting customData['apiSchemaType'] in the + schema definition (i.e. in the associated primSpec inside the schema.usda + file). UsdAPISchemaBase implements methods that are used to record the + application of an API schema on a USD prim. + + If an API schema only provides an interface to set certain core bits of + metadata (like UsdModelAPI, which sets model kind and UsdClipsAPI, which + sets clips-related metadata) OR if the API schema can apply to any type of + prim or only to a known fixed set of prim types OR if there is no use of + recording the application of the API schema, in such cases, it would be + better to make it a non-applied API schema. Examples of non-applied API + schemas include UsdModelAPI, UsdClipsAPI, UsdShadeConnectableAPI and + UsdGeomPrimvarsAPI. + + If there is a need to discover (or record) whether a prim contains or + subscribes to a given API schema, it would be advantageous to make the API + schema be \"applied\". In general, API schemas that add one or more properties + to a prim should be tagged as applied API schemas. A public Apply() method + is generated for applied API schemas by usdGenSchema. An applied API schema + must be applied to a prim via a call to the generated Apply() method, for + the schema object to evaluate to true when converted to a bool using the + explicit bool conversion operator. Examples of applied API schemas include + UsdCollectionAPI, UsdGeomModelAPI and UsdGeomMotionAPI + + \\anchor UsdAPISchemaBase_SingleVsMultipleApply + \\name Single vs. Multiple Apply API Schemas + + Applied API schemas can further be classified into single-apply and + multiple-apply API schemas. As the name suggests, a single-apply API schema + can only be applied once to a prim. A multiple-apply API schema can be + applied multiple times with different 'instanceName' values. An example of + a multiple-apply API schema is UsdCollectionAPI, where the API schema is + applied to a prim once for every collection owned by the prim. + + \\note An applied API schema can only inherit from another applied API + schema or directly from APISchemaBase. Similarly, a non-applied API schema + can only inherit from a non-applied API Schema or directly from + APISchemaBase. 'usdGenSchema' attempts to issue a warning if it detects + an incompatibility. + + \\note A multiple-apply API schema may not inherit from a single-apply API + schema and vice versa. + + \\note When the bool-conversion operator is invoked on an applied API + schema, it evaluates to true only if the application of the API schema has + been recorded on the prim via a call to the auto-generated Apply() method. + + """ +) +{ +} + +class "ModelAPI" ( + doc = """UsdModelAPI is an API schema that provides an interface to a prim's + model qualities, if it does, in fact, represent the root prim of a model. + + The first and foremost model quality is its kind, i.e. the metadata + that establishes it as a model (See KindRegistry). UsdModelAPI provides + various methods for setting and querying the prim's kind, as well as + queries (also available on UsdPrim) for asking what category of model + the prim is. See \"Kind and Model-ness\". + + UsdModelAPI also provides access to a prim's \"assetInfo\" + data. While any prim can host assetInfo, it is common that published + (referenced) assets are packaged as models, therefore it is convenient + to provide access to the one from the other. + + \\todo establish an _IsCompatible() override that returns IsModel() + \\todo GetModelInstanceName() + """ +) +{ +} + +class "CollectionAPI" ( + doc = """ This is a general purpose API schema, used to describe a + collection of heterogeneous objects within the scene. \"Objects\" here may be + prims or properties belonging to prims or other collections. It's an add-on + schema that can be applied many times to a prim with different collection + names. + + A collection allows an enumeration of a set of paths to include and a + set of paths to exclude. Whether the descendants of an included + path are members of a collection are decided by its expansion rule + (see below). If the collection excludes paths that are not descendents + of included paths, the collection implicitly includes the root path + </>. If such a collection also includes paths that are not + descendants of the excluded paths, it is considered invalid, since + the intention is ambiguous. + + All the properties authored by the schema are namespaced under + \"collection:\". The given name of the collection provides additional + namespacing for the various per-collection properties, which include the + following: + +
  • uniform token collection:collectionName:expansionRule - + specified how the paths that are included in the collection must be expanded + to determine its members. Possible values include: +
      +
    • explicitOnly - only paths in the includes rel targets and not + in the excludes rel targets belong to the collection. +
    • +
    • expandPrims - all the prims at or below the includes rel- + targets (and not under the excludes rel-targets) belong to the + collection. Any property paths included in the collection would, of + course, also be honored. This is the default behavior as it satisfies + most use cases. +
    • +
    • expandPrimsAndProperties - like expandPrims, but also + includes all properties on all matched prims. We're still not quite + sure what the use cases are for this, but you can use it to capture a + whole lot of UsdObjects very concisely. +
    • +
    +
  • +
  • bool collection:collectionName:includeRoot - boolean + attribute indicating whether the pseudo-root path </> should + be counted as one of the included target paths. The fallback is false. + This separate attribute is required because relationships cannot + directly target the root. When expansionRule is explicitOnly, this + attribute is ignored. +
  • rel collection:collectionName:includes - specifies a list + of targets that are included in the collection. This can target prims or + properties directly. A collection can insert the rules of another + collection by making its includes relationship target the + collection:{collectionName} property on the owning prim of the + collection to be included (see UsdCollectionAPI::GetCollectionAttr). + It is important to note that including another collection does not + guarantee the contents of that collection will be in the final collection; + instead, the rules are merged. This means, for example, an exclude + entry may exclude a portion of the included collection. + When a collection includes one or more collections, the order in which + targets are added to the includes relationship may become significant, if + there are conflicting opinions about the same path. Targets that are added + later are considered to be stronger than earlier targets for the same path. +
  • +
  • rel collection:collectionName:excludes - specifies a list + of targets that are excluded below the included paths in this + collection. This can target prims or properties directly, but cannot + target another collection. This is to keep the membership determining + logic simple, efficient and easier to reason about. Finally, it is invalid + for a collection to exclude paths that are not included in it. The presence + of such \"orphaned\" excluded paths will not affect the set of paths included + in the collection, but may affect the performance of querying membership of + a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects). +
  • +
  • uniform opaque collection:collectionName - opaque + attribute (meaning it can never have a value) that represents the collection + for the purpose of allowing another collection to include it. When this + property is targeted by another collection's includes relationship, + the rules of this collection will be inserted into the rules of the collection + that includes it. +
+ + Implicit inclusion + + In some scenarios it is useful to express a collection that includes + everything except certain paths. To support this, a collection + that has an exclude that is not a descendent of any include + will include the root path </>. + + Creating collections in C++ + + \\snippet examples_usd.cpp ApplyCollections + """ +) +{ + uniform opaque collection:__INSTANCE_NAME__ ( + doc = """This property represents the collection for the purpose of + allowing another collection to include it. When this property is + targeted by another collection's includes relationship, the rules + of this collection will be inserted into the rules of the collection + that includes it. + """ + ) + rel collection:__INSTANCE_NAME__:excludes ( + doc = '''Specifies a list of targets that are excluded below + the included paths in this collection. This can target prims or + properties directly, but cannot target another collection. This is to + keep the membership determining logic simple, efficient and easier to + reason about. Finally, it is invalid for a collection to exclude + paths that are not included in it. The presence of such "orphaned" + excluded paths will not affect the set of paths included in the + collection, but may affect the performance of querying membership of + a path in the collection (see + UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects).''' + ) + uniform token collection:__INSTANCE_NAME__:expansionRule = "expandPrims" ( + allowedTokens = ["explicitOnly", "expandPrims", "expandPrimsAndProperties"] + doc = """Specifies how the paths that are included in + the collection must be expanded to determine its members.""" + ) + uniform bool collection:__INSTANCE_NAME__:includeRoot ( + doc = """Boolean attribute indicating whether the pseudo-root + path </> should be counted as one of the included target + paths. The fallback is false. This separate attribute is + required because relationships cannot directly target the root.""" + ) + rel collection:__INSTANCE_NAME__:includes ( + doc = """Specifies a list of targets that are included in the collection. + This can target prims or properties directly. A collection can insert + the rules of another collection by making its includes + relationship target the collection:{collectionName} property on + the owning prim of the collection to be included""" + ) + uniform pathExpression collection:__INSTANCE_NAME__:membershipExpression ( + doc = """Specifies a path expression that determines membership in this + collection.""" + ) +} + +class "ClipsAPI" ( + doc = """ UsdClipsAPI is an API schema that provides an interface to + a prim's clip metadata. Clips are a \"value resolution\" feature that + allows one to specify a sequence of usd files (clips) to be consulted, + over time, as a source of varying overrides for the prims at and + beneath this prim in namespace. + + SetClipAssetPaths() establishes the set of clips that can be consulted. + SetClipActive() specifies the ordering of clip application over time + (clips can be repeated), while SetClipTimes() specifies time-mapping + from stage-time to clip-time for the clip active at a given stage-time, + which allows for time-dilation and repetition of clips. + Finally, SetClipPrimPath() determines the path within each clip that will + map to this prim, i.e. the location within the clip at which we will look + for opinions for this prim. + + The clip asset paths, times and active metadata can also be specified + through template clip metadata. This can be desirable when your set of + assets is very large, as the template metadata is much more concise. + SetClipTemplateAssetPath() establishes the asset identifier pattern of the + set of clips to be consulted. SetClipTemplateStride(), + SetClipTemplateEndTime(), and SetClipTemplateStartTime() specify the range + in which USD will search, based on the template. From the set of resolved + asset paths, times and active will be derived internally. + + A prim may have multiple \"clip sets\" -- named sets of clips that each + have their own values for the metadata described above. For example, + a prim might have a clip set named \"Clips_1\" that specifies some group + of clip asset paths, and another clip set named \"Clips_2\" that uses + an entirely different set of clip asset paths. These clip sets are + composed across composition arcs, so clip sets for a prim may be + defined in multiple sublayers or references, for example. Individual + metadata for a given clip set may be sparsely overridden. + + Important facts about clips: + - Within the layerstack in which clips are established, the + opinions within the clips will be weaker than any local opinions + in the layerstack, but em stronger than varying opinions coming across + references and variants. + - We will never look for metadata or default opinions in clips + when performing value resolution on the owning stage, since these + quantities must be time-invariant. + + This leads to the common structure in which we reference a model asset + on a prim, and then author clips at the same site: the asset reference + will provide the topology and unvarying data for the model, while the + clips will provide the time-sampled animation. + + For further information, see \\ref Usd_Page_ValueClips + """ +) +{ +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "apiSchemas": { + "appliesTo": "prims", + "type": "tokenlistop" + }, + "clipSets": { + "appliesTo": [ + "prims" + ], + "type": "stringlistop" + }, + "clips": { + "appliesTo": [ + "prims" + ], + "type": "dictionary" + }, + "fallbackPrimTypes": { + "appliesTo": [ + "layers" + ], + "type": "dictionary" + } + }, + "Types": { + "UsdAPISchemaBase": { + "alias": { + "UsdSchemaBase": "APISchemaBase" + }, + "autoGenerated": true, + "bases": [ + "UsdSchemaBase" + ], + "schemaKind": "abstractBase" + }, + "UsdClipsAPI": { + "alias": { + "UsdSchemaBase": "ClipsAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdCollectionAPI": { + "alias": { + "UsdSchemaBase": "CollectionAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "multipleApplyAPI" + }, + "UsdModelAPI": { + "alias": { + "UsdSchemaBase": "ModelAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdSchemaBase": { + "alias": { + "UsdSchemaBase": "SchemaBase" + }, + "schemaKind": "abstractBase" + }, + "UsdTyped": { + "alias": { + "UsdSchemaBase": "Typed" + }, + "autoGenerated": true, + "bases": [ + "UsdSchemaBase" + ], + "schemaKind": "abstractBase" + }, + "UsdUsdFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USD File Format", + "extensions": [ + "usd" + ], + "formatId": "usd", + "primary": true, + "target": "usd" + }, + "UsdUsdaFileFormat": { + "bases": [ + "SdfTextFileFormat" + ], + "displayName": "USD Text File Format", + "extensions": [ + "usda" + ], + "formatId": "usda", + "primary": true, + "target": "usd" + }, + "UsdUsdcFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USD Crate File Format", + "extensions": [ + "usdc" + ], + "formatId": "usdc", + "primary": true, + "target": "usd" + }, + "UsdUsdzFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USDZ File Format", + "extensions": [ + "usdz" + ], + "formatId": "usdz", + "primary": true, + "supportsEditing": false, + "supportsWriting": false, + "target": "usd" + }, + "Usd_UsdzResolver": { + "bases": [ + "ArPackageResolver" + ], + "extensions": [ + "usdz" + ] + } + } + }, + "LibraryPath": "", + "Name": "usd", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD primitive schemata and drives code generation." +) + +def "GLOBAL" ( + customData = { + string libraryName = "usd" + string libraryPath = "pxr/usd/usd" + # string libraryPrefix = "Usd" + # string tokensPrefix = "Usd" + dictionary libraryTokens = { + dictionary apiSchemas = { + string doc = """ + A listop metadata containing the API schemas which have + been applied to this prim, using the Apply() method on + the particular schema class. + """ + } + dictionary fallbackPrimTypes = { + string doc = """ + A dictionary metadata that maps the name of a concrete schema + prim type to an ordered list of schema prim types to use instead + if the schema prim type doesn't exist in version of USD being + used. + """ + } + } + } +) +{ +} + +class "Typed" +( + doc = """The base class for all \\em typed schemas (those that can impart a + typeName to a UsdPrim), and therefore the base class for all + concrete, instantiable "IsA" schemas. + + UsdTyped implements a typeName-based query for its override of + UsdSchemaBase::_IsCompatible(). It provides no other behavior.""" +) +{ +} + +class "APISchemaBase" +( + doc = """The base class for all \\em API schemas. + + An API schema provides an interface to a prim's qualities, but does not + specify a typeName for the underlying prim. The prim's qualities include + its inheritance structure, attributes, relationships etc. Since it cannot + provide a typeName, an API schema is considered to be non-concrete. + + To auto-generate an API schema using usdGenSchema, simply leave the + typeName empty and make it inherit from "/APISchemaBase" or from another + API schema. See UsdModelAPI, UsdClipsAPI and UsdCollectionAPI for examples. + + API schemas are classified into applied and non-applied API schemas. + The author of an API schema has to decide on the type of API schema + at the time of its creation by setting customData['apiSchemaType'] in the + schema definition (i.e. in the associated primSpec inside the schema.usda + file). UsdAPISchemaBase implements methods that are used to record the + application of an API schema on a USD prim. + + If an API schema only provides an interface to set certain core bits of + metadata (like UsdModelAPI, which sets model kind and UsdClipsAPI, which + sets clips-related metadata) OR if the API schema can apply to any type of + prim or only to a known fixed set of prim types OR if there is no use of + recording the application of the API schema, in such cases, it would be + better to make it a non-applied API schema. Examples of non-applied API + schemas include UsdModelAPI, UsdClipsAPI, UsdShadeConnectableAPI and + UsdGeomPrimvarsAPI. + + If there is a need to discover (or record) whether a prim contains or + subscribes to a given API schema, it would be advantageous to make the API + schema be "applied". In general, API schemas that add one or more properties + to a prim should be tagged as applied API schemas. A public Apply() method + is generated for applied API schemas by usdGenSchema. An applied API schema + must be applied to a prim via a call to the generated Apply() method, for + the schema object to evaluate to true when converted to a bool using the + explicit bool conversion operator. Examples of applied API schemas include + UsdCollectionAPI, UsdGeomModelAPI and UsdGeomMotionAPI + + \\anchor UsdAPISchemaBase_SingleVsMultipleApply + \\name Single vs. Multiple Apply API Schemas + + Applied API schemas can further be classified into single-apply and + multiple-apply API schemas. As the name suggests, a single-apply API schema + can only be applied once to a prim. A multiple-apply API schema can be + applied multiple times with different 'instanceName' values. An example of + a multiple-apply API schema is UsdCollectionAPI, where the API schema is + applied to a prim once for every collection owned by the prim. + + \\note An applied API schema can only inherit from another applied API + schema or directly from APISchemaBase. Similarly, a non-applied API schema + can only inherit from a non-applied API Schema or directly from + APISchemaBase. 'usdGenSchema' attempts to issue a warning if it detects + an incompatibility. + + \\note A multiple-apply API schema may not inherit from a single-apply API + schema and vice versa. + + \\note When the bool-conversion operator is invoked on an applied API + schema, it evaluates to true only if the application of the API schema has + been recorded on the prim via a call to the auto-generated Apply() method. + + """ + customData = { + string fileName = "apiSchemaBase" + } +) +{ +} + +class "ModelAPI" +( + inherits = + doc = """UsdModelAPI is an API schema that provides an interface to a prim's + model qualities, if it does, in fact, represent the root prim of a model. + + The first and foremost model quality is its \\em kind, i.e. the metadata + that establishes it as a model (See KindRegistry). UsdModelAPI provides + various methods for setting and querying the prim's kind, as well as + queries (also available on UsdPrim) for asking what category of model + the prim is. See \\ref Usd_ModelKind "Kind and Model-ness". + + UsdModelAPI also provides access to a prim's \\ref Usd_Model_AssetInfo "assetInfo" + data. While any prim \\em can host assetInfo, it is common that published + (referenced) assets are packaged as models, therefore it is convenient + to provide access to the one from the other. + + \\todo establish an _IsCompatible() override that returns IsModel() + \\todo GetModelInstanceName() + """ + customData = { + string apiSchemaType = "nonApplied" + } +) +{ +} + +class "CollectionAPI" +( + inherits = + doc = """ This is a general purpose API schema, used to describe a + collection of heterogeneous objects within the scene. "Objects" here may be + prims or properties belonging to prims or other collections. It's an add-on + schema that can be applied many times to a prim with different collection + names. + + A collection allows an enumeration of a set of paths to include and a + set of paths to exclude. Whether the descendants of an included + path are members of a collection are decided by its expansion rule + (see below). If the collection excludes paths that are not descendents + of included paths, the collection implicitly includes the root path + </>. If such a collection also includes paths that are not + descendants of the excluded paths, it is considered invalid, since + the intention is ambiguous. + + All the properties authored by the schema are namespaced under + "collection:". The given name of the collection provides additional + namespacing for the various per-collection properties, which include the + following: + +
  • uniform token collection:collectionName:expansionRule - + specified how the paths that are included in the collection must be expanded + to determine its members. Possible values include: +
      +
    • explicitOnly - only paths in the includes rel targets and not + in the excludes rel targets belong to the collection. +
    • +
    • expandPrims - all the prims at or below the includes rel- + targets (and not under the excludes rel-targets) belong to the + collection. Any property paths included in the collection would, of + course, also be honored. This is the default behavior as it satisfies + most use cases. +
    • +
    • expandPrimsAndProperties - like expandPrims, but also + includes all properties on all matched prims. We're still not quite + sure what the use cases are for this, but you can use it to capture a + whole lot of UsdObjects very concisely. +
    • +
    +
  • +
  • bool collection:collectionName:includeRoot - boolean + attribute indicating whether the pseudo-root path </> should + be counted as one of the included target paths. The fallback is false. + This separate attribute is required because relationships cannot + directly target the root. When expansionRule is explicitOnly, this + attribute is ignored. +
  • rel collection:collectionName:includes - specifies a list + of targets that are included in the collection. This can target prims or + properties directly. A collection can insert the rules of another + collection by making its includes relationship target the + collection:{collectionName} property on the owning prim of the + collection to be included (see UsdCollectionAPI::GetCollectionAttr). + It is important to note that including another collection does not + guarantee the contents of that collection will be in the final collection; + instead, the rules are merged. This means, for example, an exclude + entry may exclude a portion of the included collection. + When a collection includes one or more collections, the order in which + targets are added to the includes relationship may become significant, if + there are conflicting opinions about the same path. Targets that are added + later are considered to be stronger than earlier targets for the same path. +
  • +
  • rel collection:collectionName:excludes - specifies a list + of targets that are excluded below the included paths in this + collection. This can target prims or properties directly, but cannot + target another collection. This is to keep the membership determining + logic simple, efficient and easier to reason about. Finally, it is invalid + for a collection to exclude paths that are not included in it. The presence + of such "orphaned" excluded paths will not affect the set of paths included + in the collection, but may affect the performance of querying membership of + a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects). +
  • +
  • uniform opaque collection:collectionName - opaque + attribute (meaning it can never have a value) that represents the collection + for the purpose of allowing another collection to include it. When this + property is targeted by another collection's includes relationship, + the rules of this collection will be inserted into the rules of the collection + that includes it. +
+ + Implicit inclusion + + In some scenarios it is useful to express a collection that includes + everything except certain paths. To support this, a collection + that has an exclude that is not a descendent of any include + will include the root path </>. + + Creating collections in C++ + + \\snippet examples_usd.cpp ApplyCollections + """ + + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/collectionMembershipQuery.h" +#include "pxr/usd/usd/primFlags.h" +#include "pxr/usd/usd/tokens.h" +#include "pxr/usd/sdf/pathExpression.h" +""" + token apiSchemaType = "multipleApply" + token propertyNamespacePrefix = "collection" + dictionary schemaTokens = { + dictionary exclude = { + string doc = """ + This is the token used to exclude a path from a collection. + Although it is not a possible value for the "expansionRule" + attribute, it is used as the expansionRule for excluded paths + in UsdCollectionAPI::MembershipQuery::IsPathIncluded. + """ + } + } + } +) +{ + uniform token expansionRule = "expandPrims" ( + allowedTokens = ["explicitOnly", "expandPrims", "expandPrimsAndProperties"] + doc = """Specifies how the paths that are included in + the collection must be expanded to determine its members.""" + ) + uniform bool includeRoot ( + doc = """Boolean attribute indicating whether the pseudo-root + path </> should be counted as one of the included target + paths. The fallback is false. This separate attribute is + required because relationships cannot directly target the root.""" + ) + rel includes ( + doc = """Specifies a list of targets that are included in the collection. + This can target prims or properties directly. A collection can insert + the rules of another collection by making its includes + relationship target the collection:{collectionName} property on + the owning prim of the collection to be included""" + ) + rel excludes ( + doc = """Specifies a list of targets that are excluded below + the included paths in this collection. This can target prims or + properties directly, but cannot target another collection. This is to + keep the membership determining logic simple, efficient and easier to + reason about. Finally, it is invalid for a collection to exclude + paths that are not included in it. The presence of such "orphaned" + excluded paths will not affect the set of paths included in the + collection, but may affect the performance of querying membership of + a path in the collection (see + UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects).""" + ) + uniform pathExpression membershipExpression ( + doc = """Specifies a path expression that determines membership in this + collection.""" + ) + uniform opaque __INSTANCE_NAME__ ( + customData = { + string apiName = "Collection" + } + doc = """This property represents the collection for the purpose of + allowing another collection to include it. When this property is + targeted by another collection's includes relationship, the rules + of this collection will be inserted into the rules of the collection + that includes it. + """ + ) +} + +class "ClipsAPI" +( + inherits = + doc = """ UsdClipsAPI is an API schema that provides an interface to + a prim's clip metadata. Clips are a "value resolution" feature that + allows one to specify a sequence of usd files (clips) to be consulted, + over time, as a source of varying overrides for the prims at and + beneath this prim in namespace. + + SetClipAssetPaths() establishes the set of clips that can be consulted. + SetClipActive() specifies the ordering of clip application over time + (clips can be repeated), while SetClipTimes() specifies time-mapping + from stage-time to clip-time for the clip active at a given stage-time, + which allows for time-dilation and repetition of clips. + Finally, SetClipPrimPath() determines the path within each clip that will + map to this prim, i.e. the location within the clip at which we will look + for opinions for this prim. + + The clip asset paths, times and active metadata can also be specified + through template clip metadata. This can be desirable when your set of + assets is very large, as the template metadata is much more concise. + SetClipTemplateAssetPath() establishes the asset identifier pattern of the + set of clips to be consulted. SetClipTemplateStride(), + SetClipTemplateEndTime(), and SetClipTemplateStartTime() specify the range + in which USD will search, based on the template. From the set of resolved + asset paths, times and active will be derived internally. + + A prim may have multiple "clip sets" -- named sets of clips that each + have their own values for the metadata described above. For example, + a prim might have a clip set named "Clips_1" that specifies some group + of clip asset paths, and another clip set named "Clips_2" that uses + an entirely different set of clip asset paths. These clip sets are + composed across composition arcs, so clip sets for a prim may be + defined in multiple sublayers or references, for example. Individual + metadata for a given clip set may be sparsely overridden. + + Important facts about clips: + \\li Within the layerstack in which clips are established, the + opinions within the clips will be \\em weaker than any local opinions + in the layerstack, but \em stronger than varying opinions coming across + references and variants. + \\li We will never look for metadata or default opinions in clips + when performing value resolution on the owning stage, since these + quantities must be time-invariant. + + This leads to the common structure in which we reference a model asset + on a prim, and then author clips at the same site: the asset reference + will provide the topology and unvarying data for the model, while the + clips will provide the time-sampled animation. + + For further information, see \\ref Usd_Page_ValueClips + """ + customData = { + token apiSchemaType = "nonApplied" + dictionary schemaTokens = { + dictionary clips = { + string doc = """ + Dictionary that contains the definition of the clip sets on + this prim. See \\ref UsdClipsAPI::GetClips. + """ + } + + dictionary clipSets = { + string doc = """ + ListOp that may be used to affect how opinions from + clip sets are applied during value resolution. + See \\ref UsdClipsAPI::GetClipSets. + """ + } + } + } +) +{ +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "Imageable" ( + doc = """Base class for all prims that may require rendering or + visualization of some sort. The primary attributes of Imageable + are visibility and purpose, which each provide instructions for + what geometry should be included for processing by rendering and other + computations. + + \\deprecated Imageable also provides API for accessing primvars, which + has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now + be applied on non-Imageable prim types. This API is planned + to be removed, UsdGeomPrimvarsAPI should be used directly instead.""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) +} + +class "VisibilityAPI" ( + doc = ''' + UsdGeomVisibilityAPI introduces properties that can be used to author + visibility opinions. + + \\note + Currently, this schema only introduces the attributes that are used to + control purpose visibility. Later, this schema will define _all_ + visibility-related properties and UsdGeomImageable will no longer define + those properties. + + The purpose visibility attributes added by this schema, + _guideVisibility_, _proxyVisibility_, and _renderVisibility_ can each be + used to control visibility for geometry of the corresponding purpose + values, with the overall _visibility_ attribute acting as an + override. I.e., if _visibility_ evaluates to "invisible", purpose + visibility is invisible; otherwise, purpose visibility is determined by + the corresponding purpose visibility attribute. + + Note that the behavior of _guideVisibility_ is subtly different from the + _proxyVisibility_ and _renderVisibility_ attributes, in that "guide" + purpose visibility always evaluates to either "invisible" or "visible", + whereas the other attributes may yield computed values of "inherited" if + there is no authored opinion on the attribute or inherited from an + ancestor. This is motivated by the fact that, in Pixar"s user workflows, + we have never found a need to have all guides visible in a scene by + default, whereas we do find that flexibility useful for "proxy" and + "render" geometry. + + This schema can only be applied to UsdGeomImageable prims. The + UseGeomImageable schema provides API for computing the purpose visibility + values that result from the attributes introduced by this schema. + ''' +) +{ + uniform token guideVisibility = "invisible" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose "guide". + + Unlike overall _visibility_, _guideVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _guideVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _guideVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "guide" + is determined by the inherited values it receives for the _visibility_ + and _guideVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" and _guideVisibility_ evaluates to "visible", then the + prim is visible. __Otherwise, it is invisible.__ + ''' + ) + uniform token proxyVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose "proxy". + + Unlike overall _visibility_, _proxyVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _proxyVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _proxyVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "proxy" + is determined by the inherited values it receives for the _visibility_ + and _proxyVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _proxyVisibility_ evaluates to "visible", then + the prim is visible; if _proxyVisibility_ evaluates to "invisible", + then the prim is invisible; if _proxyVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + ''' + ) + uniform token renderVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose + "render". + + Unlike overall _visibility_, _renderVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _renderVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _renderVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "render" + is determined by the inherited values it receives for the _visibility_ + and _renderVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _renderVisibility_ evaluates to "visible", then + the prim is visible; if _renderVisibility_ evaluates to "invisible", + then the prim is invisible; if _renderVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + ''' + ) +} + +class "PrimvarsAPI" ( + doc = """UsdGeomPrimvarsAPI encodes geometric \"primitive variables\", + as UsdGeomPrimvar, which interpolate across a primitive's topology, + can override shader inputs, and inherit down namespace. + + Which Method to Use to Retrieve Primvars + + While creating primvars is unambiguous (CreatePrimvar()), there are quite + a few methods available for retrieving primvars, making it potentially + confusing knowing which one to use. Here are some guidelines: + + - If you are populating a GUI with the primvars already available for + authoring values on a prim, use GetPrimvars(). + - If you want all of the \"useful\" (e.g. to a renderer) primvars + available at a prim, including those inherited from ancestor prims, use + FindPrimvarsWithInheritance(). Note that doing so individually for many + prims will be inefficient. + - To find a particular primvar defined directly on a prim, which may + or may not provide a value, use GetPrimvar(). + - To find a particular primvar defined on a prim or inherited from + ancestors, which may or may not provide a value, use + FindPrimvarWithInheritance(). + - To *efficiently* query for primvars using the overloads of + FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one + must first cache the results of FindIncrementallyInheritablePrimvars() for + each non-leaf prim on the stage. """ +) +{ +} + +class "Xformable" ( + doc = """Base class for all transformable prims, which allows arbitrary + sequences of component affine transformations to be encoded. + + \\note + You may find it useful to review while reading + this class description. + + Supported Component Transformation Operations + + UsdGeomXformable currently supports arbitrary sequences of the following + operations, each of which can be encoded in an attribute of the proper + shape in any supported precision: + - translate - 3D + - scale - 3D + - rotateX - 1D angle in degrees + - rotateY - 1D angle in degrees + - rotateZ - 1D angle in degrees + - rotateABC - 3D where ABC can be any combination of the six principle + Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See + \"note on rotation packing order\" + - orient - 4D (quaternion) + - transform - 4x4D + + Creating a Component Transformation + + To add components to a UsdGeomXformable prim, simply call AddXformOp() + with the desired op type, as enumerated in \\ref UsdGeomXformOp::Type, + and the desired precision, which is one of \\ref UsdGeomXformOp::Precision. + Optionally, you can also provide an \"op suffix\" for the operator that + disambiguates it from other components of the same type on the same prim. + Application-specific transform schemas can use the suffixes to fill a role + similar to that played by AbcGeom::XformOp's \"Hint\" enums for their own + round-tripping logic. + + We also provide specific \"Add\" API for each type, for clarity and + conciseness, e.g. AddTranslateOp(), AddRotateXYZOp() etc. + + AddXformOp() will return a UsdGeomXformOp object, which is a schema on a + newly created UsdAttribute that provides convenience API for authoring + and computing the component transformations. The UsdGeomXformOp can then + be used to author any number of timesamples and default for the op. + + Each successive call to AddXformOp() adds an operator that will be applied + \"more locally\" than the preceding operator, just as if we were pushing + transforms onto a transformation stack - which is precisely what should + happen when the operators are consumed by a reader. + + \\note + If you can, please try to use the UsdGeomXformCommonAPI, which wraps + the UsdGeomXformable with an interface in which Op creation is taken + care of for you, and there is a much higher chance that the data you + author will be importable without flattening into other DCC's, as it + conforms to a fixed set of Scale-Rotate-Translate Ops. + + \\sa \"Using the Authoring API\" + + Data Encoding and Op Ordering + + Because there is no \"fixed schema\" of operations, all of the attributes + that encode transform operations are dynamic, and are scoped in + the namespace \"xformOp\". The second component of an attribute's name provides + the type of operation, as listed above. An \"xformOp\" attribute can + have additional namespace components derived from the opSuffix argument + to the AddXformOp() suite of methods, which provides a preferred way of + naming the ops such that we can have multiple \"translate\" ops with unique + attribute names. For example, in the attribute named + \"xformOp:translate:maya:pivot\", \"translate\" is the type of operation and + \"maya:pivot\" is the suffix. + + The following ordered list of attribute declarations in usda + define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the + translation is double-precision, and the remainder of the ops are single, + in which we will: + +
    +
  1. Scale by 2.0 in each dimension +
  2. Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively +
  3. Translate by 100 units in the Y direction +
+ + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:scale\" ] + \\endcode + + The attributes appear in the dictionary order in which USD, by default, + sorts them. To ensure the ops are recovered and evaluated in the correct + order, the schema introduces the **xformOpOrder** attribute, which + contains the names of the op attributes, in the precise sequence in which + they should be pushed onto a transform stack. **Note** that the order is + opposite to what you might expect, given the matrix algebra described in + This also dictates order of op creation, + since each call to AddXformOp() adds a new op to the end of the + \\b xformOpOrder array, as a new \"most-local\" operation. See + \"Example 2 below\" for C++ code that could + have produced this USD. + + If it were important for the prim's rotations to be independently + overridable, we could equivalently (at some performance cost) encode + the transformation also like so: + \\code + float xformOp:rotateX = 30 + float xformOp:rotateY = 60 + float xformOp:rotateZ = 90 + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateZ\", \"xformOp:rotateY\", \"xformOp:rotateX\", \"xformOp:scale\" ] + \\endcode + + Again, note that although we are encoding an XYZ rotation, the three + rotations appear in the **xformOpOrder** in the opposite order, with Z, + followed, by Y, followed by X. + + Were we to add a Maya-style scalePivot to the above example, it might + look like the following: + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + double3 xformOp:translate:scalePivot + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:translate:scalePivot\", \"xformOp:scale\" ] + \\endcode + + Paired \"Inverted\" Ops + + We have been claiming that the ordered list of ops serves as a set + of instructions to a transform stack, but you may have noticed in the last + example that there is a missing operation - the pivot for the scale op + needs to be applied in its inverse-form as a final (most local) op! In the + AbcGeom::Xform schema, we would have encoded an actual \"final\" translation + op whose value was authored by the exporter as the negation of the pivot's + value. However, doing so would be brittle in USD, given that each op can + be independently overridden, and the constraint that one attribute must be + maintained as the negation of the other in order for successful + re-importation of the schema cannot be expressed in USD. + + Our solution leverages the **xformOpOrder** member of the schema, which, + in addition to ordering the ops, may also contain one of two special + tokens that address the paired op and \"stack resetting\" behavior. + + The \"paired op\" behavior is encoded as an \"!invert!\" prefix in + \\b xformOpOrder, as the result of an AddXformOp(isInverseOp=True) call. + The \\b xformOpOrder for the last example would look like: + \\code + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:translate:scalePivot\", \"xformOp:scale\", \"!invert!xformOp:translate:scalePivot\" ] + \\endcode + + When asked for its value via UsdGeomXformOp::GetOpTransform(), an + \"inverted\" Op (i.e. the \"inverted\" half of a set of paired Ops) will fetch + the value of its paired attribute and return its negation. This works for + all op types - an error will be issued if a \"transform\" type op is singular + and cannot be inverted. When getting the authored value of an inverted op + via UsdGeomXformOp::Get(), the raw, uninverted value of the associated + attribute is returned. + + For the sake of robustness, setting a value on an inverted op is disallowed. + Attempting to set a value on an inverted op will result in a coding error + and no value being set. + + Resetting the Transform Stack + + The other special op/token that can appear in xformOpOrder is + \"!resetXformStack!\", which, appearing as the first element of + xformOpOrder, indicates this prim should not inherit the transformation + of its namespace parent. See SetResetXformStack() + + Expected Behavior for \"Missing\" Ops + + If an importer expects Scale-Rotate-Translate operations, but a prim + has only translate and rotate ops authored, the importer should assume + an identity scale. This allows us to optimize the data a bit, if only + a few components of a very rich schema (like Maya's) are authored in the + app. + + \\anchor usdGeom_xformableExamples + Using the C++ API + + #1. Creating a simple transform matrix encoding + \\snippet examples_usdGeom.cpp CreateMatrixWithDefault + + #2. Creating the simple SRT from the example above + \\snippet examples_usdGeom.cpp CreateExampleSRT + + #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI + \\snippet examples_usdGeom.cpp CreateSRTWithDefaults + + #4. Creating a rotate-only pivot transform with animated + rotation and translation + \\snippet examples_usdGeom.cpp CreateAnimatedTransform + +""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Scope "Scope" ( + doc = """Scope is the simplest grouping primitive, and does not carry the + baggage of transformability. Note that transforms should inherit down + through a Scope successfully - it is just a guaranteed no-op from a + transformability perspective.""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) +} + +class Xform "Xform" ( + doc = "Concrete prim schema for a transform, which implements Xformable " +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Boundable" ( + doc = """Boundable introduces the ability for a prim to persistently + cache a rectilinear, local-space, extent. + + Why Extent and not Bounds ? + Boundable introduces the notion of \"extent\", which is a cached computation + of a prim's local-space 3D range for its resolved attributes at the + layer and time in which extent is authored. We have found that with + composed scene description, attempting to cache pre-computed bounds at + interior prims in a scene graph is very fragile, given the ease with which + one can author a single attribute in a stronger layer that can invalidate + many authored caches - or with which a re-published, referenced asset can + do the same. + + Therefore, we limit to precomputing (generally) leaf-prim extent, which + avoids the need to read in large point arrays to compute bounds, and + provides UsdGeomBBoxCache the means to efficiently compute and + (session-only) cache intermediate bounds. You are free to compute and + author intermediate bounds into your scenes, of course, which may work + well if you have sufficient locks on your pipeline to guarantee that once + authored, the geometry and transforms upon which they are based will + remain unchanged, or if accuracy of the bounds is not an ironclad + requisite. + + When intermediate bounds are authored on Boundable parents, the child prims + will be pruned from BBox computation; the authored extent is expected to + incorporate all child bounds.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Gprim" ( + doc = '''Base class for all geometric primitives. + + Gprim encodes basic graphical properties such as doubleSided and + orientation, and provides primvars for "display color" and "display + opacity" that travel with geometry to be used as shader overrides. ''' +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cube "Cube" ( + doc = """Defines a primitive rectilinear cube centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cube only to provide a fallback value. + \\sa UsdGeomGprim::GetExtentAttr().""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double size = 2 ( + doc = """Indicates the length of each edge of the cube. If you + author size you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Sphere "Sphere" ( + doc = """Defines a primitive sphere centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Sphere only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """Indicates the sphere's radius. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cylinder "Cylinder" ( + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cylinder is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The size of the cylinder's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """The radius of the cylinder. If you author radius + you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Capsule "Capsule" ( + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, centered at the origin, whose spine is along the specified + axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the capsule is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-0.5, -0.5, -1), (0.5, 0.5, 1)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 1 ( + doc = """The length of the capsule's spine along the specified + axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author height you must also author extent. + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 0.5 ( + doc = """The radius of the capsule. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cone "Cone" ( + doc = """Defines a primitive cone, centered at the origin, whose spine + is along the specified axis, with the apex of the cone pointing + in the direction of the positive axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cone is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cone only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The length of the cone's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """The radius of the cone. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cylinder_1 "Cylinder_1" ( + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified axis, with a pair of radii + describing the size of the end points. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cylinder is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The length of the cylinder's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radiusBottom = 1 ( + doc = """The radius of the bottom of the cylinder - i.e. the face + point located along the negative axis. If you author + radiusBottom you must also author extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 1 ( + doc = """The radius of the top of the cylinder - i.e. the face located + along the positive axis. If you author radiusTop you must also + author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Capsule_1 "Capsule_1" ( + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, with potentially different radii, centered at the origin, and whose + spine is along the specified axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the capsule is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-0.5, -0.5, -1), (0.5, 0.5, 1)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 1 ( + doc = """The length of the capsule's spine along the specified + axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author height you must also author extent. + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radiusBottom = 0.5 ( + doc = """The radius of the capping sphere at the bottom of the capsule - + i.e. the sphere located in the direction of the negative axis. If + you author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 0.5 ( + doc = """The radius of the capping sphere at the top of the capsule - + i.e. the sphere in the direction of the positive axis. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Plane "Plane" ( + doc = """Defines a primitive plane, centered at the origin, and is defined by + a cardinal axis, width, and length. The plane is double-sided by default. + + The axis of width and length are perpendicular to the plane's axis: + + axis | width | length + ----- | ------ | ------- + X | z-axis | y-axis + Y | x-axis | z-axis + Z | x-axis | y-axis + + """ +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the surface of the plane is aligned. When set + to 'Z' the plane is in the xy-plane; when axis is 'X' the plane is in + the yz-plane, and when axis is 'Y' the plane is in the xz-plane. + + \\sa UsdGeomGprim::GetAxisAttr().""" + ) + uniform bool doubleSided = 1 ( + doc = """Planes are double-sided by default. Clients may also support + single-sided planes. + + \\sa UsdGeomGprim::GetDoubleSidedAttr()""" + ) + float3[] extent = [(-1, -1, 0), (1, 1, 0)] ( + doc = """Extent is re-defined on Plane only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double length = 2 ( + doc = """The length of the plane, which aligns to the y-axis when axis is + 'Z' or 'X', or to the z-axis when axis is 'Y'. If you author length + you must also author extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + double width = 2 ( + doc = """The width of the plane, which aligns to the x-axis when axis is + 'Z' or 'Y', or to the z-axis when axis is 'X'. If you author width + you must also author extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "PointBased" ( + doc = """Base class for all UsdGeomGprims that possess points, + providing common attributes such as normals and velocities.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Mesh "Mesh" ( + doc = """Encodes a mesh with optional subdivision properties and features. + + As a point-based primitive, meshes are defined in terms of points that + are connected into edges and faces. Many references to meshes use the + term 'vertex' in place of or interchangeably with 'points', while some + use 'vertex' to refer to the 'face-vertices' that define a face. To + avoid confusion, the term 'vertex' is intentionally avoided in favor of + 'points' or 'face-vertices'. + + The connectivity between points, edges and faces is encoded using a + common minimal topological description of the faces of the mesh. Each + face is defined by a set of face-vertices using indices into the Mesh's + _points_ array (inherited from UsdGeomPointBased) and laid out in a + single linear _faceVertexIndices_ array for efficiency. A companion + _faceVertexCounts_ array provides, for each face, the number of + consecutive face-vertices in _faceVertexIndices_ that define the face. + No additional connectivity information is required or constructed, so + no adjacency or neighborhood queries are available. + + A key property of this mesh schema is that it encodes both subdivision + surfaces and simpler polygonal meshes. This is achieved by varying the + _subdivisionScheme_ attribute, which is set to specify Catmull-Clark + subdivision by default, so polygonal meshes must always be explicitly + declared. The available subdivision schemes and additional subdivision + features encoded in optional attributes conform to the feature set of + OpenSubdiv + (https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html). + + \\anchor UsdGeom_Mesh_Primvars + __A Note About Primvars__ + + The following list clarifies the number of elements for and the + interpolation behavior of the different primvar interpolation types + for meshes: + + - __constant__: One element for the entire mesh; no interpolation. + - __uniform__: One element for each face of the mesh; elements are + typically not interpolated but are inherited by other faces derived + from a given face (via subdivision, tessellation, etc.). + - __varying__: One element for each point of the mesh; + interpolation of point data is always linear. + - __vertex__: One element for each point of the mesh; + interpolation of point data is applied according to the + _subdivisionScheme_ attribute. + - __faceVarying__: One element for each of the face-vertices that + define the mesh topology; interpolation of face-vertex data may + be smooth or linear, according to the _subdivisionScheme_ and + _faceVaryingLinearInterpolation_ attributes. + + Primvar interpolation types and related utilities are described more + generally in \\ref Usd_InterpolationVals. + + \\anchor UsdGeom_Mesh_Normals + __A Note About Normals__ + + Normals should not be authored on a subdivision mesh, since subdivision + algorithms define their own normals. They should only be authored for + polygonal meshes (_subdivisionScheme_ = \"none\"). + + The _normals_ attribute inherited from UsdGeomPointBased is not a generic + primvar, but the number of elements in this attribute will be determined by + its _interpolation_. See . + If _normals_ and _primvars:normals_ are both specified, the latter has + precedence. If a polygonal mesh specifies __neither__ _normals_ nor + _primvars:normals_, then it should be treated and rendered as faceted, + with no attempt to compute smooth normals. + + The normals generated for smooth subdivision schemes, e.g. Catmull-Clark + and Loop, will likewise be smooth, but others, e.g. Bilinear, may be + discontinuous between faces and/or within non-planar irregular faces.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] cornerIndices = [] ( + doc = """The indices of points for which a corresponding sharpness + value is specified in _cornerSharpnesses_ (so the size of this array + must match that of _cornerSharpnesses_).""" + ) + float[] cornerSharpnesses = [] ( + doc = """The sharpness values associated with a corresponding set of + points specified in _cornerIndices_ (so the size of this array must + match that of _cornerIndices_). Use the constant `SHARPNESS_INFINITE` + for a perfectly sharp corner.""" + ) + int[] creaseIndices = [] ( + doc = """The indices of points grouped into sets of successive pairs + that identify edges to be creased. The size of this array must be + equal to the sum of all elements of the _creaseLengths_ attribute.""" + ) + int[] creaseLengths = [] ( + doc = """The length of this array specifies the number of creases + (sets of adjacent sharpened edges) on the mesh. Each element gives + the number of points of each crease, whose indices are successively + laid out in the _creaseIndices_ attribute. Since each crease must + be at least one edge long, each element of this array must be at + least two.""" + ) + float[] creaseSharpnesses = [] ( + doc = """The per-crease or per-edge sharpness values for all creases. + Since _creaseLengths_ encodes the number of points in each crease, + the number of elements in this array will be either len(creaseLengths) + or the sum over all X of (creaseLengths[X] - 1). Note that while + the RI spec allows each crease to have either a single sharpness + or a value per-edge, USD will encode either a single sharpness + per crease on a mesh, or sharpnesses for all edges making up + the creases on a mesh. Use the constant `SHARPNESS_INFINITE` for a + perfectly sharp crease.""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + token faceVaryingLinearInterpolation = "cornersPlus1" ( + allowedTokens = ["none", "cornersOnly", "cornersPlus1", "cornersPlus2", "boundaries", "all"] + doc = '''Specifies how elements of a primvar of interpolation type + "faceVarying" are interpolated for subdivision surfaces. Interpolation + can be as smooth as a "vertex" primvar or constrained to be linear at + features specified by several options. Valid values correspond to + choices available in OpenSubdiv: + + - __none__: No linear constraints or sharpening, smooth everywhere + - __cornersOnly__: Sharpen corners of discontinuous boundaries only, + smooth everywhere else + - __cornersPlus1__: The default, same as "cornersOnly" plus additional + sharpening at points where three or more distinct face-varying + values occur + - __cornersPlus2__: Same as "cornersPlus1" plus additional sharpening + at points with at least one discontinuous boundary corner or + only one discontinuous boundary edge (a dart) + - __boundaries__: Piecewise linear along discontinuous boundaries, + smooth interior + - __all__: Piecewise linear everywhere + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules''' + ) + int[] faceVertexCounts ( + doc = """Provides the number of vertices in each face of the mesh, + which is also the number of consecutive indices in _faceVertexIndices_ + that define the face. The length of this attribute is the number of + faces in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + int[] faceVertexIndices ( + doc = """Flat list of the index (into the _points_ attribute) of each + vertex of each face in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + int[] holeIndices = [] ( + doc = """The indices of all faces that should be treated as holes, + i.e. made invisible. This is traditionally a feature of subdivision + surfaces and not generally applied to polygonal meshes.""" + ) + token interpolateBoundary = "edgeAndCorner" ( + allowedTokens = ["none", "edgeOnly", "edgeAndCorner"] + doc = '''Specifies how subdivision is applied for faces adjacent to + boundary edges and boundary points. Valid values correspond to choices + available in OpenSubdiv: + + - __none__: No boundary interpolation is applied and boundary faces are + effectively treated as holes + - __edgeOnly__: A sequence of boundary edges defines a smooth curve to + which the edges of subdivided boundary faces converge + - __edgeAndCorner__: The default, similar to "edgeOnly" but the smooth + boundary curve is made sharp at corner points + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#boundary-interpolation-rules''' + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform token subdivisionScheme = "catmullClark" ( + allowedTokens = ["catmullClark", "loop", "bilinear", "none"] + doc = '''The subdivision scheme to be applied to the surface. + Valid values are: + + - __catmullClark__: The default, Catmull-Clark subdivision; preferred + for quad-dominant meshes (generalizes B-splines); interpolation + of point data is smooth (non-linear) + - __loop__: Loop subdivision; preferred for purely triangular meshes; + interpolation of point data is smooth (non-linear) + - __bilinear__: Subdivision reduces all faces to quads (topologically + similar to "catmullClark"); interpolation of point data is bilinear + - __none__: No subdivision, i.e. a simple polygonal mesh; interpolation + of point data is linear + + Polygonal meshes are typically lighter weight and faster to render, + depending on renderer and render mode. Use of "bilinear" will produce + a similar shape to a polygonal mesh and may offer additional guarantees + of watertightness and additional subdivision features (e.g. holes) but + may also not respect authored normals.''' + ) + token triangleSubdivisionRule = "catmullClark" ( + allowedTokens = ["catmullClark", "smooth"] + doc = '''Specifies an option to the subdivision rules for the + Catmull-Clark scheme to try and improve undesirable artifacts when + subdividing triangles. Valid values are "catmullClark" for the + standard rules (the default) and "smooth" for the improvement. + + See https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle-subdivision-rule''' + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class TetMesh "TetMesh" ( + doc = """Encodes a tetrahedral mesh. A tetrahedral mesh is defined as a set of + tetrahedra. Each tetrahedron is defined by a set of 4 points, with the + triangles of the tetrahedron determined from these 4 points as described in + the tetVertexIndices attribute description. The mesh surface faces + are encoded as triangles. Surface faces must be provided for consumers + that need to do surface calculations, such as renderers or consumers using + physics attachments. Both tetrahedra and surface face definitions use + indices into the TetMesh's points attribute, inherited from + UsdGeomPointBased.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + int3[] surfaceFaceVertexIndices ( + doc = """surfaceFaceVertexIndices defines the triangle + surface faces indices wrt. points of the tetmesh surface. Again + the orientation attribute inherited from UsdGeomPrim should be + set accordingly. The orientation for faces of tetrahedra and + surface faces must match.""" + ) + int4[] tetVertexIndices ( + doc = '''Flat list of the index (into the points attribute) of + each vertex of each tetrahedron in the mesh. Each int4 corresponds to the + indices of a single tetrahedron. Users should set the orientation + attribute of UsdGeomPrim accordingly. That is if the orientation + is "rightHanded", the CCW face ordering of a tetrahedron is + [123],[032],[013],[021] with respect to the int4. This results in the + normals facing outward from the center of the tetrahedron. The following + diagram shows the face ordering of an unwrapped tetrahedron with + "rightHanded" orientation. + + \\image html USDTetMeshRightHanded.svg + + If the orientation attribute is set to "leftHanded" the face + ordering of the tetrahedron is [321],[230],[310],[120] and the + leftHanded CW face normals point outward from the center of the + tetrahedron. The following diagram shows the face ordering of an + unwrapped tetrahedron with "leftHanded" orientation. + + \\image html USDTetMeshLeftHanded.svg + + Setting the orientation attribute to align with the + ordering of the int4 for the tetrahedrons is the responsibility of the + user.''' + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class GeomSubset "GeomSubset" ( + doc = """Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) + as a set of indices. Currently supports encoding subsets of faces, + points, edges, and tetrahedrons. + + To apply to a geometric prim, a GeomSubset prim must be the prim's direct + child in namespace, and possess a concrete defining specifier (i.e. def). + This restriction makes it easy and efficient to discover subsets of a prim. + We might want to relax this restriction if it's common to have multiple + families of subsets on a gprim and if it's useful to be able to + organize subsets belonging to a family under a common scope. See + 'familyName' attribute for more info on defining a family of subsets. + + Note that a GeomSubset isn't an imageable (i.e. doesn't derive from + UsdGeomImageable). So, you can't author visibility for it or + override its purpose. + + Materials are bound to GeomSubsets just as they are for regular + geometry using API available in UsdShade (UsdShadeMaterial::Bind). +""" +) +{ + uniform token elementType = "face" ( + allowedTokens = ["face", "point", "edge", "tetrahedron"] + doc = """The type of element that the indices target. \"elementType\" can + have one of the following values: +
  • face: Identifies faces on a Gprim's surface. For a + UsdGeomMesh, each element of the _indices_ attribute would refer to + an element of the Mesh's _faceCounts_ attribute. For a UsdGeomTetMesh, + each element of the _indices_ attribute would refer to an element of + the Mesh's _surfaceFaceVertexIndices_ attribute.
  • +
  • point: for any UsdGeomPointBased, each + element of the _indices_ attribute would refer to an element of the + Mesh's _points_ attribute
  • +
  • edge: for any UsdGeomMesh, each pair of elements + in the _indices_ attribute would refer to a pair of points of the + Mesh's _points_ attribute that are connected as an implicit edge on the + Mesh. These edges are derived from the Mesh's _faceVertexIndices_ + attribute. Edges are not currently defined for a UsdGeomTetMesh, but + could be derived from all tetrahedron edges or surface face edges only + if a specific use-case arises.
  • +
  • tetrahedron: for any UsdGeomTetMesh, each element of the + _indices_ attribute would refer to an element of the TetMesh's + _tetVertexIndices_ attribute. +
""" + ) + uniform token familyName = "" ( + doc = '''The name of the family of subsets that this subset belongs to. + This is optional and is primarily useful when there are multiple + families of subsets under a geometric prim. In some cases, this could + also be used for achieving proper roundtripping of subset data between + DCC apps. + When multiple subsets belonging to a prim have the same familyName, they + are said to belong to the family. A familyType value can be + encoded on the owner of a family of subsets as a token using the static + method UsdGeomSubset::SetFamilyType(). "familyType" can have one of the + following values: +
  • UsdGeomTokens->partition: implies that every element of + the whole geometry appears exactly once in only one of the subsets + belonging to the family.
  • +
  • UsdGeomTokens->nonOverlapping: an element that appears in one + subset may not appear in any other subset belonging to the family, and + appears only once in the subset in which it appears.
  • +
  • UsdGeomTokens->unrestricted: implies that there are no + restrictions w.r.t. the membership of elements in the subsets. They + could be overlapping and the union of all subsets in the family may + not represent the whole.
  • +
+ \\note The validity of subset data is not enforced by the authoring + APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). + ''' + ) + int[] indices = [] ( + doc = """The set of indices included in this subset. The indices need not + be sorted, but the same index should not appear more than once. Indices + are invalid if outside the range [0, elementCount) for the given time on + the parent geometric prim.""" + ) +} + +class NurbsPatch "NurbsPatch" ( + doc = """Encodes a rational or polynomial non-uniform B-spline + surface, with optional trim curves. + + The encoding mostly follows that of RiNuPatch and RiTrimCurve: + https://renderman.pixar.com/resources/RenderMan_20/geometricPrimitives.html#rinupatch , with some minor renaming and coalescing for clarity. + + The layout of control vertices in the points attribute inherited + from UsdGeomPointBased is row-major with U considered rows, and V columns. + + \\anchor UsdGeom_NurbsPatch_Form + NurbsPatch Form + + The authored points, orders, knots, weights, and ranges are all that is + required to render the nurbs patch. However, the only way to model closed + surfaces with nurbs is to ensure that the first and last control points + along the given axis are coincident. Similarly, to ensure the surface is + not only closed but also C2 continuous, the last order - 1 control + points must be (correspondingly) coincident with the first order - 1 + control points, and also the spacing of the last corresponding knots + must be the same as the first corresponding knots. + + Form is provided as an aid to interchange between modeling and + animation applications so that they can robustly identify the intent with + which the surface was modelled, and take measures (if they are able) to + preserve the continuity/concidence constraints as the surface may be rigged + or deformed. + - An open-form NurbsPatch has no continuity constraints. + - A closed-form NurbsPatch expects the first and last control points + to overlap + - A periodic-form NurbsPatch expects the first and last + order - 1 control points to overlap. + + Nurbs vs Subdivision Surfaces + + Nurbs are an important modeling primitive in CAD/CAM tools and early + computer graphics DCC's. Because they have a natural UV parameterization + they easily support \"trim curves\", which allow smooth shapes to be + carved out of the surface. + + However, the topology of the patch is always rectangular, and joining two + nurbs patches together (especially when they have differing numbers of + spans) is difficult to do smoothly. Also, nurbs are not supported by + the Ptex texturing technology (http://ptex.us). + + Neither of these limitations are shared by subdivision surfaces; therefore, + although they do not subscribe to trim-curve-based shaping, subdivs are + often considered a more flexible modeling primitive. + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + double[] pointWeights ( + doc = """Optionally provides \"w\" components for each control point, + thus must be the same length as the points attribute. If authored, + the patch will be rational. If unauthored, the patch will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the points, but in this schema, + points are not pre-weighted.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + int[] trimCurve:counts ( + doc = '''Each element specifies how many curves are present in each + "loop" of the trimCurve, and the length of the array determines how + many loops the trimCurve contains. The sum of all elements is the + total nuber of curves in the trim, to which we will refer as + nCurves in describing the other trim attributes.''' + ) + double[] trimCurve:knots ( + doc = """Flat list of parametric values for each of the + nCurves curves. There will be as many knots as the sum over + all elements of vertexCounts plus the sum over all elements of + orders.""" + ) + int[] trimCurve:orders ( + doc = "Flat list of orders for each of the nCurves curves." + ) + double3[] trimCurve:points ( + doc = """Flat list of homogeneous 2D points (u, v, w) that comprise + the nCurves curves. The number of points should be equal to the + um over all elements of vertexCounts.""" + ) + double2[] trimCurve:ranges ( + doc = """Flat list of minimum and maximum parametric values + (as defined by knots) for each of the nCurves curves.""" + ) + int[] trimCurve:vertexCounts ( + doc = """Flat list of number of vertices for each of the + nCurves curves.""" + ) + uniform token uForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = '''Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the U dimension. + \\sa "NurbsPatch Form" ''' + ) + double[] uKnots ( + doc = """Knot vector for U direction providing U parameterization. + The length of this array must be ( uVertexCount + uOrder ), and its + entries must take on monotonically increasing values.""" + ) + int uOrder ( + doc = """Order in the U direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + double2 uRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by uKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of uKnots[uOrder-1]. The maxium must be less than or equal + to the last element's value in uKnots.""" + ) + int uVertexCount ( + doc = """Number of vertices in the U direction. Should be at least as + large as uOrder.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + uniform token vForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = '''Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the V dimension. + \\sa "NurbsPatch Form" ''' + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + double[] vKnots ( + doc = """Knot vector for V direction providing U parameterization. + The length of this array must be ( vVertexCount + vOrder ), and its + entries must take on monotonically increasing values.""" + ) + int vOrder ( + doc = """Order in the V direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + double2 vRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by vKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of vKnots[vOrder-1]. The maxium must be less than or equal + to the last element's value in vKnots.""" + ) + int vVertexCount ( + doc = """Number of vertices in the V direction. Should be at least as + large as vOrder.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Curves" ( + doc = """Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and + UsdGeomHermiteCurves. The BasisCurves schema is designed to be + analagous to offline renderers' notion of batched curves (such as + the classical RIB definition via Basis and Curves statements), + while the NurbsCurve schema is designed to be analgous to the + NURBS curves found in packages like Maya and Houdini while + retaining their consistency with the RenderMan specification for + NURBS Patches. HermiteCurves are useful for the + interchange of animation guides and paths. + + It is safe to use the length of the curve vertex count to derive + the number of curves and the number and layout of curve vertices, + but this schema should NOT be used to derive the number of curve + points. While vertex indices are implicit in all shipped + descendent types of this schema, one should not assume that all + internal or future shipped schemas will follow this pattern. Be + sure to key any indexing behavior off the concrete type, not this + abstract type. + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class BasisCurves "BasisCurves" ( + doc = """BasisCurves are a batched curve representation analogous to the + classic RIB definition via Basis and Curves statements. BasisCurves are + often used to render dense aggregate geometry like hair or grass. + + A 'matrix' and 'vstep' associated with the basis are used to + interpolate the vertices of a cubic BasisCurves. (The basis attribute + is unused for linear BasisCurves.) + + A single prim may have many curves whose count is determined implicitly by + the length of the curveVertexCounts vector. Each individual curve is + composed of one or more segments. Each segment is defined by four vertices + for cubic curves and two vertices for linear curves. See the next section + for more information on how to map curve vertex counts to segment counts. + + Segment Indexing + Interpolating a curve requires knowing how to decompose it into its + individual segments. + + The segments of a cubic curve are determined by the vertex count, + the wrap (periodicity), and the vstep of the basis. For linear + curves, the basis token is ignored and only the vertex count and + wrap are needed. + + cubic basis | vstep + ------------- | ------ + bezier | 3 + catmullRom | 1 + bspline | 1 + + The first segment of a cubic (nonperiodic) curve is always defined by its + first four points. The vstep is the increment used to determine what + vertex indices define the next segment. For a two segment (nonperiodic) + bspline basis curve (vstep = 1), the first segment will be defined by + interpolating vertices [0, 1, 2, 3] and the second segment will be defined + by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the + first segment will be defined by interpolating vertices [0, 1, 2, 3] and + the second segment will be defined by [3, 4, 5, 6]. If the vstep is not + one, then you must take special care to make sure that the number of cvs + properly divides by your vstep. (The indices described are relative to + the initial vertex index for a batched curve.) + + For periodic curves, at least one of the curve's initial vertices are + repeated to close the curve. For cubic curves, the number of vertices + repeated is '4 - vstep'. For linear curves, only one vertex is repeated + to close the loop. + + Pinned curves are a special case of nonperiodic curves that only affects + the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render + pinned curves, a client must effectively add 'phantom points' at the + beginning and end of every curve in a batch. These phantom points + are injected to ensure that the interpolated curve begins at P[0] and + ends at P[n-1]. + + For a curve with initial point P[0] and last point P[n-1], the phantom + points are defined as. + P[-1] = 2 * P[0] - P[1] + P[n] = 2 * P[n-1] - P[n-2] + + Pinned cubic curves will (usually) have to be unpacked into the standard + nonperiodic representation before rendering. This unpacking can add some + additional overhead. However, using pinned curves reduces the amount of + data recorded in a scene and (more importantly) better records the + authors' intent for interchange. + + \\note The additional phantom points mean that the minimum curve vertex + count for cubic bspline and catmullRom curves is 2. + + Linear curve segments are defined by two vertices. + A two segment linear curve's first segment would be defined by + interpolating vertices [0, 1]. The second segment would be defined by + vertices [1, 2]. (Again, for a batched curve, indices are relative to + the initial vertex index.) + + When validating curve topology, each renderable entry in the + curveVertexCounts vector must pass this check. + + type | wrap | validitity + ------- | --------------------------- | ---------------- + linear | nonperiodic | curveVertexCounts[i] > 2 + linear | periodic | curveVertexCounts[i] > 3 + cubic | nonperiodic | (curveVertexCounts[i] - 4) % vstep == 0 + cubic | periodic | (curveVertexCounts[i]) % vstep == 0 + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) >= 0 + + Cubic Vertex Interpolation + + \\image html USDCurveBasisMatrix.png width=750 + + Linear Vertex Interpolation + + Linear interpolation is always used on curves of type linear. + 't' with domain [0, 1], the curve is defined by the equation + P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes + the end point. + + Primvar Interpolation + + For cubic curves, primvar data can be either interpolated cubically between + vertices or linearly across segments. The corresponding token + for cubic interpolation is 'vertex' and for linear interpolation is + 'varying'. Per vertex data should be the same size as the number + of vertices in your curve. Segment varying data is dependent on the + wrap (periodicity) and number of segments in your curve. For linear curves, + varying and vertex data would be interpolated the same way. By convention + varying is the preferred interpolation because of the association of + varying with linear interpolation. + + \\image html USDCurvePrimvars.png + + To convert an entry in the curveVertexCounts vector into a segment count + for an individual curve, apply these rules. Sum up all the results in + order to compute how many total segments all curves have. + + The following tables describe the expected segment count for the 'i'th + curve in a curve batch as well as the entire batch. Python syntax + like '[:]' (to describe all members of an array) and 'len(...)' + (to describe the length of an array) are used. + + type | wrap | curve segment count | batch segment count + ------- | --------------------------- | -------------------------------------- | -------------------------- + linear | nonperiodic | curveVertexCounts[i] - 1 | sum(curveVertexCounts[:]) - len(curveVertexCounts) + linear | periodic | curveVertexCounts[i] | sum(curveVertexCounts[:]) + cubic | nonperiodic | (curveVertexCounts[i] - 4) / vstep + 1 | sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) + cubic | periodic | curveVertexCounts[i] / vstep | sum(curveVertexCounts[:]) / vstep + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) + 1 | sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) + + The following table descrives the expected size of varying + (linearly interpolated) data, derived from the segment counts computed + above. + + wrap | curve varying count | batch varying count + ------------------- | ---------------------------- | ------------------------------------------------ + nonperiodic/pinned | segmentCounts[i] + 1 | sum(segmentCounts[:]) + len(curveVertexCounts) + periodic | segmentCounts[i] | sum(segmentCounts[:]) + + Both curve types additionally define 'constant' interpolation for the + entire prim and 'uniform' interpolation as per curve data. + + + \\note Take care when providing support for linearly interpolated data for + cubic curves. Its shape doesn't provide a one to one mapping with either + the number of curves (like 'uniform') or the number of vertices (like + 'vertex') and so it is often overlooked. This is the only primitive in + UsdGeom (as of this writing) where this is true. For meshes, while they + use different interpolation methods, 'varying' and 'vertex' are both + specified per point. It's common to assume that curves follow a similar + pattern and build in structures and language for per primitive, per + element, and per point data only to come upon these arrays that don't + quite fit into either of those categories. It is + also common to conflate 'varying' with being per segment data and use the + segmentCount rules table instead of its neighboring varying data table + rules. We suspect that this is because for the common case of + nonperiodic cubic curves, both the provided segment count and varying data + size formula end with '+ 1'. While debugging, users may look at the double + '+ 1' as a mistake and try to remove it. We take this time to enumerate + these issues because we've fallen into them before and hope that we save + others time in their own implementations. + + As an example of deriving per curve segment and varying primvar data counts from + the wrap, type, basis, and curveVertexCount, the following table is provided. + + wrap | type | basis | curveVertexCount | curveSegmentCount | varyingDataCount + ------------- | ------- | ------- | ----------------- | ------------------ | ------------------------- + nonperiodic | linear | N/A | [2 3 2 5] | [1 2 1 4] | [2 3 2 5] + nonperiodic | cubic | bezier | [4 7 10 4 7] | [1 2 3 1 2] | [2 3 4 2 3] + nonperiodic | cubic | bspline | [5 4 6 7] | [2 1 3 4] | [3 2 4 5] + periodic | cubic | bezier | [6 9 6] | [2 3 2] | [2 3 2] + periodic | linear | N/A | [3 7] | [3 7] | [3 7] + + Tubes and Ribbons + + The strictest definition of a curve as an infinitely thin wire is not + particularly useful for describing production scenes. The additional + widths and normals attributes can be used to describe cylindrical + tubes and or flat oriented ribbons. + + Curves with only widths defined are imaged as tubes with radius + 'width / 2'. Curves with both widths and normals are imaged as ribbons + oriented in the direction of the interpolated normal vectors. + + While not technically UsdGeomPrimvars, widths and normals + also have interpolation metadata. It's common for authored widths to have + constant, varying, or vertex interpolation + (see UsdGeomCurves::GetWidthsInterpolation()). It's common for + authored normals to have varying interpolation + (see UsdGeomPointBased::GetNormalsInterpolation()). + + \\image html USDCurveHydra.png + + The file used to generate these curves can be found in + extras/usd/examples/usdGeomExamples/basisCurves.usda. It's provided + as a reference on how to properly image both tubes and ribbons. The first + row of curves are linear; the second are cubic bezier. (We aim in future + releases of HdSt to fix the discontinuity seen with broken tangents to + better match offline renderers like RenderMan.) The yellow and violet + cubic curves represent cubic vertex width interpolation for which there is + no equivalent for linear curves. + + \\note How did this prim type get its name? This prim is a portmanteau of + two different statements in the original RenderMan specification: + 'Basis' and 'Curves'. +""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform token basis = "bezier" ( + allowedTokens = ["bezier", "bspline", "catmullRom"] + doc = """The basis specifies the vstep and matrix used for cubic + interpolation. \\note The 'hermite' and 'power' tokens have been + removed. We've provided UsdGeomHermiteCurves + as an alternative for the 'hermite' basis.""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform token type = "cubic" ( + allowedTokens = ["linear", "cubic"] + doc = """Linear curves interpolate linearly between two vertices. + Cubic curves use a basis matrix with four vertices to interpolate a segment.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token wrap = "nonperiodic" ( + allowedTokens = ["nonperiodic", "periodic", "pinned"] + doc = """If wrap is set to periodic, the curve when rendered will + repeat the initial vertices (dependent on the vstep) to close the + curve. If wrap is set to 'pinned', phantom points may be created + to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. + """ + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class NurbsCurves "NurbsCurves" ( + doc = """This schema is analagous to NURBS Curves in packages like Maya + and Houdini, often used for interchange of rigging and modeling curves. + Unlike Maya, this curve spec supports batching of multiple curves into a + single prim, widths, and normals in the schema. Additionally, we require + 'numSegments + 2 * degree + 1' knots (2 more than maya does). This is to + be more consistent with RenderMan's NURBS patch specification. + + To express a periodic curve: + - knot[0] = knot[1] - (knots[-2] - knots[-3]; + - knot[-1] = knot[-2] + (knot[2] - knots[1]); + + To express a nonperiodic curve: + - knot[0] = knot[1]; + - knot[-1] = knot[-2]; + + In spite of these slight differences in the spec, curves generated in Maya + should be preserved when roundtripping. + + order and range, when representing a batched NurbsCurve should be + authored one value per curve. knots should be the concatentation of + all batched curves.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + double[] knots ( + doc = """Knot vector providing curve parameterization. + The length of the slice of the array for the ith curve + must be ( curveVertexCount[i] + order[i] ), and its + entries must take on monotonically increasing values.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + int[] order = [] ( + doc = """Order of the curve. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1. + Its value for the 'i'th curve must be less than or equal to + curveVertexCount[i]""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + double[] pointWeights ( + doc = """Optionally provides \"w\" components for each control point, + thus must be the same length as the points attribute. If authored, + the curve will be rational. If unauthored, the curve will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the points, but in this schema, + points are not pre-weighted.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double2[] ranges ( + doc = """Provides the minimum and maximum parametric values (as defined + by knots) over which the curve is actually defined. The minimum must + be less than the maximum, and greater than or equal to the value of the + knots['i'th curve slice][order[i]-1]. The maxium must be less + than or equal to the last element's value in knots['i'th curve slice]. +\tRange maps to (vmin, vmax) in the RenderMan spec.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Points "Points" ( + doc = """Points are analogous to the RiPoints spec. + + Points can be an efficient means of storing and rendering particle + effects comprised of thousands or millions of small particles. Points + generally receive a single shading sample each, which should take + normals into account, if present. + + While not technically UsdGeomPrimvars, the widths and normals also + have interpolation metadata. It's common for authored widths and normals + to have constant or varying interpolation.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the points array, specifying (at each timesample if + point identities are changing) the id of each point. The + type is signed intentionally, so that clients can encode some + binary state on Id'd points without adding a separate + primvar.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Widths are defined as the diameter of the points, in + object space. 'widths' is not a generic Primvar, but + the number of elements in this attribute will be determined by + its 'interpolation'. See . If + 'widths' and 'primvars:widths' are both specified, the latter + has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PointInstancer "PointInstancer" ( + doc = """Encodes vectorized instancing of multiple, potentially + animated, prototypes (object/instance masters), which can be arbitrary + prims/subtrees on a UsdStage. + + PointInstancer is a \"multi instancer\", as it allows multiple prototypes + to be scattered among its \"points\". We use a UsdRelationship + prototypes to identify and order all of the possible prototypes, by + targeting the root prim of each prototype. The ordering imparted by + relationships associates a zero-based integer with each prototype, and + it is these integers we use to identify the prototype of each instance, + compactly, and allowing prototypes to be swapped out without needing to + reauthor all of the per-instance data. + + The PointInstancer schema is designed to scale to billions of instances, + which motivates the choice to split the per-instance transformation into + position, (quaternion) orientation, and scales, rather than a + 4x4 matrix per-instance. In addition to requiring fewer bytes even if + all elements are authored (32 bytes vs 64 for a single-precision 4x4 + matrix), we can also be selective about which attributes need to animate + over time, for substantial data reduction in many cases. + + Note that PointInstancer is not a Gprim, since it is not a graphical + primitive by any stretch of the imagination. It is, however, + Boundable, since we will sometimes want to treat the entire PointInstancer + similarly to a procedural, from the perspective of inclusion or framing. + + Varying Instance Identity over Time + + PointInstancers originating from simulations often have the characteristic + that points/instances are \"born\", move around for some time period, and then + die (or leave the area of interest). In such cases, billions of instances + may be birthed over time, while at any specific time, only a much + smaller number are actually alive. To encode this situation efficiently, + the simulator may re-use indices in the instance arrays, when a particle + dies, its index will be taken over by a new particle that may be birthed in + a much different location. This presents challenges both for + identity-tracking, and for motion-blur. + + We facilitate identity tracking by providing an optional, animatable + ids attribute, that specifies the 64 bit integer ID of the particle + at each index, at each point in time. If the simulator keeps monotonically + increasing a particle-count each time a new particle is birthed, it will + serve perfectly as particle ids. + + We facilitate motion blur for varying-topology particle streams by + optionally allowing per-instance velocities and angularVelocities + to be authored. If instance transforms are requested at a time between + samples and either of the velocity attributes is authored, then we will + not attempt to interpolate samples of positions or orientations. + If not authored, and the bracketing samples have the same length, then we + will interpolate. + + Computing an Instance Transform + + Each instance's transformation is a combination of the SRT affine transform + described by its scale, orientation, and position, applied after + (i.e. less locally than) the local to parent transformation computed at + the root of the prototype it is instancing. + + If your processing of prototype geometry naturally takes into account the + transform of the prototype root, then this term can be omitted from the + computation of each instance transform, and this can be controlled when + computing instance transformation matrices using the + UsdGeomPointInstancer::PrototypeXformInclusion enumeration. + + To understand the computation of the instance transform, in order to put + an instance of a PointInstancer into the space of the PointInstancer's + parent prim we do the following: + + 1. Apply (most locally) the authored local to parent transformation for + prototypes[protoIndices[i]] + 2. If *scales* is authored, next apply the scaling matrix from *scales[i]* + 3. If *orientations* is authored: **if *angularVelocities* is authored**, + first multiply *orientations[i]* by the unit quaternion derived by scaling + *angularVelocities[i]* by the \"time differential\" + from the left-bracketing timeSample for *orientation* to the requested + evaluation time *t*, storing the result in *R*, **else** assign *R* + directly from *orientations[i]*. Apply the rotation matrix derived + from *R*. + 4. Apply the translation derived from *positions[i]*. If *velocities* is + authored, apply the translation deriving from *velocities[i]* scaled by + the time differential from the left-bracketing timeSample for *positions* + to the requested evaluation time *t*. + 5. Least locally, apply the transformation authored on the PointInstancer + prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the + PointInstancer to put the instance directly into world space) + + If neither *velocities* nor *angularVelocities* are authored, we fallback to + standard position and orientation computation logic (using linear + interpolation between timeSamples) as described by + . + + \\anchor UsdGeom_PITimeScaling + Scaling Velocities for Interpolation + + When computing time-differentials by which to apply velocity or + angularVelocity to positions or orientations, we must scale by + ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded + in units/second, while we are interpolating in UsdTimeCode ordinates. + + We provide both high and low-level API's for dealing with the + transformation as a matrix, both will compute the instance matrices using + multiple threads; the low-level API allows the client to cache unvarying + inputs so that they need not be read duplicately when computing over + time. + + See also . + + Primvars on PointInstancer + + \"Primvars\" authored on a PointInstancer prim should + always be applied to each instance with constant interpolation at + the root of the instance. When you are authoring primvars on a + PointInstancer, think about it as if you were authoring them on a + point-cloud (e.g. a UsdGeomPoints gprim). The same + interpolation rules for points apply here, substituting + \"instance\" for \"point\". + + In other words, the (constant) value extracted for each instance + from the authored primvar value depends on the authored interpolation + and elementSize of the primvar, as follows: + - constant or uniform : the entire authored value of the + primvar should be applied exactly to each instance. + - varying, vertex, or faceVarying: the first + elementSize elements of the authored primvar array should be assigned to + instance zero, the second elementSize elements should be assigned to + instance one, and so forth. + + + Masking Instances: \"Deactivating\" and Invising + + Often a PointInstancer is created \"upstream\" in a graphics pipeline, and + the needs of \"downstream\" clients necessitate eliminating some of the + instances from further consideration. Accomplishing this pruning by + re-authoring all of the per-instance attributes is not very attractive, + since it may mean destructively editing a large quantity of data. We + therefore provide means of \"masking\" instances by ID, such that the + instance data is unmolested, but per-instance transform and primvar data + can be retrieved with the no-longer-desired instances eliminated from the + (smaller) arrays. PointInstancer allows two independent means of masking + instances by ID, each with different features that meet the needs of + various clients in a pipeline. Both pruning features' lists of ID's are + combined to produce the mask returned by ComputeMaskAtTime(). + + \\note If a PointInstancer has no authored ids attribute, the masking + features will still be available, with the integers specifying element + position in the protoIndices array rather than ID. + + \\subsection UsdGeomPointInstancer_inactiveIds InactiveIds: List-edited, Unvarying Masking + + The first masking feature encodes a list of IDs in a list-editable metadatum + called inactiveIds, which, although it does not have any similar + impact to stage population as \"prim activation\", + it shares with that feature that its application is uniform over all time. + Because it is list-editable, we can sparsely add and remove instances + from it in many layers. + + This sparse application pattern makes inactiveIds a good choice when + further downstream clients may need to reverse masking decisions made + upstream, in a manner that is robust to many kinds of future changes to + the upstream data. + + See ActivateId(), ActivateIds(), DeactivateId(), DeactivateIds(), + ActivateAllIds() + + \\subsection UsdGeomPointInstancer_invisibleIds invisibleIds: Animatable Masking + + The second masking feature encodes a list of IDs in a time-varying + Int64Array-valued UsdAttribute called invisibleIds , since it shares + with \"Imageable visibility\" + the ability to animate object visibility. + + Unlike inactiveIds, overriding a set of opinions for invisibleIds + is not at all straightforward, because one will, in general need to + reauthor (in the overriding layer) **all** timeSamples for the attribute + just to change one Id's visibility state, so it cannot be authored + sparsely. But it can be a very useful tool for situations like encoding + pre-computed camera-frustum culling of geometry when either or both of + the instances or the camera is animated. + + See VisId(), VisIds(), InvisId(), InvisIds(), VisAllIds() + + Processing and Not Processing Prototypes + + Any prim in the scenegraph can be targeted as a prototype by the + prototypes relationship. We do not, however, provide a specific + mechanism for identifying prototypes as geometry that should not be drawn + (or processed) in their own, local spaces in the scenegraph. We + encourage organizing all prototypes as children of the PointInstancer + prim that consumes them, and pruning \"raw\" processing and drawing + traversals when they encounter a PointInstancer prim; this is what the + UsdGeomBBoxCache and UsdImaging engines do. + + There is a pattern one can deploy for organizing the prototypes + such that they will automatically be skipped by basic UsdPrim::GetChildren() + or UsdPrimRange traversals. Usd prims each have a + \"specifier\" of \"def\", \"over\", or \"class\". The + default traversals skip over prims that are \"pure overs\" or classes. So + to protect prototypes from all generic traversals and processing, place + them under a prim that is just an \"over\". For example, + \\code + 01 def PointInstancer \"Crowd_Mid\" + 02 { + 03 rel prototypes = [ , ] + 04 + 05 over \"Prototypes\" + 06 { + 07 def \"MaleThin_Business\" ( + 08 references = [@MaleGroupA/usd/MaleGroupA.usd@] + 09 variants = { + 10 string modelingVariant = \"Thin\" + 11 string costumeVariant = \"BusinessAttire\" + 12 } + 13 ) + 14 { ... } + 15 + 16 def \"MaleThin_Casual\" + 17 ... + 18 } + 19 } + \\endcode + """ +) +{ + vector3f[] accelerations ( + doc = """If authored, per-instance 'accelerations' will be used with + velocities to compute positions between samples for the 'positions' + attribute rather than interpolating between neighboring 'positions' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + vector3f[] angularVelocities ( + doc = """If authored, per-instance angular velocity vector to be used for + interoplating orientations. Angular velocities should be considered + mandatory if both protoIndices and orientations are animated. + Angular velocity is measured in degrees per second. To convert + to degrees per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the protoIndices array, specifying (at each timeSample if + instance identities are changing) the id of each instance. The + type is signed intentionally, so that clients can encode some + binary state on Id'd instances without adding a separate primvar. + See also \\ref UsdGeomPointInstancer_varyingTopo""" + ) + int64[] invisibleIds = [] ( + doc = """A list of id's to make invisible at the evaluation time. + See .""" + ) + quath[] orientations ( + doc = """If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, which + allows us to encode it with sufficient precision in a compact GfQuath. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the \"better (for interpolation + with respect to neighboring samples)\" of the two possible quaternions + that encode the rotation. + + See also .""" + ) + quatf[] orientationsf ( + doc = """If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, encoded + as a GfQuatf to support higher precision computations. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the \"better (for interpolation + with respect to neighboring samples)\" of the two possible quaternions + that encode the rotation. Note that if the earliest time sample (or + default value if there are no time samples) of orientationsf is not empty + orientationsf will be preferred over orientations if both are authored. + + See also .""" + ) + point3f[] positions ( + doc = """Required property. Per-instance position. See also + .""" + ) + int[] protoIndices ( + doc = """Required property. Per-instance index into + prototypes relationship that identifies what geometry should be + drawn for each instance. Topology attribute - can be animated, + but at a potential performance impact for streaming.""" + ) + rel prototypes ( + doc = """Required property. Orders and targets the prototype root + prims, which can be located anywhere in the scenegraph that is convenient, + although we promote organizing prototypes as children of the + PointInstancer. The position of a prototype in this relationship defines + the value an instance would specify in the protoIndices attribute to + instance that prototype. Since relationships are uniform, this property + cannot be animated.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + float3[] scales ( + doc = """If authored, per-instance scale to be applied to + each instance, before any rotation is applied. + + See also .""" + ) + vector3f[] velocities ( + doc = """If provided, per-instance 'velocities' will be used to + compute positions between samples for the 'positions' attribute, + rather than interpolating between neighboring 'positions' samples. + Velocities should be considered mandatory if both protoIndices + and positions are animated. Velocity is measured in position + units per second, as per most simulation software. To convert to + position units per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also + .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Camera "Camera" ( + doc = """Transformable camera. + + Describes optical properties of a camera via a common set of attributes + that provide control over the camera's frustum as well as its depth of + field. For stereo, the left and right camera are individual prims tagged + through the \"stereoRole attribute\". + + There is a corresponding class GfCamera, which can hold the state of a + camera (at a particular time). and + convert between a USD camera prim and + a GfCamera. + + To obtain the camera's location in world space, call the following on a + UsdGeomCamera 'camera': + \\code + GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); + \\endcode + \\note + Cameras in USD are always \"Y up\", regardless of the stage's orientation + (i.e. UsdGeomGetStageUpAxis()). This means that the inverse of + 'camXform' (the VIEW half of the MODELVIEW transform in OpenGL parlance) + will transform the world such that the camera is at the origin, looking + down the -Z axis, with +Y as the up axis, and +X pointing to the right. + This describes a __right handed coordinate system__. + + Units of Measure for Camera Properties + + Despite the familiarity of millimeters for specifying some physical + camera properties, UsdGeomCamera opts for greater consistency with all + other UsdGeom schemas, which measure geometric properties in scene units, + as determined by UsdGeomGetStageMetersPerUnit(). We do make a + concession, however, in that lens and filmback properties are measured in + __tenths of a scene unit__ rather than \"raw\" scene units. This means + that with the fallback value of .01 for _metersPerUnit_ - i.e. scene unit + of centimeters - then these \"tenth of scene unit\" properties are + effectively millimeters. + + \\note If one adds a Camera prim to a UsdStage whose scene unit is not + centimeters, the fallback values for filmback properties will be + incorrect (or at the least, unexpected) in an absolute sense; however, + proper imaging through a \"default camera\" with focusing disabled depends + only on ratios of the other properties, so the camera is still usable. + However, it follows that if even one property is authored in the correct + scene units, then they all must be. + + + \\sa \\ref UsdGeom_LinAlgBasics + """ +) +{ + float4[] clippingPlanes = [] ( + doc = """Additional, arbitrarily oriented clipping planes. + A vector (a,b,c,d) encodes a clipping plane that cuts off + (x,y,z) with a * x + b * y + c * z + d * 1 < 0 where (x,y,z) + are the coordinates in the camera's space.""" + ) + float2 clippingRange = (1, 1000000) ( + doc = """Near and far clipping distances in scene units; see + .""" + ) + float exposure = 0 ( + doc = """Exposure adjustment, as a log base-2 value. The default + of 0.0 has no effect. A value of 1.0 will double the + image-plane intensities in a rendered image; a value of + -1.0 will halve them.""" + ) + float focalLength = 50 ( + doc = """Perspective focal length in tenths of a scene unit; see + .""" + ) + float focusDistance = 0 ( + doc = """Distance from the camera to the focus plane in scene units; see + .""" + ) + float fStop = 0 ( + doc = "Lens aperture. Defaults to 0.0, which turns off focusing." + ) + float horizontalAperture = 20.955 ( + doc = """Horizontal aperture in tenths of a scene unit; see + . Default is the equivalent of + the standard 35mm spherical projector aperture.""" + ) + float horizontalApertureOffset = 0 ( + doc = """Horizontal aperture offset in the same units as + horizontalAperture. Defaults to 0.""" + ) + token projection = "perspective" ( + allowedTokens = ["perspective", "orthographic"] + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double shutter:close = 0 ( + doc = """Frame relative shutter close time, analogous comments from + shutter:open apply. A value greater or equal to shutter:open + should be authored, otherwise there is no exposure and a + renderer should produce a black image.""" + ) + double shutter:open = 0 ( + doc = """Frame relative shutter open time in UsdTimeCode units (negative + value indicates that the shutter opens before the current + frame time). Used for motion blur.""" + ) + uniform token stereoRole = "mono" ( + allowedTokens = ["mono", "left", "right"] + doc = """If different from mono, the camera is intended to be the left + or right camera of a stereo setup.""" + ) + float verticalAperture = 15.2908 ( + doc = """Vertical aperture in tenths of a scene unit; see + . Default is the equivalent of + the standard 35mm spherical projector aperture.""" + ) + float verticalApertureOffset = 0 ( + doc = """Vertical aperture offset in the same units as + verticalAperture. Defaults to 0.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "GeomModelAPI" ( + doc = """UsdGeomModelAPI extends the generic UsdModelAPI schema with + geometry specific concepts such as cached extents for the entire model, + constraint targets, and geometry-inspired extensions to the payload + lofting process. + + As described in GetExtentsHint() below, it is useful to cache extents + at the model level. UsdGeomModelAPI provides schema for computing and + storing these cached extents, which can be consumed by UsdGeomBBoxCache to + provide fast access to precomputed extents that will be used as the model's + bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). + + Draw Modes + + Draw modes provide optional alternate imaging behavior for USD subtrees with + kind model. model:drawMode (which is inheritable) and + model:applyDrawMode (which is not) are resolved into a decision to stop + traversing the scene graph at a certain point, and replace a USD subtree + with proxy geometry. + + The value of model:drawMode determines the type of proxy geometry: + - origin - Draw the model-space basis vectors of the replaced prim. + - bounds - Draw the model-space bounding box of the replaced prim. + - cards - Draw textured quads as a placeholder for the replaced prim. + - default - An explicit opinion to draw the USD subtree as normal. + - inherited - Defer to the parent opinion. + + model:drawMode falls back to _inherited_ so that a whole scene, + a large group, or all prototypes of a model hierarchy PointInstancer can + be assigned a draw mode with a single attribute edit. If no draw mode is + explicitly set in a hierarchy, the resolved value is _default_. + + model:applyDrawMode is meant to be written when an asset is authored, + and provides flexibility for different asset types. For example, + a character assembly (composed of character, clothes, etc) might have + model:applyDrawMode set at the top of the subtree so the whole group + can be drawn as a single card object. An effects subtree might have + model:applyDrawMode set at a lower level so each particle + group draws individually. + + Models of kind component are automatically treated as if + model:applyDrawMode were true if model:applyDrawMode is not + authored on the component prim. A component prim will be drawn drawn with a + simplified representation when the prim has kind component, + model:applyDrawMode is not authored (or authored to be true), and the + resolved (i.e. inherited down namespace) value for model:drawMode is + not _default_. If you don't want component prims to use the resolved + non-default drawMode, you must apply the UsdGeomModelAPI schema on the prim + and explicitly set model:applyDrawMode to false. + + Cards Geometry + + The specific geometry used in cards mode is controlled by the + model:cardGeometry attribute: + - cross - Generate a quad normal to each basis direction and negative. + Locate each quad so that it bisects the model extents. + - box - Generate a quad normal to each basis direction and negative. + Locate each quad on a face of the model extents, facing out. + - fromTexture - Generate a quad for each supplied texture from + attributes stored in that texture's metadata. + + For cross and box mode, the extents are calculated for purposes + default, proxy, and render, at their earliest authored time. + If the model has no textures, all six card faces are rendered using + model:drawModeColor. If one or more textures are present, only axes + with one or more textures assigned are drawn. For each axis, if both + textures (positive and negative) are specified, they'll be used on the + corresponding card faces; if only one texture is specified, it will be + mapped to the opposite card face after being flipped on the texture's + s-axis. Any card faces with invalid asset paths will be drawn with + model:drawModeColor. + + Both model:cardGeometry and model:drawModeColor should be + authored on the prim where the draw mode takes effect, since these + attributes are not inherited. + + For fromTexture mode, only card faces with valid textures assigned + are drawn. The geometry is generated by pulling the worldtoscreen + attribute out of texture metadata. This is expected to be a 4x4 matrix + mapping the model-space position of the card quad to the clip-space quad + with corners (-1,-1,0) and (1,1,0). The card vertices are generated by + transforming the clip-space corners by the inverse of worldtoscreen. + Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. + If the metadata cannot be read in the right format, or the matrix can't + be inverted, the card face is not drawn. + + All card faces are drawn and textured as single-sided. + + \\todo CreatePayload() """ +) +{ + uniform bool model:applyDrawMode = 0 ( + doc = """If true, and the resolved value of model:drawMode is + non-default, apply an alternate imaging mode to this prim. See + \\ref UsdGeomModelAPI_drawMode.""" + ) + uniform token model:cardGeometry = "cross" ( + allowedTokens = ["cross", "box", "fromTexture"] + doc = """The geometry to generate for imaging prims inserted for \\em + cards imaging mode. See for + geometry descriptions.""" + ) + asset model:cardTextureXNeg ( + doc = """In cards imaging mode, the texture applied to the X- quad. + The texture axes (s,t) are mapped to model-space axes (y, -z).""" + ) + asset model:cardTextureXPos ( + doc = """In cards imaging mode, the texture applied to the X+ quad. + The texture axes (s,t) are mapped to model-space axes (-y, -z).""" + ) + asset model:cardTextureYNeg ( + doc = """In cards imaging mode, the texture applied to the Y- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -z).""" + ) + asset model:cardTextureYPos ( + doc = """In cards imaging mode, the texture applied to the Y+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -z).""" + ) + asset model:cardTextureZNeg ( + doc = """In cards imaging mode, the texture applied to the Z- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -y).""" + ) + asset model:cardTextureZPos ( + doc = """In cards imaging mode, the texture applied to the Z+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -y).""" + ) + uniform token model:drawMode = "inherited" ( + allowedTokens = ["origin", "bounds", "cards", "default", "inherited"] + doc = """Alternate imaging mode; applied to this prim or child prims + where model:applyDrawMode is true, or where the prim + has kind component and model:applyDrawMode is not + authored. See \\ref UsdGeomModelAPI_drawMode + for mode descriptions.""" + ) + uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ( + doc = """The base color of imaging prims inserted for alternate + imaging modes. For origin and bounds modes, this + controls line color; for cards mode, this controls the + fallback quad color.""" + ) +} + +class "MotionAPI" ( + doc = '''UsdGeomMotionAPI encodes data that can live on any prim that + may affect computations involving: + - computed motion for motion blur + - sampling for motion blur + + The "motion:blurScale" attribute allows + artists to scale the __amount__ of motion blur to be rendered for parts + of the scene without changing the recorded animation. See + for use and implementation details. + + ''' +) +{ + float motion:blurScale = 1 ( + doc = """BlurScale is an __inherited__ float attribute that stipulates + the rendered motion blur (as typically specified via UsdGeomCamera's + _shutter:open_ and _shutter:close_ properties) should be scaled for + __all objects__ at and beneath the prim in namespace on which the + _motion:blurScale_ value is specified. + + Without changing any other data in the scene, _blurScale_ allows artists to + \"dial in\" the amount of blur on a per-object basis. A _blurScale_ + value of zero removes all blur, a value of 0.5 reduces blur by half, + and a value of 2.0 doubles the blur. The legal range for _blurScale_ + is [0, inf), although very high values may result in extremely expensive + renders, and may exceed the capabilities of some renderers. + + Although renderers are free to implement this feature however they see + fit, see for our guidance on implementing + the feature universally and efficiently. + + \\sa ComputeMotionBlurScale() + """ + ) + int motion:nonlinearSampleCount = 3 ( + doc = """Determines the number of position or transformation samples + created when motion is described by attributes contributing non-linear + terms. + + To give an example, imagine an application (such as a + renderer) consuming 'points' and the USD document also + contains 'accelerations' for the same prim. Unless the + application can consume these 'accelerations' itself, an + intermediate layer has to compute samples within the sampling + interval for the point positions based on the value of + 'points', 'velocities' and 'accelerations'. The number of these + samples is given by 'nonlinearSampleCount'. The samples are + equally spaced within the sampling interval. + + Another example involves the PointInstancer where + 'nonlinearSampleCount' is relevant when 'angularVelocities' + or 'accelerations' are authored. + + 'nonlinearSampleCount' is an **inherited** attribute, also + see ComputeNonlinearSampleCount()""" + ) + float motion:velocityScale = 1 ( + doc = """\\deprecated + + VelocityScale is an **inherited** float attribute that + velocity-based schemas (e.g. PointBased, PointInstancer) can consume + to compute interpolated positions and orientations by applying + velocity and angularVelocity, which is required for interpolating + between samples when topology is varying over time. Although these + quantities are generally physically computed by a simulator, sometimes + we require more or less motion-blur to achieve the desired look. + VelocityScale allows artists to dial-in, as a post-sim correction, + a scale factor to be applied to the velocity prior to computing + interpolated positions from it.""" + ) +} + +class "XformCommonAPI" ( + doc = """This class provides API for authoring and retrieving a standard set + of component transformations which include a scale, a rotation, a + scale-rotate pivot and a translation. The goal of the API is to enhance + component-wise interchange. It achieves this by limiting the set of allowed + basic ops and by specifying the order in which they are applied. In addition + to the basic set of ops, the 'resetXformStack' bit can also be set to + indicate whether the underlying xformable resets the parent transformation + (i.e. does not inherit it's parent's transformation). + + \\sa UsdGeomXformCommonAPI::GetResetXformStack() + \\sa UsdGeomXformCommonAPI::SetResetXformStack() + + The operator-bool for the class will inform you whether an existing + xformable is compatible with this API. + + The scale-rotate pivot is represented by a pair of (translate, + inverse-translate) xformOps around the scale and rotate operations. + The rotation operation can be any of the six allowed Euler angle sets. + \\sa UsdGeomXformOp::Type. + + The xformOpOrder of an xformable that has all of the supported basic ops + is as follows: + [\"xformOp:translate\", \"xformOp:translate:pivot\", \"xformOp:rotateXYZ\", + \"xformOp:scale\", \"!invert!xformOp:translate:pivot\"]. + + It is worth noting that all of the ops are optional. For example, an + xformable may have only a translate or a rotate. It would still be + considered as compatible with this API. Individual SetTranslate(), + SetRotate(), SetScale() and SetPivot() methods are provided by this API + to allow such sparse authoring.""" +) +{ +} + +class HermiteCurves "HermiteCurves" ( + doc = """This schema specifies a cubic hermite interpolated curve batch as + sometimes used for defining guides for animation. While hermite curves can + be useful because they interpolate through their control points, they are + not well supported by high-end renderers for imaging. Therefore, while we + include this schema for interchange, we strongly recommend the use of + UsdGeomBasisCurves as the representation of curves intended to be rendered + (ie. hair or grass). Hermite curves can be converted to a Bezier + representation (though not from Bezier back to Hermite in general). + + Point Interpolation + + The initial cubic curve segment is defined by the first two points and + first two tangents. Additional segments are defined by additional + point / tangent pairs. The number of segments for each non-batched hermite + curve would be len(curve.points) - 1. The total number of segments + for the batched UsdGeomHermiteCurves representation is + len(points) - len(curveVertexCounts). + + Primvar, Width, and Normal Interpolation + + Primvar interpolation is not well specified for this type as it is not + intended as a rendering representation. We suggest that per point + primvars would be linearly interpolated across each segment and should + be tagged as 'varying'. + + It is not immediately clear how to specify cubic or 'vertex' interpolation + for this type, as we lack a specification for primvar tangents. This + also means that width and normal interpolation should be restricted to + varying (linear), uniform (per curve element), or constant (per prim). + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] tangents = [] ( + doc = """Defines the outgoing trajectory tangent for each point. + Tangents should be the same size as the points attribute.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "constraintTargetIdentifier": { + "appliesTo": [ + "attributes" + ], + "default": "", + "documentation": "Unique identifier within a model's namespace for an matrix-valued attribute representing a constraint target", + "type": "token" + }, + "elementSize": { + "appliesTo": [ + "attributes" + ], + "default": 1, + "displayGroup": "Primvars", + "documentation": "The number of values in a primvar's value array that must be aggregated for each element on the primitive.", + "type": "int" + }, + "inactiveIds": { + "appliesTo": [ + "prims" + ], + "type": "int64listop" + }, + "interpolation": { + "appliesTo": [ + "attributes" + ], + "default": "constant", + "displayGroup": "Primvars", + "documentation": "How a primvar interpolates across a primitive; equivalent to RenderMan's 'class specifier'", + "type": "token" + }, + "metersPerUnit": { + "appliesTo": [ + "layers" + ], + "default": 0.01, + "displayGroup": "Stage", + "type": "double" + }, + "unauthoredValuesIndex": { + "appliesTo": [ + "attributes" + ], + "default": -1, + "displayGroup": "Primvars", + "documentation": "The index that represents unauthored values in the indices array of an indexed primvar.", + "type": "int" + }, + "upAxis": { + "appliesTo": [ + "layers" + ], + "default": "Y", + "displayGroup": "Stage", + "type": "token" + } + }, + "Types": { + "UsdGeomBasisCurves": { + "alias": { + "UsdSchemaBase": "BasisCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomBoundable": { + "alias": { + "UsdSchemaBase": "Boundable" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomCamera": { + "alias": { + "UsdSchemaBase": "Camera" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomCapsule": { + "alias": { + "UsdSchemaBase": "Capsule" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCapsule_1": { + "alias": { + "UsdSchemaBase": "Capsule_1" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCone": { + "alias": { + "UsdSchemaBase": "Cone" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCube": { + "alias": { + "UsdSchemaBase": "Cube" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCurves": { + "alias": { + "UsdSchemaBase": "Curves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "implementsComputeExtent": true, + "schemaKind": "abstractTyped" + }, + "UsdGeomCylinder": { + "alias": { + "UsdSchemaBase": "Cylinder" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCylinder_1": { + "alias": { + "UsdSchemaBase": "Cylinder_1" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomGprim": { + "alias": { + "UsdSchemaBase": "Gprim" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomHermiteCurves": { + "alias": { + "UsdSchemaBase": "HermiteCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomImageable": { + "alias": { + "UsdSchemaBase": "Imageable" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomMesh": { + "alias": { + "UsdSchemaBase": "Mesh" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomModelAPI": { + "alias": { + "UsdSchemaBase": "GeomModelAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomMotionAPI": { + "alias": { + "UsdSchemaBase": "MotionAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomNurbsCurves": { + "alias": { + "UsdSchemaBase": "NurbsCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomNurbsPatch": { + "alias": { + "UsdSchemaBase": "NurbsPatch" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomPlane": { + "alias": { + "UsdSchemaBase": "Plane" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPointBased": { + "alias": { + "UsdSchemaBase": "PointBased" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "abstractTyped" + }, + "UsdGeomPointInstancer": { + "alias": { + "UsdSchemaBase": "PointInstancer" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPoints": { + "alias": { + "UsdSchemaBase": "Points" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPrimvarsAPI": { + "alias": { + "UsdSchemaBase": "PrimvarsAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdGeomScope": { + "alias": { + "UsdSchemaBase": "Scope" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomImageable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomSphere": { + "alias": { + "UsdSchemaBase": "Sphere" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomSubset": { + "alias": { + "UsdSchemaBase": "GeomSubset" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomTetMesh": { + "alias": { + "UsdSchemaBase": "TetMesh" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomVisibilityAPI": { + "alias": { + "UsdSchemaBase": "VisibilityAPI" + }, + "apiSchemaCanOnlyApplyTo": [ + "Imageable" + ], + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomXform": { + "alias": { + "UsdSchemaBase": "Xform" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomXformCommonAPI": { + "alias": { + "UsdSchemaBase": "XformCommonAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdGeomXformable": { + "alias": { + "UsdSchemaBase": "Xformable" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomImageable" + ], + "schemaKind": "abstractTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdGeom", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Geometric schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdGeom" + string libraryPath = "pxr/usd/usdGeom" + # string libraryPrefix = "UsdGeom" + # string tokensPrefix = "UsdGeom" + bool useLiteralIdentifier = 0 + dictionary libraryTokens = { + dictionary interpolation = { + string doc = """UsdGeomPrimvar - How a Primvar interpolates + across a primitive; equivalent to RenderMan's \\ref Usd_InterpolationVals "class specifier" """ + } + dictionary elementSize = { + string doc = """UsdGeomPrimvar - The number of values in the + value array that must be aggregated for each element on the + primitive.""" + } + dictionary unauthoredValuesIndex = { + string doc = """UsdGeomPrimvar - The index that represents + unauthored values in the indices array of an indexed primvar.""" + } + dictionary constant ={ + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Default value for UsdGeomPrimvar::GetInterpolation. One value + remains constant over the entire surface primitive.""" + } + dictionary uniform = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + One value remains constant for each uv patch segment of the + surface primitive (which is a \\em face for meshes).""" + } + dictionary varying = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Four values are interpolated over each uv patch segment of the + surface. Bilinear interpolation is used for interpolation + between the four values.""" + } + dictionary vertex = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Values are interpolated between each vertex in the surface + primitive. The basis function of the surface is used for + interpolation between vertices.""" + } + dictionary faceVarying = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + For polygons and subdivision surfaces, four values are + interpolated over each face of the mesh. Bilinear interpolation + is used for interpolation between the four values.""" + } + dictionary upAxis = { + string doc = """Stage-level metadata that encodes a scene's + orientation as a token whose value can be "Y" or "Z".""" + } + dictionary metersPerUnit = { + string doc = """Stage-level metadata that encodes a scene's + linear unit of measure as meters per encoded unit.""" + } + dictionary partition = { + string doc = """A type of family of GeomSubsets. It implies + that every element appears exacly once in only one of the + subsets in the family.""" + } + dictionary nonOverlapping = { + string doc = """A type of family of GeomSubsets. It implies that + the elements in the various subsets belonging to the family are + mutually exclusive, i.e., an element that appears in one + subset may not belong to any other subset in the family.""" + } + dictionary unrestricted = { + string doc = """A type of family of GeomSubsets. It implies that + there are no restrictions w.r.t. the membership of elements in + the subsets. There could be overlapping members in subsets + belonging to the family and the union of all subsets in the + family may not contain all the elements.""" + } + dictionary hermite = { + string doc = """A deprecated basis token for + UsdGeomBasisCurves. Consumers of USD should transition + to using the UsdGeomHermiteCurves schema.""" + } + dictionary power = { + string doc = """A deprecated basis token for + UsdGeomBasisCurves.""" + } + } + } +) +{ +} + +class "Imageable" ( + inherits = + doc = """Base class for all prims that may require rendering or + visualization of some sort. The primary attributes of Imageable + are \\em visibility and \\em purpose, which each provide instructions for + what geometry should be included for processing by rendering and other + computations. + + \\deprecated Imageable also provides API for accessing primvars, which + has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now + be applied on non-Imageable prim types. This API is planned + to be removed, UsdGeomPrimvarsAPI should be used directly instead.""" + customData = { + string extraIncludes = """ +#include "pxr/base/gf/bbox3d.h" +#include "pxr/usd/usdGeom/primvar.h" """ + } +) { + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = """Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.""" + ) + + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See \\ref UsdGeom_ImageablePurpose for more detail about how + \\em purpose is computed and used.""" + ) + rel proxyPrim ( + doc = """The \\em proxyPrim relationship allows us to link a + prim whose \\em purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + \\li In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + \\li DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + \\li With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".""" + ) +} + +class "VisibilityAPI" +( + inherits = + customData = { + token[] apiSchemaCanOnlyApplyTo = [ + "Imageable" + ] + } + doc = """ + UsdGeomVisibilityAPI introduces properties that can be used to author + visibility opinions. + + \\note + Currently, this schema only introduces the attributes that are used to + control purpose visibility. Later, this schema will define _all_ + visibility-related properties and UsdGeomImageable will no longer define + those properties. + + The purpose visibility attributes added by this schema, + _guideVisibility_, _proxyVisibility_, and _renderVisibility_ can each be + used to control visibility for geometry of the corresponding purpose + values, with the overall _visibility_ attribute acting as an + override. I.e., if _visibility_ evaluates to "invisible", purpose + visibility is invisible; otherwise, purpose visibility is determined by + the corresponding purpose visibility attribute. + + Note that the behavior of _guideVisibility_ is subtly different from the + _proxyVisibility_ and _renderVisibility_ attributes, in that "guide" + purpose visibility always evaluates to either "invisible" or "visible", + whereas the other attributes may yield computed values of "inherited" if + there is no authored opinion on the attribute or inherited from an + ancestor. This is motivated by the fact that, in Pixar"s user workflows, + we have never found a need to have all guides visible in a scene by + default, whereas we do find that flexibility useful for "proxy" and + "render" geometry. + + This schema can only be applied to UsdGeomImageable prims. The + UseGeomImageable schema provides API for computing the purpose visibility + values that result from the attributes introduced by this schema. + """ +) +{ + uniform token guideVisibility = "invisible" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose "guide". + + Unlike overall _visibility_, _guideVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _guideVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _guideVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "guide" + is determined by the inherited values it receives for the _visibility_ + and _guideVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" and _guideVisibility_ evaluates to "visible", then the + prim is visible. __Otherwise, it is invisible.__ + """ + ) + + uniform token proxyVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose "proxy". + + Unlike overall _visibility_, _proxyVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _proxyVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _proxyVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "proxy" + is determined by the inherited values it receives for the _visibility_ + and _proxyVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _proxyVisibility_ evaluates to "visible", then + the prim is visible; if _proxyVisibility_ evaluates to "invisible", + then the prim is invisible; if _proxyVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + """ + ) + + uniform token renderVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose + "render". + + Unlike overall _visibility_, _renderVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _renderVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _renderVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "render" + is determined by the inherited values it receives for the _visibility_ + and _renderVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _renderVisibility_ evaluates to "visible", then + the prim is visible; if _renderVisibility_ evaluates to "invisible", + then the prim is invisible; if _renderVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + """ + ) +} + +class "PrimvarsAPI" ( + inherits = + doc = """UsdGeomPrimvarsAPI encodes geometric "primitive variables", + as UsdGeomPrimvar, which interpolate across a primitive's topology, + can override shader inputs, and inherit down namespace. + + \\section usdGeom_PrimvarFetchingAPI Which Method to Use to Retrieve Primvars + + While creating primvars is unambiguous (CreatePrimvar()), there are quite + a few methods available for retrieving primvars, making it potentially + confusing knowing which one to use. Here are some guidelines: + + \\li If you are populating a GUI with the primvars already available for + authoring values on a prim, use GetPrimvars(). + \\li If you want all of the "useful" (e.g. to a renderer) primvars + available at a prim, including those inherited from ancestor prims, use + FindPrimvarsWithInheritance(). Note that doing so individually for many + prims will be inefficient. + \\li To find a particular primvar defined directly on a prim, which may + or may not provide a value, use GetPrimvar(). + \\li To find a particular primvar defined on a prim or inherited from + ancestors, which may or may not provide a value, use + FindPrimvarWithInheritance(). + \\li To *efficiently* query for primvars using the overloads of + FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one + must first cache the results of FindIncrementallyInheritablePrimvars() for + each non-leaf prim on the stage. """ + customData = { + token apiSchemaType = "nonApplied" + string extraIncludes = """ +#include "pxr/usd/usdGeom/primvar.h" """ + } +) { +} + +class "Xformable" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usdGeom/xformOp.h" +#include """ + } + doc = """Base class for all transformable prims, which allows arbitrary + sequences of component affine transformations to be encoded. + + \\note + You may find it useful to review \\ref UsdGeom_LinAlgBasics while reading + this class description. + + Supported Component Transformation Operations + + UsdGeomXformable currently supports arbitrary sequences of the following + operations, each of which can be encoded in an attribute of the proper + shape in any supported precision: + \\li translate - 3D + \\li scale - 3D + \\li rotateX - 1D angle in degrees + \\li rotateY - 1D angle in degrees + \\li rotateZ - 1D angle in degrees + \\li rotateABC - 3D where ABC can be any combination of the six principle + Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See + \\ref usdGeom_rotationPackingOrder "note on rotation packing order" + \\li orient - 4D (quaternion) + \\li transform - 4x4D + + Creating a Component Transformation + + To add components to a UsdGeomXformable prim, simply call AddXformOp() + with the desired op type, as enumerated in \\ref UsdGeomXformOp::Type, + and the desired precision, which is one of \\ref UsdGeomXformOp::Precision. + Optionally, you can also provide an "op suffix" for the operator that + disambiguates it from other components of the same type on the same prim. + Application-specific transform schemas can use the suffixes to fill a role + similar to that played by AbcGeom::XformOp's "Hint" enums for their own + round-tripping logic. + + We also provide specific "Add" API for each type, for clarity and + conciseness, e.g. AddTranslateOp(), AddRotateXYZOp() etc. + + AddXformOp() will return a UsdGeomXformOp object, which is a schema on a + newly created UsdAttribute that provides convenience API for authoring + and computing the component transformations. The UsdGeomXformOp can then + be used to author any number of timesamples and default for the op. + + Each successive call to AddXformOp() adds an operator that will be applied + "more locally" than the preceding operator, just as if we were pushing + transforms onto a transformation stack - which is precisely what should + happen when the operators are consumed by a reader. + + \\note + If you can, please try to use the UsdGeomXformCommonAPI, which wraps + the UsdGeomXformable with an interface in which Op creation is taken + care of for you, and there is a much higher chance that the data you + author will be importable without flattening into other DCC's, as it + conforms to a fixed set of Scale-Rotate-Translate Ops. + + \\sa \\ref usdGeom_xformableExamples "Using the Authoring API" + + Data Encoding and Op Ordering + + Because there is no "fixed schema" of operations, all of the attributes + that encode transform operations are dynamic, and are scoped in + the namespace "xformOp". The second component of an attribute's name provides + the \\em type of operation, as listed above. An "xformOp" attribute can + have additional namespace components derived from the \\em opSuffix argument + to the AddXformOp() suite of methods, which provides a preferred way of + naming the ops such that we can have multiple "translate" ops with unique + attribute names. For example, in the attribute named + "xformOp:translate:maya:pivot", "translate" is the type of operation and + "maya:pivot" is the suffix. + + The following ordered list of attribute declarations in usda + define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the + translation is double-precision, and the remainder of the ops are single, + in which we will: + +
    +
  1. Scale by 2.0 in each dimension +
  2. Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively +
  3. Translate by 100 units in the Y direction +
+ + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale" ] + \\endcode + + The attributes appear in the dictionary order in which USD, by default, + sorts them. To ensure the ops are recovered and evaluated in the correct + order, the schema introduces the **xformOpOrder** attribute, which + contains the names of the op attributes, in the precise sequence in which + they should be pushed onto a transform stack. **Note** that the order is + opposite to what you might expect, given the matrix algebra described in + \\ref UsdGeom_LinAlgBasics. This also dictates order of op creation, + since each call to AddXformOp() adds a new op to the end of the + \\b xformOpOrder array, as a new "most-local" operation. See + \\ref usdGeom_xformableExamples "Example 2 below" for C++ code that could + have produced this USD. + + If it were important for the prim's rotations to be independently + overridable, we could equivalently (at some performance cost) encode + the transformation also like so: + \\code + float xformOp:rotateX = 30 + float xformOp:rotateY = 60 + float xformOp:rotateZ = 90 + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateZ", "xformOp:rotateY", "xformOp:rotateX", "xformOp:scale" ] + \\endcode + + Again, note that although we are encoding an XYZ rotation, the three + rotations appear in the **xformOpOrder** in the opposite order, with Z, + followed, by Y, followed by X. + + Were we to add a Maya-style scalePivot to the above example, it might + look like the following: + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + double3 xformOp:translate:scalePivot + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale" ] + \\endcode + + Paired "Inverted" Ops + + We have been claiming that the ordered list of ops serves as a set + of instructions to a transform stack, but you may have noticed in the last + example that there is a missing operation - the pivot for the scale op + needs to be applied in its inverse-form as a final (most local) op! In the + AbcGeom::Xform schema, we would have encoded an actual "final" translation + op whose value was authored by the exporter as the negation of the pivot's + value. However, doing so would be brittle in USD, given that each op can + be independently overridden, and the constraint that one attribute must be + maintained as the negation of the other in order for successful + re-importation of the schema cannot be expressed in USD. + + Our solution leverages the **xformOpOrder** member of the schema, which, + in addition to ordering the ops, may also contain one of two special + tokens that address the paired op and "stack resetting" behavior. + + The "paired op" behavior is encoded as an "!invert!" prefix in + \\b xformOpOrder, as the result of an AddXformOp(isInverseOp=True) call. + The \\b xformOpOrder for the last example would look like: + \\code + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale", "!invert!xformOp:translate:scalePivot" ] + \\endcode + + When asked for its value via UsdGeomXformOp::GetOpTransform(), an + "inverted" Op (i.e. the "inverted" half of a set of paired Ops) will fetch + the value of its paired attribute and return its negation. This works for + all op types - an error will be issued if a "transform" type op is singular + and cannot be inverted. When getting the authored value of an inverted op + via UsdGeomXformOp::Get(), the raw, uninverted value of the associated + attribute is returned. + + For the sake of robustness, setting a value on an inverted op is disallowed. + Attempting to set a value on an inverted op will result in a coding error + and no value being set. + + Resetting the Transform Stack + + The other special op/token that can appear in \\em xformOpOrder is + \\em "!resetXformStack!", which, appearing as the first element of + \\em xformOpOrder, indicates this prim should not inherit the transformation + of its namespace parent. See SetResetXformStack() + + Expected Behavior for "Missing" Ops + + If an importer expects Scale-Rotate-Translate operations, but a prim + has only translate and rotate ops authored, the importer should assume + an identity scale. This allows us to optimize the data a bit, if only + a few components of a very rich schema (like Maya's) are authored in the + app. + + \\anchor usdGeom_xformableExamples + Using the C++ API + + #1. Creating a simple transform matrix encoding + \\snippet examples_usdGeom.cpp CreateMatrixWithDefault + + #2. Creating the simple SRT from the example above + \\snippet examples_usdGeom.cpp CreateExampleSRT + + #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI + \\snippet examples_usdGeom.cpp CreateSRTWithDefaults + + #4. Creating a rotate-only pivot transform with animated + rotation and translation + \\snippet examples_usdGeom.cpp CreateAnimatedTransform + +""" +) { + + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Scope "Scope" ( + inherits = + doc = """Scope is the simplest grouping primitive, and does not carry the + baggage of transformability. Note that transforms should inherit down + through a Scope successfully - it is just a guaranteed no-op from a + transformability perspective.""" +) { +} + +class Xform "Xform" ( + inherits = + doc = """Concrete prim schema for a transform, which implements Xformable """ +) { +} + +class "Boundable" ( + inherits = + doc = """Boundable introduces the ability for a prim to persistently + cache a rectilinear, local-space, extent. + + \\section UsdGeom_Boundable_Extent Why Extent and not Bounds ? + Boundable introduces the notion of "extent", which is a cached computation + of a prim's local-space 3D range for its resolved attributes at the + layer and time in which extent is authored. We have found that with + composed scene description, attempting to cache pre-computed bounds at + interior prims in a scene graph is very fragile, given the ease with which + one can author a single attribute in a stronger layer that can invalidate + many authored caches - or with which a re-published, referenced asset can + do the same. + + Therefore, we limit to precomputing (generally) leaf-prim extent, which + avoids the need to read in large point arrays to compute bounds, and + provides UsdGeomBBoxCache the means to efficiently compute and + (session-only) cache intermediate bounds. You are free to compute and + author intermediate bounds into your scenes, of course, which may work + well if you have sufficient locks on your pipeline to guarantee that once + authored, the geometry and transforms upon which they are based will + remain unchanged, or if accuracy of the bounds is not an ironclad + requisite. + + When intermediate bounds are authored on Boundable parents, the child prims + will be pruned from BBox computation; the authored extent is expected to + incorporate all child bounds.""" +) +{ + # XXX: Note this is really a GfRange3f, which is not fully supported + # in Vt I/O. + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), \\em without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) +} + +class "Gprim" ( + inherits = + doc = """Base class for all geometric primitives. + + Gprim encodes basic graphical properties such as \\em doubleSided and + \\em orientation, and provides primvars for "display color" and "display + opacity" that travel with geometry to be used as shader overrides. """ + +) { + color3f[] primvars:displayColor ( + customData = { + string apiName = "displayColor" + } + doc = """It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a \\em displayColor parameter.""" + ) + + float[] primvars:displayOpacity ( + customData = { + string apiName = "displayOpacity" + } + doc = """Companion to \\em displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + + uniform bool doubleSided = false ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + \\em orientation. By doing so they can perform "backface culling" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's \\em doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see \\ref UsdGeom_WindingOrder for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) +} + +class Cube "Cube" ( + inherits = + doc = """Defines a primitive rectilinear cube centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double size = 2.0 ( + doc = """Indicates the length of each edge of the cube. If you + author \\em size you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cube only to provide a fallback value. + \\sa UsdGeomGprim::GetExtentAttr().""" + ) + +} + +class Sphere "Sphere" ( + inherits = + doc = """Defines a primitive sphere centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double radius = 1.0 ( + doc = """Indicates the sphere's radius. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Sphere only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cylinder "Cylinder" ( + inherits = + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified \\em axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2 ( + doc = """The size of the cylinder's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radius = 1.0 ( + doc = """The radius of the cylinder. If you author \\em radius + you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cylinder is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Capsule "Capsule" ( + inherits = + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, centered at the origin, whose spine is along the specified + \\em axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 1.0 ( + doc = """The length of the capsule's spine along the specified + \\em axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author \\em height you must also author \\em extent. + \\sa GetExtentAttr()""" + ) + double radius = 0.5 ( + doc = """The radius of the capsule. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the capsule is aligned""" + ) + + float3[] extent = [(-0.5, -0.5, -1.0), (0.5, 0.5, 1.0)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cone "Cone" ( + inherits = + doc = """Defines a primitive cone, centered at the origin, whose spine + is along the specified \\em axis, with the apex of the cone pointing + in the direction of the positive axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2.0 ( + doc = """The length of the cone's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radius = 1.0 ( + doc = """The radius of the cone. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cone is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cone only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cylinder_1 "Cylinder_1" ( + inherits = + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified \\em axis, with a pair of radii + describing the size of the end points. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2 ( + doc = """The length of the cylinder's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 1.0 ( + doc = """The radius of the top of the cylinder - i.e. the face located + along the positive \\em axis. If you author \\em radiusTop you must also + author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusBottom = 1.0 ( + doc = """The radius of the bottom of the cylinder - i.e. the face + point located along the negative \\em axis. If you author + \\em radiusBottom you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cylinder is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Capsule_1 "Capsule_1" ( + inherits = + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, with potentially different radii, centered at the origin, and whose + spine is along the specified \\em axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 1.0 ( + doc = """The length of the capsule's spine along the specified + \\em axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author \\em height you must also author \\em extent. + \\sa GetExtentAttr()""" + ) + double radiusTop = 0.5 ( + doc = """The radius of the capping sphere at the top of the capsule - + i.e. the sphere in the direction of the positive \\em axis. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusBottom = 0.5 ( + doc = """The radius of the capping sphere at the bottom of the capsule - + i.e. the sphere located in the direction of the negative \\em axis. If + you author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the capsule is aligned""" + ) + + float3[] extent = [(-0.5, -0.5, -1.0), (0.5, 0.5, 1.0)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Plane "Plane" ( + inherits = + doc = """Defines a primitive plane, centered at the origin, and is defined by + a cardinal axis, width, and length. The plane is double-sided by default. + + The axis of width and length are perpendicular to the plane's \\em axis: + + axis | width | length + ----- | ------ | ------- + X | z-axis | y-axis + Y | x-axis | z-axis + Z | x-axis | y-axis + + """ + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + uniform bool doubleSided = true ( + doc = """Planes are double-sided by default. Clients may also support + single-sided planes. + + \\sa UsdGeomGprim::GetDoubleSidedAttr()""" + ) + double width = 2.0 ( + doc = """The width of the plane, which aligns to the x-axis when \\em axis is + 'Z' or 'Y', or to the z-axis when \\em axis is 'X'. If you author \\em width + you must also author \\em extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + double length = 2.0 ( + doc = """The length of the plane, which aligns to the y-axis when \\em axis is + 'Z' or 'X', or to the z-axis when \\em axis is 'Y'. If you author \\em length + you must also author \\em extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the surface of the plane is aligned. When set + to 'Z' the plane is in the xy-plane; when \\em axis is 'X' the plane is in + the yz-plane, and when \\em axis is 'Y' the plane is in the xz-plane. + + \\sa UsdGeomGprim::GetAxisAttr().""" + ) + float3[] extent = [(-1.0, -1.0, 0.0), (1.0, 1.0, 0.0)] ( + doc = """Extent is re-defined on Plane only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class "PointBased" ( + doc = """Base class for all UsdGeomGprims that possess points, + providing common attributes such as normals and velocities.""" + + inherits = + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + # positional + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeom_VelocityInterpolation .""" + ) + + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + + # shaping + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + \\ref SetNormalsInterpolation() . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) +} + +class Mesh "Mesh" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/timeCode.h" """ + } + doc="""Encodes a mesh with optional subdivision properties and features. + + As a point-based primitive, meshes are defined in terms of points that + are connected into edges and faces. Many references to meshes use the + term 'vertex' in place of or interchangeably with 'points', while some + use 'vertex' to refer to the 'face-vertices' that define a face. To + avoid confusion, the term 'vertex' is intentionally avoided in favor of + 'points' or 'face-vertices'. + + The connectivity between points, edges and faces is encoded using a + common minimal topological description of the faces of the mesh. Each + face is defined by a set of face-vertices using indices into the Mesh's + _points_ array (inherited from UsdGeomPointBased) and laid out in a + single linear _faceVertexIndices_ array for efficiency. A companion + _faceVertexCounts_ array provides, for each face, the number of + consecutive face-vertices in _faceVertexIndices_ that define the face. + No additional connectivity information is required or constructed, so + no adjacency or neighborhood queries are available. + + A key property of this mesh schema is that it encodes both subdivision + surfaces and simpler polygonal meshes. This is achieved by varying the + _subdivisionScheme_ attribute, which is set to specify Catmull-Clark + subdivision by default, so polygonal meshes must always be explicitly + declared. The available subdivision schemes and additional subdivision + features encoded in optional attributes conform to the feature set of + OpenSubdiv + (https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html). + + \\anchor UsdGeom_Mesh_Primvars + __A Note About Primvars__ + + The following list clarifies the number of elements for and the + interpolation behavior of the different primvar interpolation types + for meshes: + + - __constant__: One element for the entire mesh; no interpolation. + - __uniform__: One element for each face of the mesh; elements are + typically not interpolated but are inherited by other faces derived + from a given face (via subdivision, tessellation, etc.). + - __varying__: One element for each point of the mesh; + interpolation of point data is always linear. + - __vertex__: One element for each point of the mesh; + interpolation of point data is applied according to the + _subdivisionScheme_ attribute. + - __faceVarying__: One element for each of the face-vertices that + define the mesh topology; interpolation of face-vertex data may + be smooth or linear, according to the _subdivisionScheme_ and + _faceVaryingLinearInterpolation_ attributes. + + Primvar interpolation types and related utilities are described more + generally in \\ref Usd_InterpolationVals. + + \\anchor UsdGeom_Mesh_Normals + __A Note About Normals__ + + Normals should not be authored on a subdivision mesh, since subdivision + algorithms define their own normals. They should only be authored for + polygonal meshes (_subdivisionScheme_ = "none"). + + The _normals_ attribute inherited from UsdGeomPointBased is not a generic + primvar, but the number of elements in this attribute will be determined by + its _interpolation_. See \\ref UsdGeomPointBased::GetNormalsInterpolation() . + If _normals_ and _primvars:normals_ are both specified, the latter has + precedence. If a polygonal mesh specifies __neither__ _normals_ nor + _primvars:normals_, then it should be treated and rendered as faceted, + with no attempt to compute smooth normals. + + The normals generated for smooth subdivision schemes, e.g. Catmull-Clark + and Loop, will likewise be smooth, but others, e.g. Bilinear, may be + discontinuous between faces and/or within non-planar irregular faces.""" +) { + # + # Common Properties + # + int[] faceVertexIndices ( + doc = """Flat list of the index (into the _points_ attribute) of each + vertex of each face in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + + int[] faceVertexCounts ( + doc = """Provides the number of vertices in each face of the mesh, + which is also the number of consecutive indices in _faceVertexIndices_ + that define the face. The length of this attribute is the number of + faces in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + + # + # Subdiv Properties + # + + uniform token subdivisionScheme = "catmullClark" ( + allowedTokens = ["catmullClark", "loop", "bilinear", "none"] + doc = """The subdivision scheme to be applied to the surface. + Valid values are: + + - __catmullClark__: The default, Catmull-Clark subdivision; preferred + for quad-dominant meshes (generalizes B-splines); interpolation + of point data is smooth (non-linear) + - __loop__: Loop subdivision; preferred for purely triangular meshes; + interpolation of point data is smooth (non-linear) + - __bilinear__: Subdivision reduces all faces to quads (topologically + similar to "catmullClark"); interpolation of point data is bilinear + - __none__: No subdivision, i.e. a simple polygonal mesh; interpolation + of point data is linear + + Polygonal meshes are typically lighter weight and faster to render, + depending on renderer and render mode. Use of "bilinear" will produce + a similar shape to a polygonal mesh and may offer additional guarantees + of watertightness and additional subdivision features (e.g. holes) but + may also not respect authored normals.""") + + token interpolateBoundary = "edgeAndCorner" ( + allowedTokens = ["none", "edgeOnly", "edgeAndCorner"] + doc = """Specifies how subdivision is applied for faces adjacent to + boundary edges and boundary points. Valid values correspond to choices + available in OpenSubdiv: + + - __none__: No boundary interpolation is applied and boundary faces are + effectively treated as holes + - __edgeOnly__: A sequence of boundary edges defines a smooth curve to + which the edges of subdivided boundary faces converge + - __edgeAndCorner__: The default, similar to "edgeOnly" but the smooth + boundary curve is made sharp at corner points + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#boundary-interpolation-rules""") + + token faceVaryingLinearInterpolation = "cornersPlus1" ( + allowedTokens = ["none", "cornersOnly", "cornersPlus1", + "cornersPlus2", "boundaries", "all"] + doc = """Specifies how elements of a primvar of interpolation type + "faceVarying" are interpolated for subdivision surfaces. Interpolation + can be as smooth as a "vertex" primvar or constrained to be linear at + features specified by several options. Valid values correspond to + choices available in OpenSubdiv: + + - __none__: No linear constraints or sharpening, smooth everywhere + - __cornersOnly__: Sharpen corners of discontinuous boundaries only, + smooth everywhere else + - __cornersPlus1__: The default, same as "cornersOnly" plus additional + sharpening at points where three or more distinct face-varying + values occur + - __cornersPlus2__: Same as "cornersPlus1" plus additional sharpening + at points with at least one discontinuous boundary corner or + only one discontinuous boundary edge (a dart) + - __boundaries__: Piecewise linear along discontinuous boundaries, + smooth interior + - __all__: Piecewise linear everywhere + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules""") + + token triangleSubdivisionRule = "catmullClark" ( + allowedTokens = ["catmullClark", "smooth"] + doc = """Specifies an option to the subdivision rules for the + Catmull-Clark scheme to try and improve undesirable artifacts when + subdividing triangles. Valid values are "catmullClark" for the + standard rules (the default) and "smooth" for the improvement. + + See https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle-subdivision-rule""") + + int[] holeIndices = [] ( + doc = """The indices of all faces that should be treated as holes, + i.e. made invisible. This is traditionally a feature of subdivision + surfaces and not generally applied to polygonal meshes.""") + + int[] cornerIndices = [] ( + doc = """The indices of points for which a corresponding sharpness + value is specified in _cornerSharpnesses_ (so the size of this array + must match that of _cornerSharpnesses_).""") + + float[] cornerSharpnesses = [] ( + doc = """The sharpness values associated with a corresponding set of + points specified in _cornerIndices_ (so the size of this array must + match that of _cornerIndices_). Use the constant `SHARPNESS_INFINITE` + for a perfectly sharp corner.""") + + int[] creaseIndices = [] ( + doc = """The indices of points grouped into sets of successive pairs + that identify edges to be creased. The size of this array must be + equal to the sum of all elements of the _creaseLengths_ attribute.""") + + int[] creaseLengths = [] ( + doc = """The length of this array specifies the number of creases + (sets of adjacent sharpened edges) on the mesh. Each element gives + the number of points of each crease, whose indices are successively + laid out in the _creaseIndices_ attribute. Since each crease must + be at least one edge long, each element of this array must be at + least two.""") + + float[] creaseSharpnesses = [] ( + doc = """The per-crease or per-edge sharpness values for all creases. + Since _creaseLengths_ encodes the number of points in each crease, + the number of elements in this array will be either len(creaseLengths) + or the sum over all X of (creaseLengths[X] - 1). Note that while + the RI spec allows each crease to have either a single sharpness + or a value per-edge, USD will encode either a single sharpness + per crease on a mesh, or sharpnesses for all edges making up + the creases on a mesh. Use the constant `SHARPNESS_INFINITE` for a + perfectly sharp crease.""") +} + +class TetMesh "TetMesh" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/timeCode.h" """ + } + doc="""Encodes a tetrahedral mesh. A tetrahedral mesh is defined as a set of + tetrahedra. Each tetrahedron is defined by a set of 4 points, with the + triangles of the tetrahedron determined from these 4 points as described in + the tetVertexIndices attribute description. The mesh surface faces + are encoded as triangles. Surface faces must be provided for consumers + that need to do surface calculations, such as renderers or consumers using + physics attachments. Both tetrahedra and surface face definitions use + indices into the TetMesh's points attribute, inherited from + UsdGeomPointBased.""" +) { + # + # Common Properties + # + int4[] tetVertexIndices ( + doc = """Flat list of the index (into the points attribute) of + each vertex of each tetrahedron in the mesh. Each int4 corresponds to the + indices of a single tetrahedron. Users should set the orientation + attribute of UsdGeomPrim accordingly. That is if the orientation + is "rightHanded", the CCW face ordering of a tetrahedron is + [123],[032],[013],[021] with respect to the int4. This results in the + normals facing outward from the center of the tetrahedron. The following + diagram shows the face ordering of an unwrapped tetrahedron with + "rightHanded" orientation. + + \\image html USDTetMeshRightHanded.svg + + If the orientation attribute is set to "leftHanded" the face + ordering of the tetrahedron is [321],[230],[310],[120] and the + leftHanded CW face normals point outward from the center of the + tetrahedron. The following diagram shows the face ordering of an + unwrapped tetrahedron with "leftHanded" orientation. + + \\image html USDTetMeshLeftHanded.svg + + Setting the orientation attribute to align with the + ordering of the int4 for the tetrahedrons is the responsibility of the + user.""" + ) + + int3[] surfaceFaceVertexIndices ( + doc = """surfaceFaceVertexIndices defines the triangle + surface faces indices wrt. points of the tetmesh surface. Again + the orientation attribute inherited from UsdGeomPrim should be + set accordingly. The orientation for faces of tetrahedra and + surface faces must match.""" + ) +} + +class GeomSubset "GeomSubset" ( + inherits = + doc = """Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) + as a set of indices. Currently supports encoding subsets of faces, + points, edges, and tetrahedrons. + + To apply to a geometric prim, a GeomSubset prim must be the prim's direct + child in namespace, and possess a concrete defining specifier (i.e. def). + This restriction makes it easy and efficient to discover subsets of a prim. + We might want to relax this restriction if it's common to have multiple + families of subsets on a gprim and if it's useful to be able to + organize subsets belonging to a family under a common scope. See + 'familyName' attribute for more info on defining a family of subsets. + + Note that a GeomSubset isn't an imageable (i.e. doesn't derive from + UsdGeomImageable). So, you can't author visibility for it or + override its purpose. + + Materials are bound to GeomSubsets just as they are for regular + geometry using API available in UsdShade (UsdShadeMaterial::Bind). +""" + customData = { + string className = "Subset" + string extraIncludes = """ +#include "pxr/base/tf/token.h" +#include "pxr/usd/usdGeom/imageable.h" +#include "pxr/usd/usdGeom/mesh.h" +#include "pxr/usd/usdGeom/tetMesh.h" +""" + } +) +{ + uniform token elementType = "face" ( + allowedTokens = ["face", "point", "edge", "tetrahedron"] + doc = """The type of element that the indices target. "elementType" can + have one of the following values: +
  • face: Identifies faces on a Gprim's surface. For a + UsdGeomMesh, each element of the _indices_ attribute would refer to + an element of the Mesh's _faceCounts_ attribute. For a UsdGeomTetMesh, + each element of the _indices_ attribute would refer to an element of + the Mesh's _surfaceFaceVertexIndices_ attribute.
  • +
  • point: for any UsdGeomPointBased, each + element of the _indices_ attribute would refer to an element of the + Mesh's _points_ attribute
  • +
  • edge: for any UsdGeomMesh, each pair of elements + in the _indices_ attribute would refer to a pair of points of the + Mesh's _points_ attribute that are connected as an implicit edge on the + Mesh. These edges are derived from the Mesh's _faceVertexIndices_ + attribute. Edges are not currently defined for a UsdGeomTetMesh, but + could be derived from all tetrahedron edges or surface face edges only + if a specific use-case arises.
  • +
  • tetrahedron: for any UsdGeomTetMesh, each element of the + _indices_ attribute would refer to an element of the TetMesh's + _tetVertexIndices_ attribute. +
""" + ) + int[] indices = [] ( + doc = """The set of indices included in this subset. The indices need not + be sorted, but the same index should not appear more than once. Indices + are invalid if outside the range [0, elementCount) for the given time on + the parent geometric prim.""" + ) + uniform token familyName = "" ( + doc = """The name of the family of subsets that this subset belongs to. + This is optional and is primarily useful when there are multiple + families of subsets under a geometric prim. In some cases, this could + also be used for achieving proper roundtripping of subset data between + DCC apps. + When multiple subsets belonging to a prim have the same familyName, they + are said to belong to the family. A familyType value can be + encoded on the owner of a family of subsets as a token using the static + method UsdGeomSubset::SetFamilyType(). "familyType" can have one of the + following values: +
  • UsdGeomTokens->partition: implies that every element of + the whole geometry appears exactly once in only one of the subsets + belonging to the family.
  • +
  • UsdGeomTokens->nonOverlapping: an element that appears in one + subset may not appear in any other subset belonging to the family, and + appears only once in the subset in which it appears.
  • +
  • UsdGeomTokens->unrestricted: implies that there are no + restrictions w.r.t. the membership of elements in the subsets. They + could be overlapping and the union of all subsets in the family may + not represent the whole.
  • +
+ \\note The validity of subset data is not enforced by the authoring + APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). + """ + ) +} + +class NurbsPatch "NurbsPatch" ( + inherits = + doc = """Encodes a rational or polynomial non-uniform B-spline + surface, with optional trim curves. + + The encoding mostly follows that of RiNuPatch and RiTrimCurve: + https://renderman.pixar.com/resources/RenderMan_20/geometricPrimitives.html#rinupatch , with some minor renaming and coalescing for clarity. + + The layout of control vertices in the \\em points attribute inherited + from UsdGeomPointBased is row-major with U considered rows, and V columns. + + \\anchor UsdGeom_NurbsPatch_Form + NurbsPatch Form + + The authored points, orders, knots, weights, and ranges are all that is + required to render the nurbs patch. However, the only way to model closed + surfaces with nurbs is to ensure that the first and last control points + along the given axis are coincident. Similarly, to ensure the surface is + not only closed but also C2 continuous, the last \\em order - 1 control + points must be (correspondingly) coincident with the first \\em order - 1 + control points, and also the spacing of the last corresponding knots + must be the same as the first corresponding knots. + + Form is provided as an aid to interchange between modeling and + animation applications so that they can robustly identify the intent with + which the surface was modelled, and take measures (if they are able) to + preserve the continuity/concidence constraints as the surface may be rigged + or deformed. + \\li An \\em open-form NurbsPatch has no continuity constraints. + \\li A \\em closed-form NurbsPatch expects the first and last control points + to overlap + \\li A \\em periodic-form NurbsPatch expects the first and last + \\em order - 1 control points to overlap. + + Nurbs vs Subdivision Surfaces + + Nurbs are an important modeling primitive in CAD/CAM tools and early + computer graphics DCC's. Because they have a natural UV parameterization + they easily support "trim curves", which allow smooth shapes to be + carved out of the surface. + + However, the topology of the patch is always rectangular, and joining two + nurbs patches together (especially when they have differing numbers of + spans) is difficult to do smoothly. Also, nurbs are not supported by + the Ptex texturing technology (http://ptex.us). + + Neither of these limitations are shared by subdivision surfaces; therefore, + although they do not subscribe to trim-curve-based shaping, subdivs are + often considered a more flexible modeling primitive. + """ +) { + int uVertexCount ( + doc = """Number of vertices in the U direction. Should be at least as + large as uOrder.""" + ) + + int vVertexCount ( + doc = """Number of vertices in the V direction. Should be at least as + large as vOrder.""" + ) + + int uOrder ( + doc = """Order in the U direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + + int vOrder ( + doc = """Order in the V direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + + double[] uKnots ( + doc = """Knot vector for U direction providing U parameterization. + The length of this array must be ( uVertexCount + uOrder ), and its + entries must take on monotonically increasing values.""" + ) + + double[] vKnots ( + doc = """Knot vector for V direction providing U parameterization. + The length of this array must be ( vVertexCount + vOrder ), and its + entries must take on monotonically increasing values.""" + ) + + uniform token uForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = """Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the U dimension. + \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ + ) + + uniform token vForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = """Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the V dimension. + \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ + ) + + # Alembic's NuPatch does not encode these... wonder how they + # get away with that? Just assume it's the full range, presumably. + double2 uRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by uKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of uKnots[uOrder-1]. The maxium must be less than or equal + to the last element's value in uKnots.""" + ) + + double2 vRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by vKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of vKnots[vOrder-1]. The maxium must be less than or equal + to the last element's value in vKnots.""" + ) + + double[] pointWeights ( + doc = """Optionally provides "w" components for each control point, + thus must be the same length as the points attribute. If authored, + the patch will be rational. If unauthored, the patch will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the \\em points, but in this schema, + \\em points are not pre-weighted.""" + ) + + int[] trimCurve:counts ( + doc = """Each element specifies how many curves are present in each + "loop" of the trimCurve, and the length of the array determines how + many loops the trimCurve contains. The sum of all elements is the + total nuber of curves in the trim, to which we will refer as + \\em nCurves in describing the other trim attributes.""" + ) + + int[] trimCurve:orders ( + doc = """Flat list of orders for each of the \\em nCurves curves.""" + ) + + int[] trimCurve:vertexCounts ( + doc = """Flat list of number of vertices for each of the + \\em nCurves curves.""" + ) + + double[] trimCurve:knots ( + doc = """Flat list of parametric values for each of the + \\em nCurves curves. There will be as many knots as the sum over + all elements of \\em vertexCounts plus the sum over all elements of + \\em orders.""" + ) + + double2[] trimCurve:ranges ( + doc = """Flat list of minimum and maximum parametric values + (as defined by \\em knots) for each of the \\em nCurves curves.""" + ) + + double3[] trimCurve:points ( + doc = """Flat list of homogeneous 2D points (u, v, w) that comprise + the \\em nCurves curves. The number of points should be equal to the + um over all elements of \\em vertexCounts.""" + ) + +} + +class "Curves" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } + inherits = + doc = """Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and + UsdGeomHermiteCurves. The BasisCurves schema is designed to be + analagous to offline renderers' notion of batched curves (such as + the classical RIB definition via Basis and Curves statements), + while the NurbsCurve schema is designed to be analgous to the + NURBS curves found in packages like Maya and Houdini while + retaining their consistency with the RenderMan specification for + NURBS Patches. HermiteCurves are useful for the + interchange of animation guides and paths. + + It is safe to use the length of the curve vertex count to derive + the number of curves and the number and layout of curve vertices, + but this schema should NOT be used to derive the number of curve + points. While vertex indices are implicit in all shipped + descendent types of this schema, one should not assume that all + internal or future shipped schemas will follow this pattern. Be + sure to key any indexing behavior off the concrete type, not this + abstract type. + """ +) { + # topology attributes + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + + # shaping attributes + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are "ribbon width", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See \\ref SetWidthsInterpolation() . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) +} + +class BasisCurves "BasisCurves" ( + inherits = + doc = """BasisCurves are a batched curve representation analogous to the + classic RIB definition via Basis and Curves statements. BasisCurves are + often used to render dense aggregate geometry like hair or grass. + + A 'matrix' and 'vstep' associated with the \\em basis are used to + interpolate the vertices of a cubic BasisCurves. (The basis attribute + is unused for linear BasisCurves.) + + A single prim may have many curves whose count is determined implicitly by + the length of the \\em curveVertexCounts vector. Each individual curve is + composed of one or more segments. Each segment is defined by four vertices + for cubic curves and two vertices for linear curves. See the next section + for more information on how to map curve vertex counts to segment counts. + + \\section UsdGeomBasisCurves_Segment Segment Indexing + Interpolating a curve requires knowing how to decompose it into its + individual segments. + + The segments of a cubic curve are determined by the vertex count, + the \\em wrap (periodicity), and the vstep of the basis. For linear + curves, the basis token is ignored and only the vertex count and + wrap are needed. + + cubic basis | vstep + ------------- | ------ + bezier | 3 + catmullRom | 1 + bspline | 1 + + The first segment of a cubic (nonperiodic) curve is always defined by its + first four points. The vstep is the increment used to determine what + vertex indices define the next segment. For a two segment (nonperiodic) + bspline basis curve (vstep = 1), the first segment will be defined by + interpolating vertices [0, 1, 2, 3] and the second segment will be defined + by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the + first segment will be defined by interpolating vertices [0, 1, 2, 3] and + the second segment will be defined by [3, 4, 5, 6]. If the vstep is not + one, then you must take special care to make sure that the number of cvs + properly divides by your vstep. (The indices described are relative to + the initial vertex index for a batched curve.) + + For periodic curves, at least one of the curve's initial vertices are + repeated to close the curve. For cubic curves, the number of vertices + repeated is '4 - vstep'. For linear curves, only one vertex is repeated + to close the loop. + + Pinned curves are a special case of nonperiodic curves that only affects + the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render + pinned curves, a client must effectively add 'phantom points' at the + beginning and end of every curve in a batch. These phantom points + are injected to ensure that the interpolated curve begins at P[0] and + ends at P[n-1]. + + For a curve with initial point P[0] and last point P[n-1], the phantom + points are defined as. + P[-1] = 2 * P[0] - P[1] + P[n] = 2 * P[n-1] - P[n-2] + + Pinned cubic curves will (usually) have to be unpacked into the standard + nonperiodic representation before rendering. This unpacking can add some + additional overhead. However, using pinned curves reduces the amount of + data recorded in a scene and (more importantly) better records the + authors' intent for interchange. + + \\note The additional phantom points mean that the minimum curve vertex + count for cubic bspline and catmullRom curves is 2. + + Linear curve segments are defined by two vertices. + A two segment linear curve's first segment would be defined by + interpolating vertices [0, 1]. The second segment would be defined by + vertices [1, 2]. (Again, for a batched curve, indices are relative to + the initial vertex index.) + + When validating curve topology, each renderable entry in the + curveVertexCounts vector must pass this check. + + type | wrap | validitity + ------- | --------------------------- | ---------------- + linear | nonperiodic | curveVertexCounts[i] > 2 + linear | periodic | curveVertexCounts[i] > 3 + cubic | nonperiodic | (curveVertexCounts[i] - 4) % vstep == 0 + cubic | periodic | (curveVertexCounts[i]) % vstep == 0 + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) >= 0 + + \\section UsdGeomBasisCurves_BasisMatrix Cubic Vertex Interpolation + + \\image html USDCurveBasisMatrix.png width=750 + + \\section UsdGeomBasisCurves_Linear Linear Vertex Interpolation + + Linear interpolation is always used on curves of type linear. + 't' with domain [0, 1], the curve is defined by the equation + P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes + the end point. + + \\section UsdGeomBasisCurves_PrimvarInterpolation Primvar Interpolation + + For cubic curves, primvar data can be either interpolated cubically between + vertices or linearly across segments. The corresponding token + for cubic interpolation is 'vertex' and for linear interpolation is + 'varying'. Per vertex data should be the same size as the number + of vertices in your curve. Segment varying data is dependent on the + wrap (periodicity) and number of segments in your curve. For linear curves, + varying and vertex data would be interpolated the same way. By convention + varying is the preferred interpolation because of the association of + varying with linear interpolation. + + \\image html USDCurvePrimvars.png + + To convert an entry in the curveVertexCounts vector into a segment count + for an individual curve, apply these rules. Sum up all the results in + order to compute how many total segments all curves have. + + The following tables describe the expected segment count for the 'i'th + curve in a curve batch as well as the entire batch. Python syntax + like '[:]' (to describe all members of an array) and 'len(...)' + (to describe the length of an array) are used. + + type | wrap | curve segment count | batch segment count + ------- | --------------------------- | -------------------------------------- | -------------------------- + linear | nonperiodic | curveVertexCounts[i] - 1 | sum(curveVertexCounts[:]) - len(curveVertexCounts) + linear | periodic | curveVertexCounts[i] | sum(curveVertexCounts[:]) + cubic | nonperiodic | (curveVertexCounts[i] - 4) / vstep + 1 | sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) + cubic | periodic | curveVertexCounts[i] / vstep | sum(curveVertexCounts[:]) / vstep + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) + 1 | sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) + + The following table descrives the expected size of varying + (linearly interpolated) data, derived from the segment counts computed + above. + + wrap | curve varying count | batch varying count + ------------------- | ---------------------------- | ------------------------------------------------ + nonperiodic/pinned | segmentCounts[i] + 1 | sum(segmentCounts[:]) + len(curveVertexCounts) + periodic | segmentCounts[i] | sum(segmentCounts[:]) + + Both curve types additionally define 'constant' interpolation for the + entire prim and 'uniform' interpolation as per curve data. + + + \\note Take care when providing support for linearly interpolated data for + cubic curves. Its shape doesn't provide a one to one mapping with either + the number of curves (like 'uniform') or the number of vertices (like + 'vertex') and so it is often overlooked. This is the only primitive in + UsdGeom (as of this writing) where this is true. For meshes, while they + use different interpolation methods, 'varying' and 'vertex' are both + specified per point. It's common to assume that curves follow a similar + pattern and build in structures and language for per primitive, per + element, and per point data only to come upon these arrays that don't + quite fit into either of those categories. It is + also common to conflate 'varying' with being per segment data and use the + segmentCount rules table instead of its neighboring varying data table + rules. We suspect that this is because for the common case of + nonperiodic cubic curves, both the provided segment count and varying data + size formula end with '+ 1'. While debugging, users may look at the double + '+ 1' as a mistake and try to remove it. We take this time to enumerate + these issues because we've fallen into them before and hope that we save + others time in their own implementations. + + As an example of deriving per curve segment and varying primvar data counts from + the wrap, type, basis, and curveVertexCount, the following table is provided. + + wrap | type | basis | curveVertexCount | curveSegmentCount | varyingDataCount + ------------- | ------- | ------- | ----------------- | ------------------ | ------------------------- + nonperiodic | linear | N/A | [2 3 2 5] | [1 2 1 4] | [2 3 2 5] + nonperiodic | cubic | bezier | [4 7 10 4 7] | [1 2 3 1 2] | [2 3 4 2 3] + nonperiodic | cubic | bspline | [5 4 6 7] | [2 1 3 4] | [3 2 4 5] + periodic | cubic | bezier | [6 9 6] | [2 3 2] | [2 3 2] + periodic | linear | N/A | [3 7] | [3 7] | [3 7] + + \\section UsdGeomBasisCurves_TubesAndRibbons Tubes and Ribbons + + The strictest definition of a curve as an infinitely thin wire is not + particularly useful for describing production scenes. The additional + \\em widths and \\em normals attributes can be used to describe cylindrical + tubes and or flat oriented ribbons. + + Curves with only widths defined are imaged as tubes with radius + 'width / 2'. Curves with both widths and normals are imaged as ribbons + oriented in the direction of the interpolated normal vectors. + + While not technically UsdGeomPrimvars, widths and normals + also have interpolation metadata. It's common for authored widths to have + constant, varying, or vertex interpolation + (see UsdGeomCurves::GetWidthsInterpolation()). It's common for + authored normals to have varying interpolation + (see UsdGeomPointBased::GetNormalsInterpolation()). + + \\image html USDCurveHydra.png + + The file used to generate these curves can be found in + extras/usd/examples/usdGeomExamples/basisCurves.usda. It's provided + as a reference on how to properly image both tubes and ribbons. The first + row of curves are linear; the second are cubic bezier. (We aim in future + releases of HdSt to fix the discontinuity seen with broken tangents to + better match offline renderers like RenderMan.) The yellow and violet + cubic curves represent cubic vertex width interpolation for which there is + no equivalent for linear curves. + + \\note How did this prim type get its name? This prim is a portmanteau of + two different statements in the original RenderMan specification: + 'Basis' and 'Curves'. +""" +) { + # interpolation attributes + uniform token type = "cubic" ( + allowedTokens = ["linear", "cubic"] + doc = """Linear curves interpolate linearly between two vertices. + Cubic curves use a basis matrix with four vertices to interpolate a segment.""") + + uniform token basis = "bezier" ( + allowedTokens = ["bezier", "bspline", "catmullRom"] + doc = """The basis specifies the vstep and matrix used for cubic + interpolation. \\note The 'hermite' and 'power' tokens have been + removed. We've provided UsdGeomHermiteCurves + as an alternative for the 'hermite' basis.""") + + uniform token wrap = "nonperiodic" ( + allowedTokens = ["nonperiodic", "periodic", "pinned"] + doc = """If wrap is set to periodic, the curve when rendered will + repeat the initial vertices (dependent on the vstep) to close the + curve. If wrap is set to 'pinned', phantom points may be created + to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. + """) +} + +class NurbsCurves "NurbsCurves" ( + inherits = + doc = """This schema is analagous to NURBS Curves in packages like Maya + and Houdini, often used for interchange of rigging and modeling curves. + Unlike Maya, this curve spec supports batching of multiple curves into a + single prim, widths, and normals in the schema. Additionally, we require + 'numSegments + 2 * degree + 1' knots (2 more than maya does). This is to + be more consistent with RenderMan's NURBS patch specification. + + To express a periodic curve: + - knot[0] = knot[1] - (knots[-2] - knots[-3]; + - knot[-1] = knot[-2] + (knot[2] - knots[1]); + + To express a nonperiodic curve: + - knot[0] = knot[1]; + - knot[-1] = knot[-2]; + + In spite of these slight differences in the spec, curves generated in Maya + should be preserved when roundtripping. + + \\em order and \\em range, when representing a batched NurbsCurve should be + authored one value per curve. \\em knots should be the concatentation of + all batched curves.""" +) { + # topology attributes + int[] order = [] ( + doc = """Order of the curve. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1. + Its value for the 'i'th curve must be less than or equal to + curveVertexCount[i]""") + + # interpolation attributes + double[] knots ( + doc = """Knot vector providing curve parameterization. + The length of the slice of the array for the ith curve + must be ( curveVertexCount[i] + order[i] ), and its + entries must take on monotonically increasing values.""") + + double2[] ranges ( + doc = """Provides the minimum and maximum parametric values (as defined + by knots) over which the curve is actually defined. The minimum must + be less than the maximum, and greater than or equal to the value of the + knots['i'th curve slice][order[i]-1]. The maxium must be less + than or equal to the last element's value in knots['i'th curve slice]. + Range maps to (vmin, vmax) in the RenderMan spec.""") + + double[] pointWeights ( + doc = """Optionally provides "w" components for each control point, + thus must be the same length as the points attribute. If authored, + the curve will be rational. If unauthored, the curve will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the \\em points, but in this schema, + \\em points are not pre-weighted.""" + ) +} + +class Points "Points" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } + inherits = + doc = """Points are analogous to the RiPoints spec. + + Points can be an efficient means of storing and rendering particle + effects comprised of thousands or millions of small particles. Points + generally receive a single shading sample each, which should take + \\em normals into account, if present. + + While not technically UsdGeomPrimvars, the widths and normals also + have interpolation metadata. It's common for authored widths and normals + to have constant or varying interpolation.""" + +) { + # shaping attributes + float[] widths ( + doc = """Widths are defined as the \\em diameter of the points, in + object space. 'widths' is not a generic Primvar, but + the number of elements in this attribute will be determined by + its 'interpolation'. See \\ref SetWidthsInterpolation() . If + 'widths' and 'primvars:widths' are both specified, the latter + has precedence.""" + ) + + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the points array, specifying (at each timesample if + point identities are changing) the id of each point. The + type is signed intentionally, so that clients can encode some + binary state on Id'd points without adding a separate + primvar.""" + ) +} + +class PointInstancer "PointInstancer" ( + doc = """Encodes vectorized instancing of multiple, potentially + animated, prototypes (object/instance masters), which can be arbitrary + prims/subtrees on a UsdStage. + + PointInstancer is a "multi instancer", as it allows multiple prototypes + to be scattered among its "points". We use a UsdRelationship + \\em prototypes to identify and order all of the possible prototypes, by + targeting the root prim of each prototype. The ordering imparted by + relationships associates a zero-based integer with each prototype, and + it is these integers we use to identify the prototype of each instance, + compactly, and allowing prototypes to be swapped out without needing to + reauthor all of the per-instance data. + + The PointInstancer schema is designed to scale to billions of instances, + which motivates the choice to split the per-instance transformation into + position, (quaternion) orientation, and scales, rather than a + 4x4 matrix per-instance. In addition to requiring fewer bytes even if + all elements are authored (32 bytes vs 64 for a single-precision 4x4 + matrix), we can also be selective about which attributes need to animate + over time, for substantial data reduction in many cases. + + Note that PointInstancer is \\em not a Gprim, since it is not a graphical + primitive by any stretch of the imagination. It \\em is, however, + Boundable, since we will sometimes want to treat the entire PointInstancer + similarly to a procedural, from the perspective of inclusion or framing. + + \\section UsdGeomPointInstancer_varyingTopo Varying Instance Identity over Time + + PointInstancers originating from simulations often have the characteristic + that points/instances are "born", move around for some time period, and then + die (or leave the area of interest). In such cases, billions of instances + may be birthed over time, while at any \\em specific time, only a much + smaller number are actually alive. To encode this situation efficiently, + the simulator may re-use indices in the instance arrays, when a particle + dies, its index will be taken over by a new particle that may be birthed in + a much different location. This presents challenges both for + identity-tracking, and for motion-blur. + + We facilitate identity tracking by providing an optional, animatable + \\em ids attribute, that specifies the 64 bit integer ID of the particle + at each index, at each point in time. If the simulator keeps monotonically + increasing a particle-count each time a new particle is birthed, it will + serve perfectly as particle \\em ids. + + We facilitate motion blur for varying-topology particle streams by + optionally allowing per-instance \\em velocities and \\em angularVelocities + to be authored. If instance transforms are requested at a time between + samples and either of the velocity attributes is authored, then we will + not attempt to interpolate samples of \\em positions or \\em orientations. + If not authored, and the bracketing samples have the same length, then we + will interpolate. + + \\section UsdGeomPointInstancer_transform Computing an Instance Transform + + Each instance's transformation is a combination of the SRT affine transform + described by its scale, orientation, and position, applied \\em after + (i.e. less locally than) the local to parent transformation computed at + the root of the prototype it is instancing. + + If your processing of prototype geometry naturally takes into account the + transform of the prototype root, then this term can be omitted from the + computation of each instance transform, and this can be controlled when + computing instance transformation matrices using the + UsdGeomPointInstancer::PrototypeXformInclusion enumeration. + + To understand the computation of the instance transform, in order to put + an instance of a PointInstancer into the space of the PointInstancer's + parent prim we do the following: + + 1. Apply (most locally) the authored local to parent transformation for + prototypes[protoIndices[i]] + 2. If *scales* is authored, next apply the scaling matrix from *scales[i]* + 3. If *orientations* is authored: **if *angularVelocities* is authored**, + first multiply *orientations[i]* by the unit quaternion derived by scaling + *angularVelocities[i]* by the \\ref UsdGeom_PITimeScaling "time differential" + from the left-bracketing timeSample for *orientation* to the requested + evaluation time *t*, storing the result in *R*, **else** assign *R* + directly from *orientations[i]*. Apply the rotation matrix derived + from *R*. + 4. Apply the translation derived from *positions[i]*. If *velocities* is + authored, apply the translation deriving from *velocities[i]* scaled by + the time differential from the left-bracketing timeSample for *positions* + to the requested evaluation time *t*. + 5. Least locally, apply the transformation authored on the PointInstancer + prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the + PointInstancer to put the instance directly into world space) + + If neither *velocities* nor *angularVelocities* are authored, we fallback to + standard position and orientation computation logic (using linear + interpolation between timeSamples) as described by + \\ref UsdGeom_VelocityInterpolation . + + \\anchor UsdGeom_PITimeScaling + Scaling Velocities for Interpolation + + When computing time-differentials by which to apply velocity or + angularVelocity to positions or orientations, we must scale by + ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded + in units/second, while we are interpolating in UsdTimeCode ordinates. + + We provide both high and low-level API's for dealing with the + transformation as a matrix, both will compute the instance matrices using + multiple threads; the low-level API allows the client to cache unvarying + inputs so that they need not be read duplicately when computing over + time. + + See also \\ref UsdGeom_VelocityInterpolation . + + \\section UsdGeomPointInstancer_primvars Primvars on PointInstancer + + \\ref UsdGeomPrimvar "Primvars" authored on a PointInstancer prim should + always be applied to each instance with \\em constant interpolation at + the root of the instance. When you are authoring primvars on a + PointInstancer, think about it as if you were authoring them on a + point-cloud (e.g. a UsdGeomPoints gprim). The same + interpolation rules for points apply here, substituting + "instance" for "point". + + In other words, the (constant) value extracted for each instance + from the authored primvar value depends on the authored \\em interpolation + and \\em elementSize of the primvar, as follows: + \\li constant or uniform : the entire authored value of the + primvar should be applied exactly to each instance. + \\li varying, vertex, or faceVarying: the first + \\em elementSize elements of the authored primvar array should be assigned to + instance zero, the second \\em elementSize elements should be assigned to + instance one, and so forth. + + + \\section UsdGeomPointInstancer_masking Masking Instances: "Deactivating" and Invising + + Often a PointInstancer is created "upstream" in a graphics pipeline, and + the needs of "downstream" clients necessitate eliminating some of the + instances from further consideration. Accomplishing this pruning by + re-authoring all of the per-instance attributes is not very attractive, + since it may mean destructively editing a large quantity of data. We + therefore provide means of "masking" instances by ID, such that the + instance data is unmolested, but per-instance transform and primvar data + can be retrieved with the no-longer-desired instances eliminated from the + (smaller) arrays. PointInstancer allows two independent means of masking + instances by ID, each with different features that meet the needs of + various clients in a pipeline. Both pruning features' lists of ID's are + combined to produce the mask returned by ComputeMaskAtTime(). + + \\note If a PointInstancer has no authored \\em ids attribute, the masking + features will still be available, with the integers specifying element + position in the \\em protoIndices array rather than ID. + + \\subsection UsdGeomPointInstancer_inactiveIds InactiveIds: List-edited, Unvarying Masking + + The first masking feature encodes a list of IDs in a list-editable metadatum + called \\em inactiveIds, which, although it does not have any similar + impact to stage population as \\ref UsdPrim::SetActive() "prim activation", + it shares with that feature that its application is uniform over all time. + Because it is list-editable, we can \\em sparsely add and remove instances + from it in many layers. + + This sparse application pattern makes \\em inactiveIds a good choice when + further downstream clients may need to reverse masking decisions made + upstream, in a manner that is robust to many kinds of future changes to + the upstream data. + + See ActivateId(), ActivateIds(), DeactivateId(), DeactivateIds(), + ActivateAllIds() + + \\subsection UsdGeomPointInstancer_invisibleIds invisibleIds: Animatable Masking + + The second masking feature encodes a list of IDs in a time-varying + Int64Array-valued UsdAttribute called \\em invisibleIds , since it shares + with \\ref UsdGeomImageable::GetVisibilityAttr() "Imageable visibility" + the ability to animate object visibility. + + Unlike \\em inactiveIds, overriding a set of opinions for \\em invisibleIds + is not at all straightforward, because one will, in general need to + reauthor (in the overriding layer) **all** timeSamples for the attribute + just to change one Id's visibility state, so it cannot be authored + sparsely. But it can be a very useful tool for situations like encoding + pre-computed camera-frustum culling of geometry when either or both of + the instances or the camera is animated. + + See VisId(), VisIds(), InvisId(), InvisIds(), VisAllIds() + + \\section UsdGeomPointInstancer_protoProcessing Processing and Not Processing Prototypes + + Any prim in the scenegraph can be targeted as a prototype by the + \\em prototypes relationship. We do not, however, provide a specific + mechanism for identifying prototypes as geometry that should not be drawn + (or processed) in their own, local spaces in the scenegraph. We + encourage organizing all prototypes as children of the PointInstancer + prim that consumes them, and pruning "raw" processing and drawing + traversals when they encounter a PointInstancer prim; this is what the + UsdGeomBBoxCache and UsdImaging engines do. + + There \\em is a pattern one can deploy for organizing the prototypes + such that they will automatically be skipped by basic UsdPrim::GetChildren() + or UsdPrimRange traversals. Usd prims each have a + \\ref Usd_PrimSpecifiers "specifier" of "def", "over", or "class". The + default traversals skip over prims that are "pure overs" or classes. So + to protect prototypes from all generic traversals and processing, place + them under a prim that is just an "over". For example, + \\code + 01 def PointInstancer "Crowd_Mid" + 02 { + 03 rel prototypes = [ , ] + 04 + 05 over "Prototypes" + 06 { + 07 def "MaleThin_Business" ( + 08 references = [@MaleGroupA/usd/MaleGroupA.usd@] + 09 variants = { + 10 string modelingVariant = "Thin" + 11 string costumeVariant = "BusinessAttire" + 12 } + 13 ) + 14 { ... } + 15 + 16 def "MaleThin_Casual" + 17 ... + 18 } + 19 } + \\endcode + """ + + inherits = + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + dictionary schemaTokens = { + dictionary inactiveIds = { + string doc = """int64listop prim metadata that specifies + the PointInstancer ids that should be masked (unrenderable) + over all time.""" + } + } + } +) { + rel prototypes ( + doc = """Required property. Orders and targets the prototype root + prims, which can be located anywhere in the scenegraph that is convenient, + although we promote organizing prototypes as children of the + PointInstancer. The position of a prototype in this relationship defines + the value an instance would specify in the \\em protoIndices attribute to + instance that prototype. Since relationships are uniform, this property + cannot be animated.""" + ) + + int[] protoIndices ( + doc = """Required property. Per-instance index into + \\em prototypes relationship that identifies what geometry should be + drawn for each instance. Topology attribute - can be animated, + but at a potential performance impact for streaming.""" + ) + + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the \\em protoIndices array, specifying (at each timeSample if + instance identities are changing) the id of each instance. The + type is signed intentionally, so that clients can encode some + binary state on Id'd instances without adding a separate primvar. + See also \\ref UsdGeomPointInstancer_varyingTopo""" + ) + + point3f[] positions ( + doc = """Required property. Per-instance position. See also + \\ref UsdGeomPointInstancer_transform .""" + ) + + quath[] orientations ( + doc="""If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, which + allows us to encode it with sufficient precision in a compact GfQuath. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the "better (for interpolation + with respect to neighboring samples)" of the two possible quaternions + that encode the rotation. + + See also \\ref UsdGeomPointInstancer_transform .""" ) + + quatf[] orientationsf ( + doc="""If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, encoded + as a GfQuatf to support higher precision computations. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the "better (for interpolation + with respect to neighboring samples)" of the two possible quaternions + that encode the rotation. Note that if the earliest time sample (or + default value if there are no time samples) of orientationsf is not empty + orientationsf will be preferred over orientations if both are authored. + + See also \\ref UsdGeomPointInstancer_transform .""" ) + + float3[] scales ( + doc="""If authored, per-instance scale to be applied to + each instance, before any rotation is applied. + + See also \\ref UsdGeomPointInstancer_transform .""" + ) + + vector3f[] velocities ( + doc = """If provided, per-instance 'velocities' will be used to + compute positions between samples for the 'positions' attribute, + rather than interpolating between neighboring 'positions' samples. + Velocities should be considered mandatory if both \\em protoIndices + and \\em positions are animated. Velocity is measured in position + units per second, as per most simulation software. To convert to + position units per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeomPointInstancer_transform, + \\ref UsdGeom_VelocityInterpolation .""" + ) + + vector3f[] accelerations ( + doc = """If authored, per-instance 'accelerations' will be used with + velocities to compute positions between samples for the 'positions' + attribute rather than interpolating between neighboring 'positions' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + + vector3f[] angularVelocities ( + doc="""If authored, per-instance angular velocity vector to be used for + interoplating orientations. Angular velocities should be considered + mandatory if both \\em protoIndices and \\em orientations are animated. + Angular velocity is measured in degrees per second. To convert + to degrees per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeomPointInstancer_transform .""" + ) + + int64[] invisibleIds = [] ( + doc="""A list of id's to make invisible at the evaluation time. + See \\ref UsdGeomPointInstancer_invisibleIds .""" + ) +} + + +class Camera "Camera" ( + doc = """Transformable camera. + + Describes optical properties of a camera via a common set of attributes + that provide control over the camera's frustum as well as its depth of + field. For stereo, the left and right camera are individual prims tagged + through the \\ref UsdGeomCamera::GetStereoRoleAttr() "stereoRole attribute". + + There is a corresponding class GfCamera, which can hold the state of a + camera (at a particular time). \\ref UsdGeomCamera::GetCamera() and + \\ref UsdGeomCamera::SetFromCamera() convert between a USD camera prim and + a GfCamera. + + To obtain the camera's location in world space, call the following on a + UsdGeomCamera 'camera': + \\code + GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); + \\endcode + \\note + Cameras in USD are always "Y up", regardless of the stage's orientation + (i.e. UsdGeomGetStageUpAxis()). This means that the inverse of + 'camXform' (the VIEW half of the MODELVIEW transform in OpenGL parlance) + will transform the world such that the camera is at the origin, looking + down the -Z axis, with +Y as the up axis, and +X pointing to the right. + This describes a __right handed coordinate system__. + + \\section UsdGeom_CameraUnits Units of Measure for Camera Properties + + Despite the familiarity of millimeters for specifying some physical + camera properties, UsdGeomCamera opts for greater consistency with all + other UsdGeom schemas, which measure geometric properties in scene units, + as determined by UsdGeomGetStageMetersPerUnit(). We do make a + concession, however, in that lens and filmback properties are measured in + __tenths of a scene unit__ rather than "raw" scene units. This means + that with the fallback value of .01 for _metersPerUnit_ - i.e. scene unit + of centimeters - then these "tenth of scene unit" properties are + effectively millimeters. + + \\note If one adds a Camera prim to a UsdStage whose scene unit is not + centimeters, the fallback values for filmback properties will be + incorrect (or at the least, unexpected) in an absolute sense; however, + proper imaging through a "default camera" with focusing disabled depends + only on ratios of the other properties, so the camera is still usable. + However, it follows that if even one property is authored in the correct + scene units, then they all must be. + + + \\sa \\ref UsdGeom_LinAlgBasics + """ + inherits = + customData = { + string extraIncludes = """ +#include "pxr/base/gf/camera.h" """ + } +) { + # viewing frustum + token projection = "perspective" ( + allowedTokens = ["perspective", "orthographic"]) + float horizontalAperture = 20.9550 ( + doc = """Horizontal aperture in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits . Default is the equivalent of + the standard 35mm spherical projector aperture.""") + float verticalAperture = 15.2908 ( + doc = """Vertical aperture in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits . Default is the equivalent of + the standard 35mm spherical projector aperture.""") + float horizontalApertureOffset = 0.0 ( + doc = """Horizontal aperture offset in the same units as + horizontalAperture. Defaults to 0.""") + float verticalApertureOffset = 0.0 ( + doc = """Vertical aperture offset in the same units as + verticalAperture. Defaults to 0.""") + float focalLength = 50.0 ( + doc = """Perspective focal length in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits .""") + float2 clippingRange = (1, 1000000) ( + doc = """Near and far clipping distances in scene units; see + \\ref UsdGeom_CameraUnits .""") + float4[] clippingPlanes = [] ( + doc = """Additional, arbitrarily oriented clipping planes. + A vector (a,b,c,d) encodes a clipping plane that cuts off + (x,y,z) with a * x + b * y + c * z + d * 1 < 0 where (x,y,z) + are the coordinates in the camera's space.""") + + # depth of field + float fStop = 0.0 ( + doc = """Lens aperture. Defaults to 0.0, which turns off focusing.""") + float focusDistance = 0.0 ( + doc = """Distance from the camera to the focus plane in scene units; see + \\ref UsdGeom_CameraUnits .""") + + # stereoscopic 3D + uniform token stereoRole = "mono" ( + allowedTokens = ["mono", "left", "right"] + doc = """If different from mono, the camera is intended to be the left + or right camera of a stereo setup.""") + + # Parameters for motion blur + double shutter:open = 0.0 ( + doc = """Frame relative shutter open time in UsdTimeCode units (negative + value indicates that the shutter opens before the current + frame time). Used for motion blur.""" + ) + double shutter:close = 0.0 ( + doc = """Frame relative shutter close time, analogous comments from + shutter:open apply. A value greater or equal to shutter:open + should be authored, otherwise there is no exposure and a + renderer should produce a black image.""" + ) + + # exposure adjustment + float exposure = 0.0 ( + doc = """Exposure adjustment, as a log base-2 value. The default + of 0.0 has no effect. A value of 1.0 will double the + image-plane intensities in a rendered image; a value of + -1.0 will halve them.""" + ) +} + +class "GeomModelAPI" +( + inherits = + customData = { + string className = "ModelAPI" + string extraIncludes = """ +#include "pxr/usd/usdGeom/bboxCache.h" +#include "pxr/usd/usdGeom/constraintTarget.h" +#include "pxr/usd/usdGeom/imageable.h" """ + dictionary schemaTokens = { + dictionary extentsHint = { + string doc = """Name of the attribute used to author extents + hints at the root of leaf models. Extents hints are stored by purpose + as a vector of GfVec3f values. They are ordered based on the order + of purpose tokens returned by + UsdGeomImageable::GetOrderedPurposeTokens.""" + } + } + } + doc = """UsdGeomModelAPI extends the generic UsdModelAPI schema with + geometry specific concepts such as cached extents for the entire model, + constraint targets, and geometry-inspired extensions to the payload + lofting process. + + As described in GetExtentsHint() below, it is useful to cache extents + at the model level. UsdGeomModelAPI provides schema for computing and + storing these cached extents, which can be consumed by UsdGeomBBoxCache to + provide fast access to precomputed extents that will be used as the model's + bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). + + \\section UsdGeomModelAPI_drawMode Draw Modes + + Draw modes provide optional alternate imaging behavior for USD subtrees with + kind model. \\em model:drawMode (which is inheritable) and + \\em model:applyDrawMode (which is not) are resolved into a decision to stop + traversing the scene graph at a certain point, and replace a USD subtree + with proxy geometry. + + The value of \\em model:drawMode determines the type of proxy geometry: + - \\em origin - Draw the model-space basis vectors of the replaced prim. + - \\em bounds - Draw the model-space bounding box of the replaced prim. + - \\em cards - Draw textured quads as a placeholder for the replaced prim. + - \\em default - An explicit opinion to draw the USD subtree as normal. + - \\em inherited - Defer to the parent opinion. + + \\em model:drawMode falls back to _inherited_ so that a whole scene, + a large group, or all prototypes of a model hierarchy PointInstancer can + be assigned a draw mode with a single attribute edit. If no draw mode is + explicitly set in a hierarchy, the resolved value is _default_. + + \\em model:applyDrawMode is meant to be written when an asset is authored, + and provides flexibility for different asset types. For example, + a character assembly (composed of character, clothes, etc) might have + \\em model:applyDrawMode set at the top of the subtree so the whole group + can be drawn as a single card object. An effects subtree might have + \\em model:applyDrawMode set at a lower level so each particle + group draws individually. + + Models of kind component are automatically treated as if + \\em model:applyDrawMode were true if \\em model:applyDrawMode is not + authored on the component prim. A component prim will be drawn drawn with a + simplified representation when the prim has kind component, + \\em model:applyDrawMode is not authored (or authored to be true), and the + resolved (i.e. inherited down namespace) value for \\em model:drawMode is + not _default_. If you don't want component prims to use the resolved + non-default drawMode, you must apply the UsdGeomModelAPI schema on the prim + and explicitly set \\em model:applyDrawMode to false. + + \\section UsdGeomModelAPI_cardGeometry Cards Geometry + + The specific geometry used in cards mode is controlled by the + \\em model:cardGeometry attribute: + - \\em cross - Generate a quad normal to each basis direction and negative. + Locate each quad so that it bisects the model extents. + - \\em box - Generate a quad normal to each basis direction and negative. + Locate each quad on a face of the model extents, facing out. + - \\em fromTexture - Generate a quad for each supplied texture from + attributes stored in that texture's metadata. + + For \\em cross and \\em box mode, the extents are calculated for purposes + \\em default, \\em proxy, and \\em render, at their earliest authored time. + If the model has no textures, all six card faces are rendered using + \\em model:drawModeColor. If one or more textures are present, only axes + with one or more textures assigned are drawn. For each axis, if both + textures (positive and negative) are specified, they'll be used on the + corresponding card faces; if only one texture is specified, it will be + mapped to the opposite card face after being flipped on the texture's + s-axis. Any card faces with invalid asset paths will be drawn with + \\em model:drawModeColor. + + Both \\em model:cardGeometry and \\em model:drawModeColor should be + authored on the prim where the draw mode takes effect, since these + attributes are not inherited. + + For \\em fromTexture mode, only card faces with valid textures assigned + are drawn. The geometry is generated by pulling the \\em worldtoscreen + attribute out of texture metadata. This is expected to be a 4x4 matrix + mapping the model-space position of the card quad to the clip-space quad + with corners (-1,-1,0) and (1,1,0). The card vertices are generated by + transforming the clip-space corners by the inverse of \\em worldtoscreen. + Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. + If the metadata cannot be read in the right format, or the matrix can't + be inverted, the card face is not drawn. + + All card faces are drawn and textured as single-sided. + + \\todo CreatePayload() """ +) +{ + uniform token model:drawMode = "inherited" ( + allowedTokens = ["origin", "bounds", "cards", "default", "inherited"] + doc = """Alternate imaging mode; applied to this prim or child prims + where \\em model:applyDrawMode is true, or where the prim + has kind \\em component and \\em model:applyDrawMode is not + authored. See \\ref UsdGeomModelAPI_drawMode + for mode descriptions.""" + ) + uniform bool model:applyDrawMode = false ( + doc = """If true, and the resolved value of \\em model:drawMode is + non-default, apply an alternate imaging mode to this prim. See + \\ref UsdGeomModelAPI_drawMode.""" + ) + uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ( + doc = """The base color of imaging prims inserted for alternate + imaging modes. For \\em origin and \\em bounds modes, this + controls line color; for \\em cards mode, this controls the + fallback quad color.""" + ) + uniform token model:cardGeometry = "cross" ( + allowedTokens = ["cross", "box", "fromTexture"] + doc = """The geometry to generate for imaging prims inserted for \\em + cards imaging mode. See \\ref UsdGeomModelAPI_cardGeometry for + geometry descriptions.""" + ) + asset model:cardTextureXPos ( + doc = """In \\em cards imaging mode, the texture applied to the X+ quad. + The texture axes (s,t) are mapped to model-space axes (-y, -z).""" + ) + asset model:cardTextureYPos ( + doc = """In \\em cards imaging mode, the texture applied to the Y+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -z).""" + ) + asset model:cardTextureZPos ( + doc = """In \\em cards imaging mode, the texture applied to the Z+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -y).""" + ) + asset model:cardTextureXNeg ( + doc = """In \\em cards imaging mode, the texture applied to the X- quad. + The texture axes (s,t) are mapped to model-space axes (y, -z).""" + ) + asset model:cardTextureYNeg ( + doc = """In \\em cards imaging mode, the texture applied to the Y- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -z).""" + ) + asset model:cardTextureZNeg ( + doc = """In \\em cards imaging mode, the texture applied to the Z- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -y).""" + ) +} + +class "MotionAPI" +( + inherits = + doc = """UsdGeomMotionAPI encodes data that can live on any prim that + may affect computations involving: + - computed motion for motion blur + - sampling for motion blur + + The \\ref GetMotionBlurScaleAttr() "motion:blurScale" attribute allows + artists to scale the __amount__ of motion blur to be rendered for parts + of the scene without changing the recorded animation. See + \\ref UsdGeomMotionAPI_blurScale for use and implementation details. + + """ +) +{ + float motion:blurScale = 1.0 ( + doc = """BlurScale is an __inherited__ float attribute that stipulates + the rendered motion blur (as typically specified via UsdGeomCamera's + _shutter:open_ and _shutter:close_ properties) should be scaled for + __all objects__ at and beneath the prim in namespace on which the + _motion:blurScale_ value is specified. + + Without changing any other data in the scene, _blurScale_ allows artists to + "dial in" the amount of blur on a per-object basis. A _blurScale_ + value of zero removes all blur, a value of 0.5 reduces blur by half, + and a value of 2.0 doubles the blur. The legal range for _blurScale_ + is [0, inf), although very high values may result in extremely expensive + renders, and may exceed the capabilities of some renderers. + + Although renderers are free to implement this feature however they see + fit, see \\ref UsdGeomMotionAPI_blurScale for our guidance on implementing + the feature universally and efficiently. + + \\sa ComputeMotionBlurScale() + """ + ) + + float motion:velocityScale = 1.0 ( + customData = { + string apiName = "velocityScale" + } + doc = """\\deprecated + + VelocityScale is an **inherited** float attribute that + velocity-based schemas (e.g. PointBased, PointInstancer) can consume + to compute interpolated positions and orientations by applying + velocity and angularVelocity, which is required for interpolating + between samples when topology is varying over time. Although these + quantities are generally physically computed by a simulator, sometimes + we require more or less motion-blur to achieve the desired look. + VelocityScale allows artists to dial-in, as a post-sim correction, + a scale factor to be applied to the velocity prior to computing + interpolated positions from it.""" + ) + + int motion:nonlinearSampleCount = 3 ( + customData = { + string apiName = "nonlinearSampleCount" + } + doc = """Determines the number of position or transformation samples + created when motion is described by attributes contributing non-linear + terms. + + To give an example, imagine an application (such as a + renderer) consuming 'points' and the USD document also + contains 'accelerations' for the same prim. Unless the + application can consume these 'accelerations' itself, an + intermediate layer has to compute samples within the sampling + interval for the point positions based on the value of + 'points', 'velocities' and 'accelerations'. The number of these + samples is given by 'nonlinearSampleCount'. The samples are + equally spaced within the sampling interval. + + Another example involves the PointInstancer where + 'nonlinearSampleCount' is relevant when 'angularVelocities' + or 'accelerations' are authored. + + 'nonlinearSampleCount' is an **inherited** attribute, also + see ComputeNonlinearSampleCount()""" + ) +} + +class "XformCommonAPI" +( + inherits = + doc = """This class provides API for authoring and retrieving a standard set + of component transformations which include a scale, a rotation, a + scale-rotate pivot and a translation. The goal of the API is to enhance + component-wise interchange. It achieves this by limiting the set of allowed + basic ops and by specifying the order in which they are applied. In addition + to the basic set of ops, the 'resetXformStack' bit can also be set to + indicate whether the underlying xformable resets the parent transformation + (i.e. does not inherit it's parent's transformation). + + \\sa UsdGeomXformCommonAPI::GetResetXformStack() + \\sa UsdGeomXformCommonAPI::SetResetXformStack() + + The operator-bool for the class will inform you whether an existing + xformable is compatible with this API. + + The scale-rotate pivot is represented by a pair of (translate, + inverse-translate) xformOps around the scale and rotate operations. + The rotation operation can be any of the six allowed Euler angle sets. + \\sa UsdGeomXformOp::Type. + + The xformOpOrder of an xformable that has all of the supported basic ops + is as follows: + ["xformOp:translate", "xformOp:translate:pivot", "xformOp:rotateXYZ", + "xformOp:scale", "!invert!xformOp:translate:pivot"]. + + It is worth noting that all of the ops are optional. For example, an + xformable may have only a translate or a rotate. It would still be + considered as compatible with this API. Individual SetTranslate(), + SetRotate(), SetScale() and SetPivot() methods are provided by this API + to allow such sparse authoring.""" + customData = { + string apiSchemaType = "nonApplied" + string extraIncludes = """ +#include "pxr/usd/usdGeom/xformable.h" +#include "pxr/usd/usdGeom/xformOp.h" """ + dictionary schemaTokens = { + dictionary pivot = { + string doc = """Op suffix for the standard scale-rotate pivot + on a UsdGeomXformCommonAPI-compatible prim. + """ + } + } + } +) +{ +} + +class HermiteCurves "HermiteCurves" ( + inherits = + doc = """This schema specifies a cubic hermite interpolated curve batch as + sometimes used for defining guides for animation. While hermite curves can + be useful because they interpolate through their control points, they are + not well supported by high-end renderers for imaging. Therefore, while we + include this schema for interchange, we strongly recommend the use of + UsdGeomBasisCurves as the representation of curves intended to be rendered + (ie. hair or grass). Hermite curves can be converted to a Bezier + representation (though not from Bezier back to Hermite in general). + + \\section UsdGeomHermiteCurves_Interpolation Point Interpolation + + The initial cubic curve segment is defined by the first two points and + first two tangents. Additional segments are defined by additional + point / tangent pairs. The number of segments for each non-batched hermite + curve would be len(curve.points) - 1. The total number of segments + for the batched UsdGeomHermiteCurves representation is + len(points) - len(curveVertexCounts). + + \\section UsdGeomHermiteCurves_Primvars Primvar, Width, and Normal Interpolation + + Primvar interpolation is not well specified for this type as it is not + intended as a rendering representation. We suggest that per point + primvars would be linearly interpolated across each segment and should + be tagged as 'varying'. + + It is not immediately clear how to specify cubic or 'vertex' interpolation + for this type, as we lack a specification for primvar tangents. This + also means that width and normal interpolation should be restricted to + varying (linear), uniform (per curve element), or constant (per prim). + """ +) { + vector3f[] tangents = [] ( + doc = """Defines the outgoing trajectory tangent for each point. + Tangents should be the same size as the points attribute.""") +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "HydraGenerativeProceduralAPI" ( + doc = """ + This API extends and configures the core UsdProcGenerativeProcedural schema + defined within usdProc for use with hydra generative procedurals as defined + within hdGp. + """ +) +{ + token primvars:hdGp:proceduralType ( + doc = """The registered name of a HdGpGenerativeProceduralPlugin to + be executed.""" + ) + token proceduralSystem = "hydraGenerativeProcedural" ( + doc = ''' + This value should correspond to a configured instance of + HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the + procedural. The default value of "hydraGenerativeProcedural" matches + the equivalent default of HdGpGenerativeProceduralResolvingSceneIndex. + Multiple instances of the scene index can be used to determine where + within a scene index chain a given procedural will be evaluated. + ''' + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdHydraDiscoveryPlugin": { + "bases": [ + "NdrDiscoveryPlugin" + ], + "displayName": "Discovery plugin for deprecated hydra shaders." + }, + "UsdHydraGenerativeProceduralAPI": { + "alias": { + "UsdSchemaBase": "HydraGenerativeProceduralAPI" + }, + "apiSchemaCanOnlyApplyTo": [ + "GenerativeProcedural" + ], + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + } + } + }, + "LibraryPath": "", + "Name": "usdHydra", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 + +def Shader "HwPtexTexture_1" ( + sdrMetadata = { + token role = "texture" + token isPtex = "1" + } +) +{ + uniform token info:id = "HwPtexTexture_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + token inputs:faceIndexPrimvar = "ptexFaceIndex" ( + sdrMetadata = { + token primvarProperty = "1" + } + ) + + token inputs:faceOffsetPrimvar = "ptexFaceOffset" ( + sdrMetadata = { + token primvarProperty = "1" + } + ) + + asset inputs:file = @@ ( + doc = "Asset path to the file containg the image data." + ) + + float inputs:frame ( + doc = "The frame offset for animated textures." + ) + + float inputs:textureMemory ( + doc = """Amount of memory used to store the texture (in Mb). A value of + zero specifies the native resolution.""" + ) + + int inputs:faceIndex ( + doc = """The Ptex face index from which to sample. By default, this + parameter will be bound to the ptexFaceIndex primvar.""" + ) + + int inputs:faceOffset ( + doc = """The Ptex face offset to be applied to the face index. By + default, this parameter will be bound to the ptexFaceOffset primvar.""" + ) + + float outputs:r ( + doc = "Outputs the red channel." + sdrMetadata = { + token swizzle = "x" + } + ) + + float outputs:g ( + doc = "Outputs the green channel." + sdrMetadata = { + token swizzle = "y" + } + ) + + float outputs:b ( + doc = "Outputs the blue channnel." + sdrMetadata = { + token swizzle = "z" + } + ) + + float outputs:a ( + doc = "Outputs the alpha channnel." + sdrMetadata = { + token swizzle = "w" + } + ) + + float3 outputs:rgb ( + doc = "Outputs the red, green and blue channels." + sdrMetadata = { + token swizzle = "xyz" + } + ) + + float4 outputs:rgba ( + doc = "Outputs all 4 channels (red, green, blue and alpha)." + sdrMetadata = { + token swizzle = "xyzw" + } + ) +} + +def Shader "HwUvTexture_1" ( + sdrMetadata = { + token role = "texture" + token primvars = "uv" + } +) +{ + uniform token info:id = "HwUvTexture_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + asset inputs:file = @@ ( + doc = "Asset path to the file containg the image data." + ) + + float inputs:frame ( + doc = "The frame offset for animated textures." + ) + + float inputs:textureMemory ( + doc = """Amount of memory used to store the texture (in Mb). A value of + zero specifies the native resolution.""" + ) + + float2 inputs:uv ( + doc = "The uv coordinates at which to sample the texture." + ) + + token inputs:wrapS ( + allowedTokens = ["clamp", "repeat", "mirror", "black"] + doc = "Specifies the wrap mode for this texture." + ) + + token inputs:wrapT ( + allowedTokens = ["clamp", "repeat", "mirror", "black"] + doc = "Specifies the wrap mode for this texture." + ) + + token inputs:minFilter ( + allowedTokens = ["nearest", "linear", + "linearMipmapLinear", "linearMipmapNearest", + "nearestMipmapLinear", "nearestMipmapNearest" ] + doc = "Specifies the minification filter mode for this texture." + ) + + token inputs:magFilter ( + allowedTokens = ["nearest", "linear"] + doc = "Specifies the magnification filter mode for this texture." + ) + + float4 inputs:fallback = (0.0, 0.0, 0.0, 1.0) ( + doc = """Fallback value to be used when no texture is connected.""" + sdrMetadata = { + token defaultInput = "1" + } + ) +} + +def Shader "HwFieldReader_1" ( + sdrMetadata = { + token role = "field" + } + doc = """Samples from a usdVol FieldAsset.""" +) +{ + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + uniform token info:implementationSource = "sourceAsset" + token inputs:fieldname = "" ( + connectability = "interfaceOnly" + doc = """Name of the field to be fetched from volume + (e.g., FOO if the relationship from the volume to field is called field::FOO).""" + sdrMetadata = { + token fieldProperty = "1" + } + ) +} + +def Shader "HwFieldReader_float" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float" + float inputs:fallback = 0 ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float outputs:result ( + sdrMetadata = { + token swizzle = "x" + } + ) +} + +def Shader "HwFieldReader_float2" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float2" + float2 inputs:fallback = (0, 0) ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float2 outputs:result ( + sdrMetadata = { + token swizzle = "xy" + } + ) +} + +def Shader "HwFieldReader_float3" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float3" + float3 inputs:fallback = (0, 0, 0) ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float3 outputs:result ( + sdrMetadata = { + token swizzle = "xyz" + } + ) +} + +def Shader "HwPrimvar_1" ( + sdrMetadata = { + token role = "primvar" + } +) +{ + uniform token info:id = "HwPrimvar_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + token inputs:varname = "" ( + sdrMetadata = { + bool primvarProperty = 1 + } + doc = """The name of the primvar. Note that on the gprim, this primvar + must follow the standard UsdGeom primvar declaration. + Further note that this name should not contain the UsdGeom primvar + namespace prefix. + """ + ) +} +#usda 1.0 +( + "This file describes the Pixar-specific USD Geometric schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdHydra" + string libraryPath = "pxr/usd/usdHydra" + dictionary libraryTokens = { + + dictionary HwPrimvar_1 = { + string doc = """The id value of a Primvar shader.""" + } + + dictionary HwPtexTexture_1 = { + string doc = """The id value of a PtexTexture shader.""" + } + + dictionary HwUvTexture_1 = { + string doc = """The id value of a UvTexture shader.""" + } + + dictionary displayLookBxdf = { + string value = "displayLook:bxdf" + string doc = """\deprecated This has been deprecated in favor of + the glslfx:surface output. + + Relationship on a material that targets the "bxdf" or the + surface shader prim.""" + } + + dictionary infoFilename = { + string value = "inputs:file" + string doc = """ The special "info:filename" property of a hydra + Texture shader, which points to a resolvable texture asset.""" + } + + + dictionary infoVarname = { + string value = "inputs:varname" + string doc = """ + """ + } + + dictionary textureMemory = { + string doc = """A shader input on a hydra Texture shader.""" + } + + dictionary frame = { + string doc = """A shader input on a "Texture" shader.""" + } + + dictionary uv = { + string doc = """A shader input on a hydra UvTexture shader.""" + } + + dictionary wrapS = { + string doc = """A shader input on a hydra UvTexture shader which + defines the behavior of texture coordinates that are outside the + bounds of the texture.""" + } + + + dictionary wrapT = { + string doc = """A shader input on a hydra UvTexture shader which + defines the behavior of texture coordinates that are outside the + bounds of the texture.""" + } + + dictionary black = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes black to be returned when sampling outside the bounds of + the texture.""" + } + + dictionary clamp = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the the texture coordinate to be clamped to [0,1].""" + } + + dictionary mirror = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the texture coordinate to wrap around like a mirror. -0.2 + becomes 0.2, -1.2 becomes 0.8, etc. ,""" + } + + dictionary repeat = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the texture coordinate to wrap around the texture. So a + texture coordinate of -0.2 becomes the equivalent of 0.8.""" + } + + dictionary useMetadata = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the wrap value to be loaded from the texture file instead + of being specified in the prim. If the texture file doesn't + support metadata or the metadata doesn't contain a wrap mode, + the "black" wrap mode is used.""" + } + + dictionary magFilter = { + string doc = """An input on a UvTexture shader.""" + } + + dictionary minFilter = { + string doc = """An input on a UvTexture shader.""" + } + + dictionary linearMipmapLinear = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object , + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary linearMipmapNearest = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary nearestMipmapNearest = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary linear = { + string doc = """A weighted linear blend of nearest adjacent + samples. + Possible value for "minFilter" and "magFilter" inputs on a + UvTextureshader.""" + } + + dictionary nearest = { + string doc = """Selects the nearest sample for the given + coordinate + Possible value for "minFilter" and "magFilter" inputs on a + UvTexture shader.""" + } + + dictionary nearestMipmapLinear = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for "minFilter" and "magFilter" inputs on a + UvTexture shader.""" + } + + dictionary faceIndex = { + string doc = """The "faceIndex" shader input on a hydra + "PtexTexture" shader.""" + } + + dictionary faceOffset = { + string doc = """The "faceOffset" shader input on a hydra + "PtexTexture" shader.""" + } + } + } +){ +} + +class "HydraGenerativeProceduralAPI" ( + inherits = + doc = """ + This API extends and configures the core UsdProcGenerativeProcedural schema + defined within usdProc for use with hydra generative procedurals as defined + within hdGp. + """ + customData = { + string className = "GenerativeProceduralAPI" + token[] apiSchemaCanOnlyApplyTo = ["GenerativeProcedural"] + } +){ + token primvars:hdGp:proceduralType ( + doc = """The registered name of a HdGpGenerativeProceduralPlugin to + be executed.""" + + customData = { + string apiName = "proceduralType" + } + ) + + token proceduralSystem = "hydraGenerativeProcedural" ( + doc = """ + This value should correspond to a configured instance of + HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the + procedural. The default value of "hydraGenerativeProcedural" matches + the equivalent default of HdGpGenerativeProceduralResolvingSceneIndex. + Multiple instances of the scene index can be used to determine where + within a scene index chain a given procedural will be evaluated. + """ + ) +} +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "faceIndexPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "ptexFaceIndex", + "documentation": "Specifies an array of face indices used for ptex mapping", + "type": "token" + }, + "faceOffsetPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "ptexFaceOffset", + "documentation": "Specifies the ptex face index offset for aggregated ptex files", + "type": "token" + }, + "uvPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "", + "documentation": "Specifies the UV primvar for texture mapping", + "type": "token" + } + }, + "Types": { + "UsdImagingBasisCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "BasisCurves" + }, + "UsdImagingCameraAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "Camera" + }, + "UsdImagingCapsuleAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "includeSchemaFamily": true, + "primTypeName": "Capsule" + }, + "UsdImagingCollectionAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "CollectionAPI" + }, + "UsdImagingConeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Cone" + }, + "UsdImagingCoordSysAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "coordSys" + }, + "UsdImagingCoordSysAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "CoordSysAPI" + }, + "UsdImagingCubeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Cube" + }, + "UsdImagingCylinderAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "includeSchemaFamily": true, + "primTypeName": "Cylinder" + }, + "UsdImagingDrawModeAdapter" : { + "bases": ["UsdImagingInstanceablePrimAdapter"], + "isInternal": true, + "primTypeName": "__drawModeAdapter" + }, + "UsdImagingGeomSubsetAdapter" : { + "bases": ["UsdImagingPrimAdapter"], + "isInternal": true, + "primTypeName": "GeomSubset" + }, + "UsdImagingHermiteCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "HermiteCurves" + }, + "UsdImagingMaterialAdapter" : { + "bases": ["UsdImagingPrimAdapter"], + "isInternal": true, + "primTypeName": "Material" + }, + + "UsdImagingShaderAdapter" : { + "bases": ["UsdImagingRepresentedByAncestorPrimAdapter"], + "isInternal": true, + "primTypeName": "Shader" + }, + + "UsdImagingNodeGraphAdapter" : { + "bases": ["UsdImagingRepresentedByAncestorPrimAdapter"], + "isInternal": true, + "primTypeName": "NodeGraph" + }, + + "UsdImagingMaterialBindingAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "MaterialBindingAPI" + }, + "UsdImagingMeshAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Mesh" + }, + "UsdImagingTetMeshAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "TetMesh" + }, + "UsdImagingNurbsCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "NurbsCurves" + }, + "UsdImagingNurbsPatchAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "NurbsPatch" + }, + "UsdImagingPlaneAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Plane" + }, + "UsdImagingPointsAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Points" + }, + "UsdImagingPointInstancerAdapter": { + "bases": [ + "UsdImagingInstanceablePrimAdapter" + ], + "isInternal": true, + "primTypeName": "PointInstancer" + }, + "UsdImagingSphereAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Sphere" + }, + "UsdImagingRenderSettingsAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderSettings" + }, + "UsdImagingRenderProductAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderProduct" + }, + "UsdImagingRenderVarAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderVar" + }, + "UsdImagingVolumeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Volume" + }, + "UsdImagingLightAdapter": { + "bases": [ + "UsdImagingInstanceablePrimAdapter" + ], + "isInternal": true, + "primTypeName": "LightAPI", + "includeDerivedPrimTypes" : true + }, + "UsdImagingLightAPIAdapter": { + "bases": [ + "UsdImagingAPISchemaAdapter" + ], + "isInternal": true, + "apiSchemaName": "LightAPI" + }, + "UsdImagingLightFilterAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "LightFilter", + "includeDerivedPrimTypes" : true + }, + "UsdImagingDomeLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DomeLight" + }, + "UsdImagingDomeLight_1Adapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DomeLight_1" + }, + "UsdImagingRectLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "RectLight" + }, + "UsdImagingSphereLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "SphereLight" + }, + "UsdImagingCylinderLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "CylinderLight" + }, + "UsdImagingDiskLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DiskLight" + }, + "UsdImagingDistantLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DistantLight" + }, + "UsdImagingPluginLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "PluginLight" + }, + "UsdImagingGeometryLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "GeometryLight" + }, + "UsdImagingPortalLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "PortalLight" + }, + "UsdImagingPluginLightFilterAdapter": { + "bases": [ + "UsdImagingLightFilterAdapter" + ], + "isInternal": true, + "primTypeName": "PluginLightFilter" + }, + "UsdImagingGeomModelAPIAdapter": { + "bases": [ + "UsdImagingAPISchemaAdapter" + ], + "isInternal": true, + "apiSchemaName": "GeomModelAPI" + } + } + }, + "LibraryPath": "", + "Name": "usdImaging", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "LightAPI" ( + apiSchemas = ["CollectionAPI:lightLink", "CollectionAPI:shadowLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:lightLink:includeRoot", "collection:shadowLink:includeRoot"] + } + doc = """API schema that imparts the quality of being a light onto a prim. + + A light is any prim that has this schema applied to it. This is true + regardless of whether LightAPI is included as a built-in API of the prim + type (e.g. RectLight or DistantLight) or is applied directly to a Gprim + that should be treated as a light. + + Linking + + Lights can be linked to geometry. Linking controls which geometry + a light illuminates, and which geometry casts shadows from the light. + + Linking is specified as collections (UsdCollectionAPI) which can + be accessed via GetLightLinkCollection() and GetShadowLinkCollection(). + Note that these collections have their includeRoot set to true, + so that lights will illuminate and cast shadows from all objects + by default. To illuminate only a specific set of objects, there + are two options. One option is to modify the collection paths + to explicitly exclude everything else, assuming it is known; + the other option is to set includeRoot to false and explicitly + include the desired objects. These are complementary approaches + that may each be preferable depending on the scenario and how + to best express the intent of the light setup. + """ +) +{ + uniform bool collection:lightLink:includeRoot = 1 + uniform bool collection:shadowLink:includeRoot = 1 + color3f inputs:color = (1, 1, 1) ( + displayGroup = "Basic" + displayName = "Color" + doc = "The color of emitted light, in energy-linear terms." + ) + float inputs:colorTemperature = 6500 ( + displayGroup = "Basic" + displayName = "Color Temperature" + doc = """Color temperature, in degrees Kelvin, representing the + white point. The default is a common white point, D65. Lower + values are warmer and higher values are cooler. The valid range + is from 1000 to 10000. Only takes effect when + enableColorTemperature is set to true. When active, the + computed result multiplies against the color attribute. + See UsdLuxBlackbodyTemperatureAsRgb().""" + ) + float inputs:diffuse = 1 ( + displayGroup = "Refine" + displayName = "Diffuse Multiplier" + doc = """A multiplier for the effect of this light on the diffuse + response of materials. This is a non-physical control.""" + ) + bool inputs:enableColorTemperature = 0 ( + displayGroup = "Basic" + displayName = "Enable Color Temperature" + doc = "Enables using colorTemperature." + ) + float inputs:exposure = 0 ( + displayGroup = "Basic" + displayName = "Exposure" + doc = """Scales the power of the light exponentially as a power + of 2 (similar to an F-stop control over exposure). The result + is multiplied against the intensity.""" + ) + float inputs:intensity = 1 ( + displayGroup = "Basic" + displayName = "Intensity" + doc = "Scales the power of the light linearly." + ) + bool inputs:normalize = 0 ( + displayGroup = "Advanced" + displayName = "Normalize Power" + doc = """Normalizes power by the surface area of the light. + This makes it easier to independently adjust the power and shape + of the light, by causing the power to not vary with the area or + angular size of the light.""" + ) + float inputs:specular = 1 ( + displayGroup = "Refine" + displayName = "Specular Multiplier" + doc = """A multiplier for the effect of this light on the specular + response of materials. This is a non-physical control.""" + ) + rel light:filters ( + doc = "Relationship to the light filters that apply to this light." + ) + uniform token light:materialSyncMode = "noMaterialResponse" ( + allowedTokens = ["materialGlowTintsLight", "independent", "noMaterialResponse"] + displayGroup = "Geometry" + displayName = "Material Sync Mode" + doc = """For a LightAPI applied to geometry that has a bound Material, + which is entirely or partly emissive, this specifies the relationship + of the Material response to the lighting response. + Valid values are: + - materialGlowTintsLight: All primary and secondary rays see the + emissive/glow response as dictated by the bound Material while the + base color seen by light rays (which is then modulated by all of the + other LightAPI controls) is the multiplication of the color feeding + the emission/glow input of the Material (i.e. its surface or volume + shader) with the scalar or pattern input to *inputs:color*. + This allows the light's color to tint the geometry's glow color while + preserving access to intensity and other light controls as ways to + further modulate the illumination. + - independent: All primary and secondary rays see the emissive/glow + response as dictated by the bound Material, while the base color seen + by light rays is determined solely by *inputs:color*. Note that for + partially emissive geometry (in which some parts are reflective + rather than emissive), a suitable pattern must be connected to the + light's color input, or else the light will radiate uniformly from + the geometry. + - noMaterialResponse: The geometry behaves as if there is no Material + bound at all, i.e. there is no diffuse, specular, or transmissive + response. The base color of light rays is entirely controlled by the + *inputs:color*. This is the standard mode for \"canonical\" lights in + UsdLux and indicates to renderers that a Material will either never + be bound or can always be ignored. + """ + ) + uniform token light:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light's shader. + This defines the shader ID for this light when a render context specific + shader ID is not available. + + The default shaderId for the intrinsic UsdLux lights (RectLight, + DistantLight, etc.) are set to default to the light's type name. For + each intrinsic UsdLux light, we will always register an SdrShaderNode in + the SdrRegistry, with the identifier matching the type name and the + source type \"USD\", that corresponds to the light's inputs. + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) +} + +class "MeshLightAPI" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:materialSyncMode", "light:shaderId"] + } + doc = '''This is the preferred API schema to apply to + "Mesh" type prims when adding light behaviors to a mesh. + At its base, this API schema has the built-in behavior of applying LightAPI + to the mesh and overriding the default materialSyncMode to allow the + emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "mesh lights" through the creation of API schemas which are + authored to auto-apply to MeshLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + ''' +) +{ + uniform token light:materialSyncMode = "materialGlowTintsLight" + uniform token light:shaderId = "MeshLight" +} + +class "VolumeLightAPI" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:materialSyncMode", "light:shaderId"] + } + doc = '''This is the preferred API schema to apply to + "Volume" type prims when adding light behaviors to a + volume. At its base, this API schema has the built-in behavior of applying + LightAPI to the volume and overriding the default materialSyncMode to allow + the emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "volume lights" through the creation of API schemas which are + authored to auto-apply to VolumeLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + ''' +) +{ + uniform token light:materialSyncMode = "materialGlowTintsLight" + uniform token light:shaderId = "VolumeLight" +} + +class "LightListAPI" ( + doc = '''API schema to support discovery and publishing of lights in a scene. + + Discovering Lights via Traversal + + To motivate this API, consider what is required to discover all + lights in a scene. We must load all payloads and traverse all prims: + + \\code + 01 // Load everything on the stage so we can find all lights, + 02 // including those inside payloads + 03 stage->Load(); + 04 + 05 // Traverse all prims, checking if they have an applied UsdLuxLightAPI + 06 // (Note: ignoring instancing and a few other things for simplicity) + 07 SdfPathVector lights; + 08 for (UsdPrim prim: stage->Traverse()) { + 09 if (prim.HasAPI()) { + 10 lights.push_back(i->GetPath()); + 11 } + 12 } + \\endcode + + This traversal -- suitably elaborated to handle certain details -- + is the first and simplest thing UsdLuxLightListAPI provides. + UsdLuxLightListAPI::ComputeLightList() performs this traversal and returns + all lights in the scene: + + \\code + 01 UsdLuxLightListAPI listAPI(stage->GetPseudoRoot()); + 02 SdfPathVector lights = listAPI.ComputeLightList(); + \\endcode + + Publishing a Cached Light List + + Consider a USD client that needs to quickly discover lights but + wants to defer loading payloads and traversing the entire scene + where possible, and is willing to do up-front computation and + caching to achieve that. + + UsdLuxLightListAPI provides a way to cache the computed light list, + by publishing the list of lights onto prims in the model + hierarchy. Consider a big set that contains lights: + + \\code + 01 def Xform "BigSetWithLights" ( + 02 kind = "assembly" + 03 payload = @BigSetWithLights.usd@ // Heavy payload + 04 ) { + 05 // Pre-computed, cached list of lights inside payload + 06 rel lightList = [ + 07 <./Lights/light_1>, + 08 <./Lights/light_2>, + 09 ... + 10 ] + 11 token lightList:cacheBehavior = "consumeAndContinue"; + 12 } + \\endcode + + The lightList relationship encodes a set of lights, and the + lightList:cacheBehavior property provides fine-grained + control over how to use that cache. (See details below.) + + The cache can be created by first invoking + ComputeLightList(ComputeModeIgnoreCache) to pre-compute the list + and then storing the result with UsdLuxLightListAPI::StoreLightList(). + + To enable efficient retrieval of the cache, it should be stored + on a model hierarchy prim. Furthermore, note that while you can + use a UsdLuxLightListAPI bound to the pseudo-root prim to query the + lights (as in the example above) because it will perform a + traversal over descendants, you cannot store the cache back to the + pseduo-root prim. + + To consult the cached list, we invoke + ComputeLightList(ComputeModeConsultModelHierarchyCache): + + \\code + 01 // Find and load all lights, using lightList cache where available + 02 UsdLuxLightListAPI list(stage->GetPseudoRoot()); + 03 SdfPathSet lights = list.ComputeLightList( + 04 UsdLuxLightListAPI::ComputeModeConsultModelHierarchyCache); + 05 stage.LoadAndUnload(lights, SdfPathSet()); + \\endcode + + In this mode, ComputeLightList() will traverse the model + hierarchy, accumulating cached light lists. + + Controlling Cache Behavior + + The lightList:cacheBehavior property gives additional fine-grained + control over cache behavior: + + - The fallback value, "ignore", indicates that the lightList should + be disregarded. This provides a way to invalidate cache entries. + Note that unless "ignore" is specified, a lightList with an empty + list of targets is considered a cache indicating that no lights + are present. + + - The value "consumeAndContinue" indicates that the cache should + be consulted to contribute lights to the scene, and that recursion + should continue down the model hierarchy in case additional lights + are added as descedants. This is the default value established when + StoreLightList() is invoked. This behavior allows the lights within + a large model, such as the BigSetWithLights example above, to be + published outside the payload, while also allowing referencing and + layering to add additional lights over that set. + + - The value "consumeAndHalt" provides a way to terminate recursive + traversal of the scene for light discovery. The cache will be + consulted but no descendant prims will be examined. + + Instancing + + Where instances are present, UsdLuxLightListAPI::ComputeLightList() will + return the instance-unique paths to any lights discovered within + those instances. Lights within a UsdGeomPointInstancer will + not be returned, however, since they cannot be referred to + solely via paths. +''' +) +{ + rel lightList ( + doc = "Relationship to lights in the scene." + ) + token lightList:cacheBehavior ( + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + ) +} + +class "ListAPI" ( + doc = """ + \\deprecated + Use LightListAPI instead +""" +) +{ + rel lightList ( + doc = "Relationship to lights in the scene." + ) + token lightList:cacheBehavior ( + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + ) +} + +class "ShapingAPI" ( + doc = "Controls for shaping a light's emission." +) +{ + float inputs:shaping:cone:angle = 90 ( + displayGroup = "Shaping" + displayName = "Cone Angle" + doc = """Angular limit off the primary axis to restrict the + light spread.""" + ) + float inputs:shaping:cone:softness = 0 ( + displayGroup = "Shaping" + displayName = "Cone Softness" + doc = """Controls the cutoff softness for cone angle. + TODO: clarify semantics""" + ) + float inputs:shaping:focus = 0 ( + displayGroup = "Shaping" + displayName = "Emission Focus" + doc = """A control to shape the spread of light. Higher focus + values pull light towards the center and narrow the spread. + Implemented as an off-axis cosine power exponent. + TODO: clarify semantics""" + ) + color3f inputs:shaping:focusTint = (0, 0, 0) ( + displayGroup = "Shaping" + displayName = "Emission Focus Tint" + doc = """Off-axis color tint. This tints the emission in the + falloff region. The default tint is black. + TODO: clarify semantics""" + ) + float inputs:shaping:ies:angleScale = 0 ( + displayGroup = "Shaping" + displayName = "Profile Scale" + doc = """Rescales the angular distribution of the IES profile. + TODO: clarify semantics""" + ) + asset inputs:shaping:ies:file ( + displayGroup = "Shaping" + displayName = "IES Profile" + doc = """An IES (Illumination Engineering Society) light + profile describing the angular distribution of light.""" + ) + bool inputs:shaping:ies:normalize = 0 ( + displayGroup = "Shaping" + displayName = "Profile Normalization" + doc = """Normalizes the IES profile so that it affects the shaping + of the light while preserving the overall energy output.""" + ) +} + +class "ShadowAPI" ( + doc = """Controls to refine a light's shadow behavior. These are + non-physical controls that are valuable for visual lighting work.""" +) +{ + color3f inputs:shadow:color = (0, 0, 0) ( + displayGroup = "Shadows" + displayName = "Shadow Color" + doc = """The color of shadows cast by the light. This is a + non-physical control. The default is to cast black shadows.""" + ) + float inputs:shadow:distance = -1 ( + displayGroup = "Shadows" + displayName = "Shadow Max Distance" + doc = """The maximum distance shadows are cast. The distance is + measured as the distance between the point on the surface and the + occluder. + The default value (-1) indicates no limit. + """ + ) + bool inputs:shadow:enable = 1 ( + displayGroup = "Shadows" + displayName = "Enable Shadows" + doc = "Enables shadows to be cast by this light." + ) + float inputs:shadow:falloff = -1 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff" + doc = """The size of the shadow falloff zone within the shadow max + distance, which can be used to hide the hard cut-off for shadows seen + stretching past the max distance. The falloff zone is the area that + fades from full shadowing at the beginning of the falloff zone to no + shadowing at the max distance from the occluder. The falloff zone + distance cannot exceed the shadow max distance. A falloff value equal + to or less than zero (with -1 as the default) indicates no falloff. + """ + ) + float inputs:shadow:falloffGamma = 1 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff Gamma" + doc = """A gamma (i.e., exponential) control over shadow strength + with linear distance within the falloff zone. This controls the rate + of the falloff. + This requires the use of shadowDistance and shadowFalloff.""" + ) +} + +class LightFilter "LightFilter" ( + apiSchemas = ["CollectionAPI:filterLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:filterLink:includeRoot"] + } + doc = """A light filter modifies the effect of a light. + Lights refer to filters via relationships so that filters may be + shared. + + Linking + + Filters can be linked to geometry. Linking controls which geometry + a light-filter affects, when considering the light filters attached + to a light illuminating the geometry. + + Linking is specified as a collection (UsdCollectionAPI) which can + be accessed via GetFilterLinkCollection(). + """ +) +{ + uniform bool collection:filterLink:includeRoot = 1 + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "BoundableLightBase" ( + apiSchemas = ["LightAPI"] + doc = """Base class for intrinsic lights that are boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "NonboundableLightBase" ( + apiSchemas = ["LightAPI"] + doc = """Base class for intrinsic lights that are not boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DistantLight "DistantLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["inputs:intensity", "light:shaderId"] + } + doc = """Light emitted from a distant source along the -Z axis. + Also known as a directional light.""" +) +{ + float inputs:angle = 0.53 ( + displayGroup = "Basic" + displayName = "Angle Extent" + doc = """Angular size of the light in degrees. + As an example, the Sun is approximately 0.53 degrees as seen from Earth. + Higher values broaden the light and therefore soften shadow edges. + """ + ) + float inputs:intensity = 50000 ( + doc = """Scales the emission of the light linearly. + The DistantLight has a high default intensity to approximate the Sun.""" + ) + uniform token light:shaderId = "DistantLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DiskLight "DiskLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted from one side of a circular disk. + The disk is centered in the XY plane and emits light along the -Z axis.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the disk." + ) + uniform token light:shaderId = "DiskLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class RectLight "RectLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted from one side of a rectangle. + The rectangle is centered in the XY plane and emits light along the -Z axis. + The rectangle is 1 unit in length in the X and Y axis. In the default + position, a texture file's min coordinates should be at (+X, +Y) and + max coordinates at (-X, -Y).""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the rectangle, in the local Y axis." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = "A color texture to use on the rectangle." + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the rectangle, in the local X axis." + ) + uniform token light:shaderId = "RectLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class SphereLight "SphereLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = "Light emitted outward from a sphere." +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the sphere." + ) + uniform token light:shaderId = "SphereLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + bool treatAsPoint = 0 ( + displayGroup = "Advanced" + displayName = "Treat As Point" + doc = """A hint that this light can be treated as a 'point' + light (effectively, a zero-radius sphere) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class CylinderLight "CylinderLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted outward from a cylinder. + The cylinder is centered at the origin and has its major axis on the X axis. + The cylinder does not emit light from the flat end-caps. + """ +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:length = 1 ( + displayGroup = "Geometry" + displayName = "Length" + doc = "Length of the cylinder, in the local X axis." + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the cylinder." + ) + uniform token light:shaderId = "CylinderLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + bool treatAsLine = 0 ( + displayGroup = "Advanced" + displayName = "Treat As Line" + doc = """A hint that this light can be treated as a 'line' + light (effectively, a zero-radius cylinder) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class GeometryLight "GeometryLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """\\deprecated + Light emitted outward from a geometric prim (UsdGeomGprim), + which is typically a mesh.""" +) +{ + rel geometry ( + doc = "Relationship to the geometry to use as the light source." + ) + uniform token light:shaderId = "GeometryLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DomeLight "DomeLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is such + that its top pole is aligned with the world's +Y axis. This adheres to the + OpenEXR specification for latlong environment maps. From the OpenEXR + documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- +""" +) +{ + float guideRadius = 100000 ( + displayGroup = "Guides" + displayName = "Radius" + doc = "The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm)." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + ) + token inputs:texture:format = "automatic" ( + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + displayGroup = "Basic" + displayName = "Color Map Format" + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + ) + uniform token light:shaderId = "DomeLight" + rel portals ( + doc = "Optional portals to guide light sampling." + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DomeLight_1 "DomeLight_1" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is + determined by its *poleAxis* property. The fallback value, \"scene\", means + that the dome starts with its top pole aligned with the stage's up axis. + + Note that the rotation necessary to align the dome light with its *poleAxis* + is intended to be applied by a renderer to only the dome itself, and *not* + to inherit down to any USD namespace children of the dome light prim. + + If *poleAxis* is set to \"Y\" or \"scene\" and the stage's up axis is \"Y\", the + dome's default orientation will adhere to the OpenEXR specification for + latlong environment maps. From the OpenEXR documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- + + If *poleAxis* is set to \"Z\" or \"scene\" and the stage's up axis is \"Z\", + latitudes -pi/2 and +pi/2 will instead correspond to the negative and + positive Z direction, and latitude 0, longitude 0 will instead point into + the negative Y direction in 3D space. +""" +) +{ + float guideRadius = 100000 ( + displayGroup = "Guides" + displayName = "Radius" + doc = "The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm)." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + ) + token inputs:texture:format = "automatic" ( + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + displayGroup = "Basic" + displayName = "Color Map Format" + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + ) + uniform token light:shaderId = "DomeLight" + uniform token poleAxis = "scene" ( + allowedTokens = ["scene", "Y", "Z"] + displayGroup = "Advanced" + displayName = "Pole Axis" + doc = """A token which indicates the starting alignment of the dome + light's top pole. This alignment is for the dome itself and is *not* + inherited by the namespace children of the dome. + Valid values are: + - scene: The dome light's top pole is aligned with the stage's up axis. + - Y: The dome light's top pole is aligned with the +Y axis. + - Z: The dome light's top pole is aligned with the +Z axis. + """ + ) + rel portals ( + doc = "Optional portals to guide light sampling." + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PortalLight "PortalLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """A rectangular portal in the local XY plane that guides sampling + of a dome light. Transmits light in the -Z direction. + The rectangle is 1 unit in length.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the portal rectangle in the local Y axis." + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the portal rectangle in the local X axis." + ) + uniform token light:shaderId = "PortalLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PluginLight "PluginLight" ( + apiSchemas = ["NodeDefAPI", "LightAPI"] + doc = """Light that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light's type. + + \\see \\ref usdLux_PluginSchemas +""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PluginLightFilter "PluginLightFilter" ( + apiSchemas = ["NodeDefAPI", "CollectionAPI:filterLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:filterLink:includeRoot"] + } + doc = """Light filter that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light filter's type. + + \\see \\ref usdLux_PluginSchemas +""" +) +{ + uniform bool collection:filterLink:includeRoot = 1 + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdLuxBoundableLightBase": { + "alias": { + "UsdSchemaBase": "BoundableLightBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "schemaKind": "abstractTyped" + }, + "UsdLuxCylinderLight": { + "alias": { + "UsdSchemaBase": "CylinderLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxDiskLight": { + "alias": { + "UsdSchemaBase": "DiskLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxDistantLight": { + "alias": { + "UsdSchemaBase": "DistantLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxDomeLight": { + "alias": { + "UsdSchemaBase": "DomeLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxDomeLight_1": { + "alias": { + "UsdSchemaBase": "DomeLight_1" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxGeometryLight": { + "alias": { + "UsdSchemaBase": "GeometryLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxLightAPI": { + "alias": { + "UsdSchemaBase": "LightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "singleApplyAPI" + }, + "UsdLuxLightFilter": { + "alias": { + "UsdSchemaBase": "LightFilter" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxLightListAPI": { + "alias": { + "UsdSchemaBase": "LightListAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxListAPI": { + "alias": { + "UsdSchemaBase": "ListAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxMeshLightAPI": { + "alias": { + "UsdSchemaBase": "MeshLightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxNonboundableLightBase": { + "alias": { + "UsdSchemaBase": "NonboundableLightBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdLuxPluginLight": { + "alias": { + "UsdSchemaBase": "PluginLight" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxPluginLightFilter": { + "alias": { + "UsdSchemaBase": "PluginLightFilter" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxLightFilter" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxPortalLight": { + "alias": { + "UsdSchemaBase": "PortalLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxRectLight": { + "alias": { + "UsdSchemaBase": "RectLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxShadowAPI": { + "alias": { + "UsdSchemaBase": "ShadowAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxShapingAPI": { + "alias": { + "UsdSchemaBase": "ShapingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxSphereLight": { + "alias": { + "UsdSchemaBase": "SphereLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxVolumeLightAPI": { + "alias": { + "UsdSchemaBase": "VolumeLightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLux_DiscoveryPlugin": { + "bases": [ + "NdrDiscoveryPlugin" + ] + }, + "UsdLux_LightDefParserPlugin": { + "bases": [ + "NdrParserPlugin" + ] + } + } + }, + "LibraryPath": "", + "Name": "usdLux", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Lux light schemata for code generation." + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdLux" + string libraryPath = "pxr/usd/usdLux" + dictionary libraryTokens = { + dictionary lightLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent light-linking + of a prim with an applied UsdLuxLightAPI. + """ + } + dictionary shadowLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent shadow-linking + of a prim with an applied UsdLuxLightAPI. + """ + } + dictionary filterLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent filter-linking + of a UsdLuxLightFilter prim. + """ + } + dictionary orientToStageUpAxis = { + string doc = """ + This token represents the suffix for a UsdGeomXformOp + used to orient a light with the stage's up axis. + """ + } + } + } +) +{ +} + +class "LightAPI" ( + inherits = + doc = """API schema that imparts the quality of being a light onto a prim. + + A light is any prim that has this schema applied to it. This is true + regardless of whether LightAPI is included as a built-in API of the prim + type (e.g. RectLight or DistantLight) or is applied directly to a Gprim + that should be treated as a light. + + Linking + + Lights can be linked to geometry. Linking controls which geometry + a light illuminates, and which geometry casts shadows from the light. + + Linking is specified as collections (UsdCollectionAPI) which can + be accessed via GetLightLinkCollection() and GetShadowLinkCollection(). + Note that these collections have their includeRoot set to true, + so that lights will illuminate and cast shadows from all objects + by default. To illuminate only a specific set of objects, there + are two options. One option is to modify the collection paths + to explicitly exclude everything else, assuming it is known; + the other option is to set includeRoot to false and explicitly + include the desired objects. These are complementary approaches + that may each be preferable depending on the scenario and how + to best express the intent of the light setup. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + prepend apiSchemas = ["CollectionAPI:lightLink", "CollectionAPI:shadowLink"] +) { + uniform bool collection:lightLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform bool collection:shadowLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light's shader. + This defines the shader ID for this light when a render context specific + shader ID is not available. + + The default shaderId for the intrinsic UsdLux lights (RectLight, + DistantLight, etc.) are set to default to the light's type name. For + each intrinsic UsdLux light, we will always register an SdrShaderNode in + the SdrRegistry, with the identifier matching the type name and the + source type "USD", that corresponds to the light's inputs. + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + customData = { + token apiName = "shaderId" + } + ) + uniform token light:materialSyncMode = "noMaterialResponse" ( + displayGroup = "Geometry" + displayName = "Material Sync Mode" + doc = """For a LightAPI applied to geometry that has a bound Material, + which is entirely or partly emissive, this specifies the relationship + of the Material response to the lighting response. + Valid values are: + - materialGlowTintsLight: All primary and secondary rays see the + emissive/glow response as dictated by the bound Material while the + base color seen by light rays (which is then modulated by all of the + other LightAPI controls) is the multiplication of the color feeding + the emission/glow input of the Material (i.e. its surface or volume + shader) with the scalar or pattern input to *inputs:color*. + This allows the light's color to tint the geometry's glow color while + preserving access to intensity and other light controls as ways to + further modulate the illumination. + - independent: All primary and secondary rays see the emissive/glow + response as dictated by the bound Material, while the base color seen + by light rays is determined solely by *inputs:color*. Note that for + partially emissive geometry (in which some parts are reflective + rather than emissive), a suitable pattern must be connected to the + light's color input, or else the light will radiate uniformly from + the geometry. + - noMaterialResponse: The geometry behaves as if there is no Material + bound at all, i.e. there is no diffuse, specular, or transmissive + response. The base color of light rays is entirely controlled by the + *inputs:color*. This is the standard mode for "canonical" lights in + UsdLux and indicates to renderers that a Material will either never + be bound or can always be ignored. + """ + allowedTokens = ["materialGlowTintsLight", + "independent", + "noMaterialResponse"] + customData = { + token apiName = "materialSyncMode" + } + ) + float inputs:intensity = 1 ( + displayGroup = "Basic" + displayName = "Intensity" + doc = """Scales the power of the light linearly.""" + customData = { + token apiName = "intensity" + } + ) + float inputs:exposure = 0 ( + displayGroup = "Basic" + displayName = "Exposure" + doc = """Scales the power of the light exponentially as a power + of 2 (similar to an F-stop control over exposure). The result + is multiplied against the intensity.""" + customData = { + token apiName = "exposure" + } + ) + float inputs:diffuse = 1.0 ( + displayGroup = "Refine" + displayName = "Diffuse Multiplier" + doc = """A multiplier for the effect of this light on the diffuse + response of materials. This is a non-physical control.""" + customData = { + token apiName = "diffuse" + } + ) + float inputs:specular = 1.0 ( + displayGroup = "Refine" + displayName = "Specular Multiplier" + doc = """A multiplier for the effect of this light on the specular + response of materials. This is a non-physical control.""" + customData = { + token apiName = "specular" + } + ) + bool inputs:normalize = false ( + displayGroup = "Advanced" + displayName = "Normalize Power" + doc = """Normalizes power by the surface area of the light. + This makes it easier to independently adjust the power and shape + of the light, by causing the power to not vary with the area or + angular size of the light.""" + customData = { + token apiName = "normalize" + } + ) + color3f inputs:color = (1, 1, 1) ( + displayGroup = "Basic" + displayName = "Color" + doc = """The color of emitted light, in energy-linear terms.""" + customData = { + token apiName = "color" + } + ) + bool inputs:enableColorTemperature = false ( + displayGroup = "Basic" + displayName = "Enable Color Temperature" + doc = """Enables using colorTemperature.""" + customData = { + token apiName = "enableColorTemperature" + } + ) + float inputs:colorTemperature = 6500 ( + displayGroup = "Basic" + displayName = "Color Temperature" + doc = """Color temperature, in degrees Kelvin, representing the + white point. The default is a common white point, D65. Lower + values are warmer and higher values are cooler. The valid range + is from 1000 to 10000. Only takes effect when + enableColorTemperature is set to true. When active, the + computed result multiplies against the color attribute. + See UsdLuxBlackbodyTemperatureAsRgb().""" + customData = { + token apiName = "colorTemperature" + } + ) + rel light:filters ( + doc = """Relationship to the light filters that apply to this light.""" + customData = { + token apiName = "filters" + } + ) +} + +class "MeshLightAPI" ( + inherits = + doc = """This is the preferred API schema to apply to + \\ref UsdGeomMesh "Mesh" type prims when adding light behaviors to a mesh. + At its base, this API schema has the built-in behavior of applying LightAPI + to the mesh and overriding the default materialSyncMode to allow the + emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "mesh lights" through the creation of API schemas which are + authored to auto-apply to MeshLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + """ + prepend apiSchemas = ["LightAPI"] +) { + uniform token light:shaderId = "MeshLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:materialSyncMode = "materialGlowTintsLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class "VolumeLightAPI" ( + inherits = + doc = """This is the preferred API schema to apply to + \\ref UsdVolVolume "Volume" type prims when adding light behaviors to a + volume. At its base, this API schema has the built-in behavior of applying + LightAPI to the volume and overriding the default materialSyncMode to allow + the emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "volume lights" through the creation of API schemas which are + authored to auto-apply to VolumeLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + """ + prepend apiSchemas = ["LightAPI"] +) { + uniform token light:shaderId = "VolumeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:materialSyncMode = "materialGlowTintsLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class "LightListAPI" ( + inherits = + doc = """API schema to support discovery and publishing of lights in a scene. + + \\section UsdLuxLightListAPI_Discovery Discovering Lights via Traversal + + To motivate this API, consider what is required to discover all + lights in a scene. We must load all payloads and traverse all prims: + + \\code + 01 // Load everything on the stage so we can find all lights, + 02 // including those inside payloads + 03 stage->Load(); + 04 + 05 // Traverse all prims, checking if they have an applied UsdLuxLightAPI + 06 // (Note: ignoring instancing and a few other things for simplicity) + 07 SdfPathVector lights; + 08 for (UsdPrim prim: stage->Traverse()) { + 09 if (prim.HasAPI()) { + 10 lights.push_back(i->GetPath()); + 11 } + 12 } + \\endcode + + This traversal -- suitably elaborated to handle certain details -- + is the first and simplest thing UsdLuxLightListAPI provides. + UsdLuxLightListAPI::ComputeLightList() performs this traversal and returns + all lights in the scene: + + \\code + 01 UsdLuxLightListAPI listAPI(stage->GetPseudoRoot()); + 02 SdfPathVector lights = listAPI.ComputeLightList(); + \\endcode + + \\section UsdLuxLightListAPI_LightList Publishing a Cached Light List + + Consider a USD client that needs to quickly discover lights but + wants to defer loading payloads and traversing the entire scene + where possible, and is willing to do up-front computation and + caching to achieve that. + + UsdLuxLightListAPI provides a way to cache the computed light list, + by publishing the list of lights onto prims in the model + hierarchy. Consider a big set that contains lights: + + \\code + 01 def Xform "BigSetWithLights" ( + 02 kind = "assembly" + 03 payload = @BigSetWithLights.usd@ // Heavy payload + 04 ) { + 05 // Pre-computed, cached list of lights inside payload + 06 rel lightList = [ + 07 <./Lights/light_1>, + 08 <./Lights/light_2>, + 09 ... + 10 ] + 11 token lightList:cacheBehavior = "consumeAndContinue"; + 12 } + \\endcode + + The lightList relationship encodes a set of lights, and the + lightList:cacheBehavior property provides fine-grained + control over how to use that cache. (See details below.) + + The cache can be created by first invoking + ComputeLightList(ComputeModeIgnoreCache) to pre-compute the list + and then storing the result with UsdLuxLightListAPI::StoreLightList(). + + To enable efficient retrieval of the cache, it should be stored + on a model hierarchy prim. Furthermore, note that while you can + use a UsdLuxLightListAPI bound to the pseudo-root prim to query the + lights (as in the example above) because it will perform a + traversal over descendants, you cannot store the cache back to the + pseduo-root prim. + + To consult the cached list, we invoke + ComputeLightList(ComputeModeConsultModelHierarchyCache): + + \\code + 01 // Find and load all lights, using lightList cache where available + 02 UsdLuxLightListAPI list(stage->GetPseudoRoot()); + 03 SdfPathSet lights = list.ComputeLightList( + 04 UsdLuxLightListAPI::ComputeModeConsultModelHierarchyCache); + 05 stage.LoadAndUnload(lights, SdfPathSet()); + \\endcode + + In this mode, ComputeLightList() will traverse the model + hierarchy, accumulating cached light lists. + + \\section UsdLuxLightListAPI_CacheBehavior Controlling Cache Behavior + + The lightList:cacheBehavior property gives additional fine-grained + control over cache behavior: + + \\li The fallback value, "ignore", indicates that the lightList should + be disregarded. This provides a way to invalidate cache entries. + Note that unless "ignore" is specified, a lightList with an empty + list of targets is considered a cache indicating that no lights + are present. + + \\li The value "consumeAndContinue" indicates that the cache should + be consulted to contribute lights to the scene, and that recursion + should continue down the model hierarchy in case additional lights + are added as descedants. This is the default value established when + StoreLightList() is invoked. This behavior allows the lights within + a large model, such as the BigSetWithLights example above, to be + published outside the payload, while also allowing referencing and + layering to add additional lights over that set. + + \\li The value "consumeAndHalt" provides a way to terminate recursive + traversal of the scene for light discovery. The cache will be + consulted but no descendant prims will be examined. + + \\section UsdLuxLightListAPI_Instancing Instancing + + Where instances are present, UsdLuxLightListAPI::ComputeLightList() will + return the instance-unique paths to any lights discovered within + those instances. Lights within a UsdGeomPointInstancer will + not be returned, however, since they cannot be referred to + solely via paths. +""" +) { + rel lightList ( + doc = """Relationship to lights in the scene.""" + ) + token lightList:cacheBehavior ( + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + ) +} + +class "ListAPI" ( + inherits = + doc = """ + \\deprecated + Use LightListAPI instead +""" +) { + rel lightList ( + doc = """Relationship to lights in the scene.""" + ) + token lightList:cacheBehavior ( + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + ) +} + +class "ShapingAPI" ( + inherits = + doc = """Controls for shaping a light's emission.""" + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + +) { + float inputs:shaping:focus = 0 ( + displayGroup = "Shaping" + displayName = "Emission Focus" + doc = """A control to shape the spread of light. Higher focus + values pull light towards the center and narrow the spread. + Implemented as an off-axis cosine power exponent. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:focus" + } + ) + color3f inputs:shaping:focusTint = (0, 0, 0) ( + displayGroup = "Shaping" + displayName = "Emission Focus Tint" + doc = """Off-axis color tint. This tints the emission in the + falloff region. The default tint is black. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:focusTint" + } + ) + float inputs:shaping:cone:angle = 90 ( + displayGroup = "Shaping" + displayName = "Cone Angle" + doc = """Angular limit off the primary axis to restrict the + light spread.""" + customData = { + token apiName = "shaping:cone:angle" + } + ) + float inputs:shaping:cone:softness = 0 ( + displayGroup = "Shaping" + displayName = "Cone Softness" + doc = """Controls the cutoff softness for cone angle. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:cone:softness" + } + ) + asset inputs:shaping:ies:file ( + displayGroup = "Shaping" + displayName = "IES Profile" + doc = """An IES (Illumination Engineering Society) light + profile describing the angular distribution of light.""" + customData = { + token apiName = "shaping:ies:file" + } + ) + float inputs:shaping:ies:angleScale = 0 ( + displayGroup = "Shaping" + displayName = "Profile Scale" + doc = """Rescales the angular distribution of the IES profile. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:ies:angleScale" + } + ) + bool inputs:shaping:ies:normalize = false ( + displayGroup = "Shaping" + displayName = "Profile Normalization" + doc = """Normalizes the IES profile so that it affects the shaping + of the light while preserving the overall energy output.""" + customData = { + token apiName = "shaping:ies:normalize" + } + ) +} + +class "ShadowAPI" ( + inherits = + doc = """Controls to refine a light's shadow behavior. These are + non-physical controls that are valuable for visual lighting work.""" + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + +) { + bool inputs:shadow:enable = true ( + displayGroup = "Shadows" + displayName = "Enable Shadows" + doc = """Enables shadows to be cast by this light.""" + customData = { + token apiName = "shadow:enable" + } + ) + color3f inputs:shadow:color = (0, 0, 0) ( + displayGroup = "Shadows" + displayName = "Shadow Color" + doc = """The color of shadows cast by the light. This is a + non-physical control. The default is to cast black shadows.""" + customData = { + token apiName = "shadow:color" + } + ) + float inputs:shadow:distance = -1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Max Distance" + doc = """The maximum distance shadows are cast. The distance is + measured as the distance between the point on the surface and the + occluder. + The default value (-1) indicates no limit. + """ + customData = { + token apiName = "shadow:distance" + } + ) + float inputs:shadow:falloff = -1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff" + doc = """The size of the shadow falloff zone within the shadow max + distance, which can be used to hide the hard cut-off for shadows seen + stretching past the max distance. The falloff zone is the area that + fades from full shadowing at the beginning of the falloff zone to no + shadowing at the max distance from the occluder. The falloff zone + distance cannot exceed the shadow max distance. A falloff value equal + to or less than zero (with -1 as the default) indicates no falloff. + """ + customData = { + token apiName = "shadow:falloff" + } + ) + float inputs:shadow:falloffGamma = 1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff Gamma" + doc = """A gamma (i.e., exponential) control over shadow strength + with linear distance within the falloff zone. This controls the rate + of the falloff. + This requires the use of shadowDistance and shadowFalloff.""" + customData = { + token apiName = "shadow:falloffGamma" + } + ) +} + +class LightFilter "LightFilter" ( + inherits = + doc = """A light filter modifies the effect of a light. + Lights refer to filters via relationships so that filters may be + shared. + + Linking + + Filters can be linked to geometry. Linking controls which geometry + a light-filter affects, when considering the light filters attached + to a light illuminating the geometry. + + Linking is specified as a collection (UsdCollectionAPI) which can + be accessed via GetFilterLinkCollection(). + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + prepend apiSchemas = ["CollectionAPI:filterLink"] +) { + uniform bool collection:filterLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + customData = { + token apiName = "shaderId" + } + ) + +} + +class "BoundableLightBase" ( + inherits = + doc = """Base class for intrinsic lights that are boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ + customData = { + string extraIncludes = """#include "pxr/usd/usdLux/lightAPI.h" """ + } + prepend apiSchemas = ["LightAPI"] +) { +} + +class "NonboundableLightBase" ( + inherits = + doc = """Base class for intrinsic lights that are not boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ + customData = { + string extraIncludes = """#include "pxr/usd/usdLux/lightAPI.h" """ + } + prepend apiSchemas = ["LightAPI"] +) { +} + +class DistantLight "DistantLight" ( + inherits = + doc = """Light emitted from a distant source along the -Z axis. + Also known as a directional light.""" +) { + uniform token light:shaderId = "DistantLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:angle = 0.53 ( + displayGroup = "Basic" + displayName = "Angle Extent" + doc = """Angular size of the light in degrees. + As an example, the Sun is approximately 0.53 degrees as seen from Earth. + Higher values broaden the light and therefore soften shadow edges. + """ + customData = { + token apiName = "angle" + } + ) + float inputs:intensity = 50000 ( + doc = """Scales the emission of the light linearly. + The DistantLight has a high default intensity to approximate the Sun.""" + customData = { + token apiName = "intensity" + bool apiSchemaOverride = true + } + ) +} + +class DiskLight "DiskLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted from one side of a circular disk. + The disk is centered in the XY plane and emits light along the -Z axis.""" +) { + uniform token light:shaderId = "DiskLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the disk." + customData = { + token apiName = "radius" + } + ) +} + +class RectLight "RectLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted from one side of a rectangle. + The rectangle is centered in the XY plane and emits light along the -Z axis. + The rectangle is 1 unit in length in the X and Y axis. In the default + position, a texture file's min coordinates should be at (+X, +Y) and + max coordinates at (-X, -Y).""" +) { + uniform token light:shaderId = "RectLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the rectangle, in the local X axis." + customData = { + token apiName = "width" + } + + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the rectangle, in the local Y axis." + customData = { + token apiName = "height" + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the rectangle.""" + customData = { + token apiName = "textureFile" + } + ) +} + +class SphereLight "SphereLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted outward from a sphere.""" +) { + uniform token light:shaderId = "SphereLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the sphere." + customData = { + token apiName = "radius" + } + ) + bool treatAsPoint = false ( + displayGroup = "Advanced" + displayName = "Treat As Point" + doc = """A hint that this light can be treated as a 'point' + light (effectively, a zero-radius sphere) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) +} + +class CylinderLight "CylinderLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted outward from a cylinder. + The cylinder is centered at the origin and has its major axis on the X axis. + The cylinder does not emit light from the flat end-caps. + """ +) { + uniform token light:shaderId = "CylinderLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:length = 1 ( + displayGroup = "Geometry" + displayName = "Length" + doc = "Length of the cylinder, in the local X axis." + customData = { + token apiName = "length" + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the cylinder." + customData = { + token apiName = "radius" + } + ) + bool treatAsLine = false ( + displayGroup = "Advanced" + displayName = "Treat As Line" + doc = """A hint that this light can be treated as a 'line' + light (effectively, a zero-radius cylinder) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) +} + +class GeometryLight "GeometryLight" ( + inherits = + doc = """\\deprecated + Light emitted outward from a geometric prim (UsdGeomGprim), + which is typically a mesh.""" +) { + rel geometry ( + doc = """Relationship to the geometry to use as the light source.""" + ) + uniform token light:shaderId = "GeometryLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class DomeLight "DomeLight" ( + inherits = + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is such + that its top pole is aligned with the world's +Y axis. This adheres to the + OpenEXR specification for latlong environment maps. From the OpenEXR + documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- +""" +) { + uniform token light:shaderId = "DomeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + customData = { + token apiName = "textureFile" + } + ) + token inputs:texture:format = "automatic" ( + displayGroup = "Basic" + displayName = "Color Map Format" + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + customData = { + token apiName = "textureFormat" + } + ) + rel portals ( + doc = """Optional portals to guide light sampling.""" + ) + float guideRadius = 1.0e5 ( + displayGroup = "Guides" + displayName = "Radius" + doc = """The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm).""" + ) +} + +class DomeLight_1 "DomeLight_1" ( + inherits = + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is + determined by its *poleAxis* property. The fallback value, "scene", means + that the dome starts with its top pole aligned with the stage's up axis. + + Note that the rotation necessary to align the dome light with its *poleAxis* + is intended to be applied by a renderer to only the dome itself, and *not* + to inherit down to any USD namespace children of the dome light prim. + + If *poleAxis* is set to "Y" or "scene" and the stage's up axis is "Y", the + dome's default orientation will adhere to the OpenEXR specification for + latlong environment maps. From the OpenEXR documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- + + If *poleAxis* is set to "Z" or "scene" and the stage's up axis is "Z", + latitudes -pi/2 and +pi/2 will instead correspond to the negative and + positive Z direction, and latitude 0, longitude 0 will instead point into + the negative Y direction in 3D space. +""" +) { + uniform token light:shaderId = "DomeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + customData = { + token apiName = "textureFile" + } + ) + token inputs:texture:format = "automatic" ( + displayGroup = "Basic" + displayName = "Color Map Format" + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + customData = { + token apiName = "textureFormat" + } + ) + rel portals ( + doc = """Optional portals to guide light sampling.""" + ) + float guideRadius = 1.0e5 ( + displayGroup = "Guides" + displayName = "Radius" + doc = """The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm).""" + ) + uniform token poleAxis = "scene" ( + displayGroup = "Advanced" + displayName = "Pole Axis" + allowedTokens = ["scene", "Y", "Z"] + doc = """A token which indicates the starting alignment of the dome + light's top pole. This alignment is for the dome itself and is *not* + inherited by the namespace children of the dome. + Valid values are: + - scene: The dome light's top pole is aligned with the stage's up axis. + - Y: The dome light's top pole is aligned with the +Y axis. + - Z: The dome light's top pole is aligned with the +Z axis. + """ + ) +} + +class PortalLight "PortalLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """A rectangular portal in the local XY plane that guides sampling + of a dome light. Transmits light in the -Z direction. + The rectangle is 1 unit in length.""" +) { + uniform token light:shaderId = "PortalLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the portal rectangle in the local X axis." + customData = { + token apiName = "width" + } + + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the portal rectangle in the local Y axis." + customData = { + token apiName = "height" + } + ) +} + +class PluginLight "PluginLight" ( + inherits = + doc = """Light that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light's type. + + \\see \\ref usdLux_PluginSchemas +""" + prepend apiSchemas = ["NodeDefAPI", "LightAPI"] + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/nodeDefAPI.h" """ + } +) { +} + +class PluginLightFilter "PluginLightFilter" ( + inherits = + doc = """Light filter that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light filter's type. + + \\see \\ref usdLux_PluginSchemas +""" + prepend apiSchemas = ["NodeDefAPI"] + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/nodeDefAPI.h" """ + } +) { +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "RenderSettingsBase" ( + doc = """Abstract base class that defines render settings that + can be specified on either a RenderSettings prim or a RenderProduct + prim.""" +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderSettings "RenderSettings" ( + doc = """A UsdRenderSettings prim specifies global settings for + a render process, including an enumeration of the RenderProducts + that should result, and the UsdGeomImageable purposes that should + be rendered. \\ref UsdRenderHowSettingsAffectRendering""" +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform token[] includedPurposes = ["default", "render"] ( + doc = """The list of UsdGeomImageable _purpose_ values that + should be included in the render. Note this cannot be + specified per-RenderProduct because it is a statement of + which geometry is present.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform token[] materialBindingPurposes = ["full", ""] ( + allowedTokens = ["full", "preview", ""] + doc = '''Ordered list of material purposes to consider when + resolving material bindings in the scene. The empty string + indicates the "allPurpose" binding.''' + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + rel products ( + doc = """The set of RenderProducts the render should produce. + This relationship should target UsdRenderProduct prims. + If no _products_ are specified, an application should produce + an rgb image according to the RenderSettings configuration, + to a default display or image name.""" + ) + uniform token renderingColorSpace ( + doc = """Describes a renderer's working (linear) colorSpace where all + the renderer/shader math is expected to happen. When no + renderingColorSpace is provided, renderer should use its own default.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderVar "RenderVar" ( + doc = """A UsdRenderVar describes a custom data variable for + a render to produce. The prim describes the source of the data, which + can be a shader output or an LPE (Light Path Expression), and also + allows encoding of (generally renderer-specific) parameters that + configure the renderer for computing the variable. + + \\note The name of the RenderVar prim drives the name of the data + variable that the renderer will produce. + + \\note In the future, UsdRender may standardize RenderVar representation + for well-known variables under the sourceType `intrinsic`, + such as _r_, _g_, _b_, _a_, _z_, or _id_. + """ +) +{ + uniform token dataType = "color3f" ( + doc = "The type of this channel, as a USD attribute type." + ) + uniform string sourceName = "" ( + doc = """The renderer should look for an output of this name + as the computed value for the RenderVar.""" + ) + uniform token sourceType = "raw" ( + allowedTokens = ["raw", "primvar", "lpe", "intrinsic"] + doc = '''Indicates the type of the source. + + - "raw": The name should be passed directly to the + renderer. This is the default behavior. + - "primvar": This source represents the name of a primvar. + Some renderers may use this to ensure that the primvar + is provided; other renderers may require that a suitable + material network be provided, in which case this is simply + an advisory setting. + - "lpe": Specifies a Light Path Expression in the + [OSL Light Path Expressions language](https://github.com/imageworks/OpenShadingLanguage/wiki/OSL-Light-Path-Expressions) as the source for + this RenderVar. Some renderers may use extensions to + that syntax, which will necessarily be non-portable. + - "intrinsic": This setting is currently unimplemented, + but represents a future namespace for UsdRender to provide + portable baseline RenderVars, such as camera depth, that + may have varying implementations for each renderer. + ''' + ) +} + +class RenderProduct "RenderProduct" ( + doc = """A UsdRenderProduct describes an image or other + file-like artifact produced by a render. A RenderProduct + combines one or more RenderVars into a file or interactive + buffer. It also provides all the controls established in + UsdRenderSettingsBase as optional overrides to whatever the + owning UsdRenderSettings prim dictates. + + Specific renderers may support additional settings, such + as a way to configure compression settings, filetype metadata, + and so forth. Such settings can be encoded using + renderer-specific API schemas applied to the product prim. + """ +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + rel orderedVars ( + doc = """Specifies the RenderVars that should be consumed and + combined into the final product. If ordering is relevant to the + output driver, then the ordering of targets in this relationship + provides the order to use.""" + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + token productName = "" ( + doc = """Specifies the name that the output/display driver + should give the product. This is provided as-authored to the + driver, whose responsibility it is to situate the product on a + filesystem or other storage, in the desired location.""" + ) + uniform token productType = "raster" ( + doc = '''The type of output to produce. + The default, "raster", indicates a 2D image. + + \\note In the future, UsdRender may define additional product + types.''' + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderPass "RenderPass" ( + apiSchemas = ["CollectionAPI:renderVisibility"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:renderVisibility:includeRoot"] + } + doc = """A RenderPass prim encapsulates the necessary information + to generate multipass renders. It houses properties for generating + dependencies and the necessary commands to run to generate renders, as + well as visibility controls for the scene. While RenderSettings + describes the information needed to generate images from a single + invocation of a renderer, RenderPass describes the additional information + needed to generate a time varying set of images. + + There are two consumers of RenderPass prims - a runtime executable that + generates images from usdRender prims, and pipeline specific code that + translates between usdRender prims and the pipeline's resource scheduling + software. We'll refer to the latter as 'job submission code'. + + \\anchor usdRender_renderVisibility + The objects that are relevant to the render is specified via the + renderVisibility collection (UsdCollectionAPI) and can be accessed via + GetRenderVisibilityCollectionAPI(). This collection has includeRoot set to + true so that all objects participate in the render by default. To render + only a specific set of objects, there are two options. One is to modify the + collection paths to explicitly exclude objects that don't participate in + the render, assuming it is known; the other option is to set includeRoot to + false and explicitly include the desired objects. These are complementary + approaches that may each be preferable depending on the scenario. + + The name of the prim is used as the pass's name. + """ +) +{ + uniform bool collection:renderVisibility:includeRoot = 1 + uniform string[] command ( + doc = '''The command to run in order to generate + renders for this pass. The job submission code can use + this to properly send tasks to the job scheduling software + that will generate products. + + The command can contain variables that will be substituted + appropriately during submission, as seen in the example below + with {fileName}. + + For example: + command[0] = "prman" + command[1] = "-progress" + command[2] = "-pixelvariance" + command[3] = "-0.15" + command[4] = "{fileName}" # the fileName property will be substituted + ''' + ) + uniform bool denoise:enable = 0 ( + doc = "When True, this Pass pass should be denoised." + ) + rel denoise:pass ( + doc = """The The UsdRenderDenoisePass prim from which to + source denoise settings. + """ + ) + uniform asset fileName ( + doc = """The asset that contains the rendering prims or other + information needed to render this pass. + """ + ) + rel inputPasses ( + doc = """The set of other Passes that this Pass depends on + in order to be constructed properly. For example, a Pass A + may generate a texture, which is then used as an input to + Pass B. + + By default, usdRender makes some assumptions about the + relationship between this prim and the prims listed in inputPasses. + Namely, when per-frame tasks are generated from these pass prims, + usdRender will assume a one-to-one relationship between tasks + that share their frame number. Consider a pass named 'composite' + whose _inputPasses_ targets a Pass prim named 'beauty`. + By default, each frame for 'composite' will depend on the + same frame from 'beauty': + beauty.1 -> composite.1 + beauty.2 -> composite.2 + etc + + The consumer of this RenderPass graph of inputs will need to resolve + the transitive dependencies. + """ + ) + uniform token passType ( + doc = """A string used to categorize differently structured + or executed types of passes within a customized pipeline. + + For example, when multiple DCC's (e.g. Houdini, Katana, Nuke) + each compute and contribute different Products to a final result, + it may be clearest and most flexible to create a separate + RenderPass for each. + """ + ) + rel renderSource ( + doc = """The source prim to render from. If _fileName_ is not present, + the source is assumed to be a RenderSettings prim present in the current + Usd stage. If fileName is present, the source should be found in the + file there. This relationship might target a string attribute on this + or another prim that identifies the appropriate object in the external + container. + + For example, for a Usd-backed pass, this would point to a RenderSettings + prim. Houdini passes would point to a Rop. Nuke passes would point to + a write node. + """ + ) +} + +class RenderDenoisePass "RenderDenoisePass" ( + doc = """A RenderDenoisePass generates renders via a denoising process. + This may be the same renderer that a pipeline uses for UsdRender, + or may be a separate one. Notably, a RenderDenoisePass requires + another Pass to be present for it to operate. The denoising process + itself is not generative, and requires images inputs to operate. + + As denoising integration varies so widely across pipelines, all + implementation details are left to pipeline-specific prims + that inherit from RenderDenoisePass. + """ +) +{ +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "renderSettingsPrimPath": { + "appliesTo": "layers", + "default": "", + "type": "string" + } + }, + "Types": { + "UsdRenderDenoisePass": { + "alias": { + "UsdSchemaBase": "RenderDenoisePass" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderPass": { + "alias": { + "UsdSchemaBase": "RenderPass" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderProduct": { + "alias": { + "UsdSchemaBase": "RenderProduct" + }, + "autoGenerated": true, + "bases": [ + "UsdRenderSettingsBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderSettings": { + "alias": { + "UsdSchemaBase": "RenderSettings" + }, + "autoGenerated": true, + "bases": [ + "UsdRenderSettingsBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderSettingsBase": { + "alias": { + "UsdSchemaBase": "RenderSettingsBase" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "abstractTyped" + }, + "UsdRenderVar": { + "alias": { + "UsdSchemaBase": "RenderVar" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdRender", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Render schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdRender" + string libraryPath = "pxr/usd/usdRender" + dictionary libraryTokens = { + dictionary renderSettingsPrimPath = { + string doc = """Stage-level metadata that encodes the + path to UsdRenderSettingsPrim to use for rendering.""" + } + dictionary renderVisibility = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent renderVisibility + of a RenderPass prim. + """ + } + } + } +) +{ +} + +class "RenderSettingsBase" ( + inherits = + doc = """Abstract base class that defines render settings that + can be specified on either a RenderSettings prim or a RenderProduct + prim.""" + customData = { + string className = "SettingsBase" + } +) +{ + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) + uniform float pixelAspectRatio = 1.0 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + uniform token aspectRatioConformPolicy = "expandAperture" ( + doc = """Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + """ + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + ) + uniform float4 dataWindowNDC = (0.0, 0.0, 1.0, 1.0) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool instantaneousShutter = false ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform bool disableMotionBlur = false ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool disableDepthOfField = false ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) +} + +class RenderSettings "RenderSettings" ( + inherits = + doc = """A UsdRenderSettings prim specifies global settings for + a render process, including an enumeration of the RenderProducts + that should result, and the UsdGeomImageable purposes that should + be rendered. \\ref UsdRenderHowSettingsAffectRendering""" + customData = { + string className = "Settings" + } +) +{ + rel products ( + doc = """The set of RenderProducts the render should produce. + This relationship should target UsdRenderProduct prims. + If no _products_ are specified, an application should produce + an rgb image according to the RenderSettings configuration, + to a default display or image name.""" + ) + uniform token[] includedPurposes = ["default", "render"] ( + doc = """The list of UsdGeomImageable _purpose_ values that + should be included in the render. Note this cannot be + specified per-RenderProduct because it is a statement of + which geometry is present.""" + ) + uniform token[] materialBindingPurposes = ["full", ""] ( + allowedTokens = ["full", "preview", ""] + doc = """Ordered list of material purposes to consider when + resolving material bindings in the scene. The empty string + indicates the "allPurpose" binding.""" + ) + uniform token renderingColorSpace ( + doc = """Describes a renderer's working (linear) colorSpace where all + the renderer/shader math is expected to happen. When no + renderingColorSpace is provided, renderer should use its own default.""" + ) +} + +class RenderVar "RenderVar" ( + inherits = + doc = """A UsdRenderVar describes a custom data variable for + a render to produce. The prim describes the source of the data, which + can be a shader output or an LPE (Light Path Expression), and also + allows encoding of (generally renderer-specific) parameters that + configure the renderer for computing the variable. + + \\note The name of the RenderVar prim drives the name of the data + variable that the renderer will produce. + + \\note In the future, UsdRender may standardize RenderVar representation + for well-known variables under the sourceType `intrinsic`, + such as _r_, _g_, _b_, _a_, _z_, or _id_. + """ + customData = { + string className = "Var" + } +) { + uniform token dataType = "color3f" ( + doc = """The type of this channel, as a USD attribute type.""" + ) + uniform string sourceName = "" ( + doc = """The renderer should look for an output of this name + as the computed value for the RenderVar.""" + ) + uniform token sourceType = "raw" ( + doc = """Indicates the type of the source. + + - "raw": The name should be passed directly to the + renderer. This is the default behavior. + - "primvar": This source represents the name of a primvar. + Some renderers may use this to ensure that the primvar + is provided; other renderers may require that a suitable + material network be provided, in which case this is simply + an advisory setting. + - "lpe": Specifies a Light Path Expression in the + [OSL Light Path Expressions language](https://github.com/imageworks/OpenShadingLanguage/wiki/OSL-Light-Path-Expressions) as the source for + this RenderVar. Some renderers may use extensions to + that syntax, which will necessarily be non-portable. + - "intrinsic": This setting is currently unimplemented, + but represents a future namespace for UsdRender to provide + portable baseline RenderVars, such as camera depth, that + may have varying implementations for each renderer. + """ + allowedTokens = ["raw", "primvar", "lpe", "intrinsic"] + ) +} + +class RenderProduct "RenderProduct" ( + inherits = + doc = """A UsdRenderProduct describes an image or other + file-like artifact produced by a render. A RenderProduct + combines one or more RenderVars into a file or interactive + buffer. It also provides all the controls established in + UsdRenderSettingsBase as optional overrides to whatever the + owning UsdRenderSettings prim dictates. + + Specific renderers may support additional settings, such + as a way to configure compression settings, filetype metadata, + and so forth. Such settings can be encoded using + renderer-specific API schemas applied to the product prim. + """ + customData = { + string className = "Product" + dictionary schemaTokens = { + dictionary raster = { + string doc = """RenderProduct productType value that + indicates a 2D raster image of pixels.""" + } + } + } +) { + uniform token productType = "raster" ( + doc = """The type of output to produce. + The default, "raster", indicates a 2D image. + + \\note In the future, UsdRender may define additional product + types.""" + ) + token productName = "" ( + doc = """Specifies the name that the output/display driver + should give the product. This is provided as-authored to the + driver, whose responsibility it is to situate the product on a + filesystem or other storage, in the desired location.""" + ) + rel orderedVars ( + doc = """Specifies the RenderVars that should be consumed and + combined into the final product. If ordering is relevant to the + output driver, then the ordering of targets in this relationship + provides the order to use.""" + ) +} + + +class RenderPass "RenderPass" ( + inherits = + doc = """A RenderPass prim encapsulates the necessary information + to generate multipass renders. It houses properties for generating + dependencies and the necessary commands to run to generate renders, as + well as visibility controls for the scene. While RenderSettings + describes the information needed to generate images from a single + invocation of a renderer, RenderPass describes the additional information + needed to generate a time varying set of images. + + There are two consumers of RenderPass prims - a runtime executable that + generates images from usdRender prims, and pipeline specific code that + translates between usdRender prims and the pipeline's resource scheduling + software. We'll refer to the latter as 'job submission code'. + + \\anchor usdRender_renderVisibility + The objects that are relevant to the render is specified via the + renderVisibility collection (UsdCollectionAPI) and can be accessed via + GetRenderVisibilityCollectionAPI(). This collection has includeRoot set to + true so that all objects participate in the render by default. To render + only a specific set of objects, there are two options. One is to modify the + collection paths to explicitly exclude objects that don't participate in + the render, assuming it is known; the other option is to set includeRoot to + false and explicitly include the desired objects. These are complementary + approaches that may each be preferable depending on the scenario. + + The name of the prim is used as the pass's name. + """ + customData = { + string className = "Pass" + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" """ + } + prepend apiSchemas = ["CollectionAPI:renderVisibility"] +) { + uniform token passType ( + doc = """A string used to categorize differently structured + or executed types of passes within a customized pipeline. + + For example, when multiple DCC's (e.g. Houdini, Katana, Nuke) + each compute and contribute different Products to a final result, + it may be clearest and most flexible to create a separate + RenderPass for each. + """ + ) + + uniform string[] command ( + doc = """The command to run in order to generate + renders for this pass. The job submission code can use + this to properly send tasks to the job scheduling software + that will generate products. + + The command can contain variables that will be substituted + appropriately during submission, as seen in the example below + with {fileName}. + + For example: + command[0] = "prman" + command[1] = "-progress" + command[2] = "-pixelvariance" + command[3] = "-0.15" + command[4] = "{fileName}" # the fileName property will be substituted + """ + ) + + rel renderSource ( + doc = """The source prim to render from. If _fileName_ is not present, + the source is assumed to be a RenderSettings prim present in the current + Usd stage. If fileName is present, the source should be found in the + file there. This relationship might target a string attribute on this + or another prim that identifies the appropriate object in the external + container. + + For example, for a Usd-backed pass, this would point to a RenderSettings + prim. Houdini passes would point to a Rop. Nuke passes would point to + a write node. + """ + ) + + rel inputPasses ( + doc = """The set of other Passes that this Pass depends on + in order to be constructed properly. For example, a Pass A + may generate a texture, which is then used as an input to + Pass B. + + By default, usdRender makes some assumptions about the + relationship between this prim and the prims listed in inputPasses. + Namely, when per-frame tasks are generated from these pass prims, + usdRender will assume a one-to-one relationship between tasks + that share their frame number. Consider a pass named 'composite' + whose _inputPasses_ targets a Pass prim named 'beauty`. + By default, each frame for 'composite' will depend on the + same frame from 'beauty': + beauty.1 -> composite.1 + beauty.2 -> composite.2 + etc + + The consumer of this RenderPass graph of inputs will need to resolve + the transitive dependencies. + """ + ) + + uniform asset fileName ( + doc = """The asset that contains the rendering prims or other + information needed to render this pass. + """ + ) + + uniform bool denoise:enable = false ( + doc = """When True, this Pass pass should be denoised.""" + ) + + rel denoise:pass ( + doc = """The The UsdRenderDenoisePass prim from which to + source denoise settings. + """ + ) + + uniform bool collection:renderVisibility:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) +} + + +class RenderDenoisePass "RenderDenoisePass" ( + inherits = + doc = """A RenderDenoisePass generates renders via a denoising process. + This may be the same renderer that a pipeline uses for UsdRender, + or may be a separate one. Notably, a RenderDenoisePass requires + another Pass to be present for it to operate. The denoising process + itself is not generative, and requires images inputs to operate. + + As denoising integration varies so widely across pipelines, all + implementation details are left to pipeline-specific prims + that inherit from RenderDenoisePass. + """ + customData = { + string className = "DenoisePass" + } +) { +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class NodeGraph "NodeGraph" ( + doc = '''A node-graph is a container for shading nodes, as well as other + node-graphs. It has a public input interface and provides a list of public + outputs. + + Node Graph Interfaces + + One of the most important functions of a node-graph is to host the "interface" + with which clients of already-built shading networks will interact. Please + see "Interface Inputs" for a detailed + explanation of what the interface provides, and how to construct and + use it, to effectively share/instance shader networks. + + Node Graph Outputs + + These behave like outputs on a shader and are typically connected to an + output on a shader inside the node-graph. + ''' +) +{ +} + +class Material "Material" ( + doc = """A Material provides a container into which multiple \"render contexts\" + can add data that defines a \"shading material\" for a renderer. Typically + this consists of one or more UsdShadeOutput properties connected to outputs + of nested Shader prims - though a context/client is free to add + any data that is suitable. We strongly advise that all contexts + adopt the convention that all properties be prefixed with a namespace + that identifies the context e.g. \"token outputs:ri:surface.connect = + resolved Material that will be used to shade the gprim (exceptions, + of course, for gprims that possess UsdGeomSubsets, as each subset can be + shaded by a different Material). A gprim and each of its ancestor + prims can possess, through the MaterialBindingAPI, both a + direct binding to a Material, and any number of + collection-based bindings to Materials; each binding can be generic + or declared for a particular purpose, and given a specific binding + strength. It is the process of \"material resolution\" (see + that examines all of + these bindings, and selects the one Material that best matches the + client's needs. + + The intent of purpose is that each gprim should be able to resolve a + Material for any given purpose, which implies it can have differently bound + materials for different purposes. There are two special values of + purpose defined in UsdShade, although the API fully supports + specifying arbitrary values for it, for the sake of extensibility: +
  • UsdShadeTokens->full: to be used when the purpose of the + render is entirely to visualize the truest representation of a scene, + considering all lighting and material information, at highest fidelity.
  • +
  • UsdShadeTokens->preview: to be used when the render is in + service of a goal other than a high fidelity \"full\" render (such as scene + manipulation, modeling, or realtime playback). Latency and speed are + generally of greater concern for preview renders, therefore preview + materials are generally designed to be \"lighterweight\" compared to full + materials.
+ A binding can also have no specific purpose at all, in which + case, it is considered to be the fallback or all-purpose binding (denoted + by the empty-valued token UsdShadeTokens->allPurpose). + + The purpose of a material binding is encoded in the name of the + binding relationship. +
  • + In the case of a direct binding, the allPurpose binding is + represented by the relationship named material:binding. + Special-purpose direct bindings are represented by relationships named + material:binding:purpose. A direct binding relationship + must have a single target path that points to a UsdShadeMaterial.
  • +
  • + In the case of a collection-based binding, the allPurpose binding is + represented by a relationship named + material:binding:collection:bindingName, where + bindingName establishes an identity for the binding that is unique + on the prim. Attempting to establish two collection bindings of the same + name on the same prim will result in the first binding simply being + overridden. A special-purpose collection-based binding is represented by a + relationship named material:binding:collection:purpose:bindingName. + A collection-based binding relationship must have exacly two targets, one of + which should be a collection-path (see + and the other should point to a + UsdShadeMaterial. In the future, we may allow a single collection + binding to target multiple collections, if we can establish a reasonable + round-tripping pattern for applications that only allow a single collection + to be associated with each Material. +
  • +
+ + Note: Both bindingName and purpose must be + non-namespaced tokens. This allows us to know the role of a binding + relationship simply from the number of tokens in it. +
  • Two tokens: the fallback, \"all purpose\", direct binding, + material:binding
  • +
  • Three tokens: a purpose-restricted, direct, fallback binding, + e.g. material:binding:preview
  • +
  • Four tokens: an all-purpose, collection-based binding, e.g. + material:binding:collection:metalBits
  • +
  • Five tokens: a purpose-restricted, collection-based binding, + e.g. material:binding:collection:full:metalBits
  • +
+ + A binding-strength value is used to specify whether a binding + authored on a prim should be weaker or stronger than bindings that appear + lower in namespace. We encode the binding strength with as token-valued + metadata 'bindMaterialAs' for future flexibility, even though for + now, there are only two possible values: + UsdShadeTokens->weakerThanDescendants and + UsdShadeTokens->strongerThanDescendants. When binding-strength is + not authored (i.e. empty) on a binding-relationship, the default behavior + matches UsdShadeTokens->weakerThanDescendants. + + \\note If a material binding relationship is a built-in property defined as + part of a typed prim's schema, a fallback value should not be provided for + it. This is because the \"material resolution\" algorithm only conisders + authored properties. + """ +) +{ +} + +class "CoordSysAPI" ( + doc = '''UsdShadeCoordSysAPI provides a way to designate, name, + and discover coordinate systems. + + Coordinate systems are implicitly established by UsdGeomXformable + prims, using their local space. That coordinate system may be + bound (i.e., named) from another prim. The binding is encoded + as a single-target relationship. + Coordinate system bindings apply to descendants of the prim + where the binding is expressed, but names may be re-bound by + descendant prims. + + CoordSysAPI is a multi-apply API schema, where instance names + signify the named coordinate systems. The instance names are + used with the "coordSys:" namespace to determine the binding + to the UsdGeomXformable prim. + + Named coordinate systems are useful in shading (and other) workflows. + An example is projection paint, which projects a texture + from a certain view (the paint coordinate system), encoded as + (e.g.) "rel coordSys:paint:binding". Using the paint coordinate frame + avoids the need to assign a UV set to the object, and can be a + concise way to project paint across a collection of objects with + a single shared paint coordinate system. + ''' +) +{ + rel coordSys:__INSTANCE_NAME__:binding ( + displayName = "Bound Coordinate System" + doc = "Prim binding expressing the appropriate coordinate systems." + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "bindMaterialAs": { + "appliesTo": [ + "relationships" + ], + "displayGroup": "Shading", + "documentation": "Metadata authored on collection-based material binding relationship to indicate the strength of the binding relative to bindings authored on descendant prims.", + "type": "token" + }, + "connectability": { + "appliesTo": [ + "attributes" + ], + "default": "full", + "displayGroup": "Shading", + "documentation": "Metadata authored on UsdShadeInput's to specify what they can be connected to. Can be either \"full\" or \"interfaceOnly\". \"full\" implies that the input can be connected to any other input or output. \"interfaceOnly\" implies that the input can only connect to a NodeGraph Input (which represents an interface override, not a render-time dataflow connection), or another Input whose connectability is also \"interfaceOnly\".", + "type": "token" + }, + "outputName": { + "appliesTo": [ + "relationships" + ], + "displayGroup": "deprecated", + "type": "token" + }, + "renderType": { + "appliesTo": [ + "properties" + ], + "displayGroup": "Rendering", + "type": "token" + }, + "sdrMetadata": { + "appliesTo": [ + "prims", + "attributes" + ], + "displayGroup": "Shading", + "type": "dictionary" + } + }, + "Types": { + "UsdShadeConnectableAPI": { + "alias": { + "UsdSchemaBase": "ConnectableAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdShadeCoordSysAPI": { + "alias": { + "UsdSchemaBase": "CoordSysAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "multipleApplyAPI" + }, + "UsdShadeMaterial": { + "alias": { + "UsdSchemaBase": "Material" + }, + "autoGenerated": true, + "bases": [ + "UsdShadeNodeGraph" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeMaterialBindingAPI": { + "alias": { + "UsdSchemaBase": "MaterialBindingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdShadeNodeDefAPI": { + "alias": { + "UsdSchemaBase": "NodeDefAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdShadeNodeGraph": { + "alias": { + "UsdSchemaBase": "NodeGraph" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeShader": { + "alias": { + "UsdSchemaBase": "Shader" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeShaderDefParserPlugin": { + "bases": [ + "NdrParserPlugin" + ], + "displayName": "USD-based shader definition parser plugin" + } + } + }, + "LibraryPath": "", + "Name": "usdShade", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Shader schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdShade" + string libraryPath = "pxr/usd/usdShade" + dictionary libraryTokens = { + dictionary materialBind = { + string doc = """The name of the GeomSubset family used to + identify face subsets defined for the purpose of binding + materials to facesets. + """ + } + dictionary full = { + string doc= """Possible value for 'connectability' metadata on + a UsdShadeInput. When connectability of an input is set to + "full", it implies that it can be connected to any input or + output. + """ + } + dictionary interfaceOnly = { + string doc= """Possible value for 'connectability' metadata on + a UsdShadeInput. It implies that the input can only connect to + a NodeGraph Input (which represents an interface override, not + a render-time dataflow connection), or another Input whose + connectability is also 'interfaceOnly'. + """ + } + dictionary outputs = { + string value = "outputs:" + string doc = """The prefix on shading attributes + denoting an output. + """ + } + dictionary inputs = { + string value = "inputs:" + string doc = """The prefix on shading attributes + denoting an input. + """ + } + } + } +) +{ +} + +class NodeGraph "NodeGraph" ( + inherits = + doc = """A node-graph is a container for shading nodes, as well as other + node-graphs. It has a public input interface and provides a list of public + outputs. + + Node Graph Interfaces + + One of the most important functions of a node-graph is to host the "interface" + with which clients of already-built shading networks will interact. Please + see \\ref UsdShadeNodeGraph_Interfaces "Interface Inputs" for a detailed + explanation of what the interface provides, and how to construct and + use it, to effectively share/instance shader networks. + + Node Graph Outputs + + These behave like outputs on a shader and are typically connected to an + output on a shader inside the node-graph. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = ''' +#include +#include "pxr/usd/usd/editTarget.h" +#include "pxr/usd/usd/relationship.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/shader.h" +#include "pxr/usd/usdShade/connectableAPIBehavior.h"''' + } +) { + +} + + +class Material "Material" ( + inherits = + doc = """A Material provides a container into which multiple "render contexts" + can add data that defines a "shading material" for a renderer. Typically + this consists of one or more UsdShadeOutput properties connected to outputs + of nested Shader prims - though a context/client is free to add + any data that is suitable. We strongly advise that all contexts + adopt the convention that all properties be prefixed with a namespace + that identifies the context e.g. "token outputs:ri:surface.connect = + surface output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the surface of a + UsdShadeMaterial. + """ + } + dictionary displacement = { + string doc = """Describes the displacement output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the displacement of a + UsdShadeMaterial. + """ + } + dictionary volume = { + string doc = """Describes the volume output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the volume of a + UsdShadeMaterial. + """ + } + dictionary universalRenderContext = { + string value = "" + string doc = """Possible value for the "renderContext" parameter + in \\ref UsdShadeMaterial_Outputs API. Represents the universal + renderContext. An output with a universal renderContext is + applicable to all possible rendering contexts. + """ + } + } + } +) +{ + token outputs:surface ( + doc = """Represents the universal "surface" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "surface" + } + ) + token outputs:displacement ( + doc = """Represents the universal "displacement" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "displacement" + } + ) + token outputs:volume ( + doc = """Represents the universal "volume" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "volume" + } + ) +} + +class Shader "Shader" ( + inherits = + prepend apiSchemas = ["NodeDefAPI"] + doc = """Base class for all USD shaders. Shaders are the building blocks + of shading networks. While UsdShadeShader objects are not target specific, + each renderer or application target may derive its own renderer-specific + shader object types from this base, if needed. + + Objects of this class generally represent a single shading object, whether + it exists in the target renderer or not. For example, a texture, a fractal, + or a mix node. + + The UsdShadeNodeDefAPI provides attributes to uniquely identify the + type of this node. The id resolution into a renderable shader target + type of this node. The id resolution into a renderable shader target + is deferred to the consuming application. + + The purpose of representing them in Usd is two-fold: + \\li To represent, via "connections" the topology of the shading network + that must be reconstructed in the renderer. Facilities for authoring and + manipulating connections are encapsulated in the API schema + UsdShadeConnectableAPI. + \\li To present a (partial or full) interface of typed input parameters + whose values can be set and overridden in Usd, to be provided later at + render-time as parameter values to the actual render shader objects. Shader + input parameters are encapsulated in the property schema UsdShadeInput. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = ''' +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/tokens.h" +#include "pxr/usd/ndr/declare.h" +#include "pxr/usd/sdr/shaderNode.h"''' + } +) { +} + +class "NodeDefAPI" +( + inherits = + doc = """UsdShadeNodeDefAPI is an API schema that provides attributes + for a prim to select a corresponding Shader Node Definition ("Sdr Node"), + as well as to look up a runtime entry for that shader node in the + form of an SdrShaderNode. + + UsdShadeNodeDefAPI is intended to be a pre-applied API schema for any + prim type that wants to refer to the SdrRegistry for further implementation + details about the behavior of that prim. The primary use in UsdShade + itself is as UsdShadeShader, which is a basis for material shading networks + (UsdShadeMaterial), but this is intended to be used in other domains + that also use the Sdr node mechanism. + + This schema provides properties that allow a prim to identify an external + node definition, either by a direct identifier key into the SdrRegistry + (info:id), an asset to be parsed by a suitable NdrParserPlugin + (info:sourceAsset), or an inline source code that must also be parsed + (info:sourceCode); as well as a selector attribute to determine which + specifier is active (info:implementationSource). + """ + customData = { + token apiSchemaType = "singleApply" + string extraIncludes = """ +#include "pxr/usd/ndr/declare.h" +#include "pxr/usd/sdr/shaderNode.h" + """ + dictionary schemaTokens = { + dictionary universalSourceType = { + string value = "" + string doc = """Possible value for the "sourceType" parameter + in \\ref UsdShadeNodeDefAPI_ImplementationSource API. Represents + the universal or fallback source type. + """ + } + dictionary sdrMetadata = { + string doc = """Dictionary valued metadata key authored on + Shader prims with implementationSource value of sourceAsset or + sourceCode to pass along metadata to the shader parser or + compiler. It is also used to author metadata on shader + properties in a UsdShade-based shader definition file. + """ + } + dictionary subIdentifier = { + string doc = """This identifier is used in conjunction with a + specific source asset to indicate a particular definition within + the source asset, if the source asset specifies more than one + shader node definition. + """ + } + } + } +) +{ + uniform token info:implementationSource = "id" ( + allowedTokens = ["id", "sourceAsset", "sourceCode"] + doc = """Specifies the attribute that should be consulted to get the + shader's implementation or its source code. + + * If set to "id", the "info:id" attribute's value is used to + determine the shader source from the shader registry. + * If set to "sourceAsset", the resolved value of the "info:sourceAsset" + attribute corresponding to the desired implementation (or source-type) + is used to locate the shader source. A source asset file may also + specify multiple shader definitions, so there is an optional attribute + "info:sourceAsset:subIdentifier" whose value should be used to indicate + a particular shader definition from a source asset file. + * If set to "sourceCode", the value of "info:sourceCode" attribute + corresponding to the desired implementation (or source type) is used as + the shader source. + """ + customData = { + string apiName = "implementationSource" + } + ) + + uniform token info:id ( + doc = """The id is an identifier for the type or purpose of the + shader. E.g.: Texture or FractalFloat. + The use of this id will depend on the render context: some will turn it + into an actual shader path, some will use it to generate shader source + code dynamically. + + \\sa SetShaderId() + """ + customData = { + string apiName = "id" + } + ) +} + +class "ConnectableAPI" +( + inherits = + doc = """UsdShadeConnectableAPI is an API schema that provides a common + interface for creating outputs and making connections between shading + parameters and outputs. The interface is common to all UsdShade schemas + that support Inputs and Outputs, which currently includes UsdShadeShader, + UsdShadeNodeGraph, and UsdShadeMaterial . + + One can construct a UsdShadeConnectableAPI directly from a UsdPrim, or + from objects of any of the schema classes listed above. If it seems + onerous to need to construct a secondary schema object to interact with + Inputs and Outputs, keep in mind that any function whose purpose is either + to walk material/shader networks via their connections, or to create such + networks, can typically be written entirely in terms of + UsdShadeConnectableAPI objects, without needing to care what the underlying + prim type is. + + Additionally, the most common UsdShadeConnectableAPI behaviors + (creating Inputs and Outputs, and making connections) are wrapped as + convenience methods on the prim schema classes (creation) and + UsdShadeInput and UsdShadeOutput. + """ + customData = { + token apiSchemaType = "nonApplied" + string extraIncludes = ''' +#include "pxr/usd/usd/typed.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/tokens.h" +#include "pxr/usd/usdShade/types.h"''' + } +) +{ +} + +class "MaterialBindingAPI" +( + inherits = + doc = """UsdShadeMaterialBindingAPI is an API schema that provides an + interface for binding materials to prims or collections of prims + (represented by UsdCollectionAPI objects). + + In the USD shading model, each renderable gprim computes a single + resolved Material that will be used to shade the gprim (exceptions, + of course, for gprims that possess UsdGeomSubsets, as each subset can be + shaded by a different Material). A gprim and each of its ancestor + prims can possess, through the MaterialBindingAPI, both a + direct binding to a Material, and any number of + collection-based bindings to Materials; each binding can be generic + or declared for a particular purpose, and given a specific binding + strength. It is the process of "material resolution" (see + \\ref UsdShadeMaterialBindingAPI_MaterialResolution) that examines all of + these bindings, and selects the one Material that best matches the + client's needs. + + The intent of purpose is that each gprim should be able to resolve a + Material for any given purpose, which implies it can have differently bound + materials for different purposes. There are two special values of + purpose defined in UsdShade, although the API fully supports + specifying arbitrary values for it, for the sake of extensibility: +
  • UsdShadeTokens->full: to be used when the purpose of the + render is entirely to visualize the truest representation of a scene, + considering all lighting and material information, at highest fidelity.
  • +
  • UsdShadeTokens->preview: to be used when the render is in + service of a goal other than a high fidelity "full" render (such as scene + manipulation, modeling, or realtime playback). Latency and speed are + generally of greater concern for preview renders, therefore preview + materials are generally designed to be "lighterweight" compared to full + materials.
+ A binding can also have no specific purpose at all, in which + case, it is considered to be the fallback or all-purpose binding (denoted + by the empty-valued token UsdShadeTokens->allPurpose). + + The purpose of a material binding is encoded in the name of the + binding relationship. +
  • + In the case of a direct binding, the allPurpose binding is + represented by the relationship named material:binding. + Special-purpose direct bindings are represented by relationships named + material:binding:purpose. A direct binding relationship + must have a single target path that points to a UsdShadeMaterial.
  • +
  • + In the case of a collection-based binding, the allPurpose binding is + represented by a relationship named + material:binding:collection:bindingName, where + bindingName establishes an identity for the binding that is unique + on the prim. Attempting to establish two collection bindings of the same + name on the same prim will result in the first binding simply being + overridden. A special-purpose collection-based binding is represented by a + relationship named material:binding:collection:purpose:bindingName. + A collection-based binding relationship must have exacly two targets, one of + which should be a collection-path (see + \ref UsdCollectionAPI::GetCollectionPath()) and the other should point to a + UsdShadeMaterial. In the future, we may allow a single collection + binding to target multiple collections, if we can establish a reasonable + round-tripping pattern for applications that only allow a single collection + to be associated with each Material. +
  • +
+ + Note: Both bindingName and purpose must be + non-namespaced tokens. This allows us to know the role of a binding + relationship simply from the number of tokens in it. +
  • Two tokens: the fallback, "all purpose", direct binding, + material:binding
  • +
  • Three tokens: a purpose-restricted, direct, fallback binding, + e.g. material:binding:preview
  • +
  • Four tokens: an all-purpose, collection-based binding, e.g. + material:binding:collection:metalBits
  • +
  • Five tokens: a purpose-restricted, collection-based binding, + e.g. material:binding:collection:full:metalBits
  • +
+ + A binding-strength value is used to specify whether a binding + authored on a prim should be weaker or stronger than bindings that appear + lower in namespace. We encode the binding strength with as token-valued + metadata 'bindMaterialAs' for future flexibility, even though for + now, there are only two possible values: + UsdShadeTokens->weakerThanDescendants and + UsdShadeTokens->strongerThanDescendants. When binding-strength is + not authored (i.e. empty) on a binding-relationship, the default behavior + matches UsdShadeTokens->weakerThanDescendants. + + \\note If a material binding relationship is a built-in property defined as + part of a typed prim's schema, a fallback value should not be provided for + it. This is because the "material resolution" algorithm only conisders + authored properties. + """ + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdGeom/subset.h" +#include "pxr/usd/usdShade/material.h" +#include """ + dictionary schemaTokens = { + dictionary materialBinding = { + string value = "material:binding" + string doc = """ + The relationship name on non-shading prims to + denote a binding to a UsdShadeMaterial. + """ + } + dictionary materialBindingCollection = { + string value = "material:binding:collection" + string doc = """ + The relationship name on non-shading prims to + denote a collection-based binding to a UsdShadeMaterial. + """ + } + dictionary allPurpose = { + string value = "" + string doc = """Possible value for the 'materialPurpose' parameter + in the various methods available in UsdShadeMaterialBindingAPI. + Its value is empty and its purpose is to represent a general + purpose material-binding that applies in the absence of a + specific-purpose binding. + """ + } + dictionary preview = { + string doc = """Possible value for the 'materialPurpose' + parameter in UsdShadeMaterialBindingAPI, to be used when the + render is in service of a goal other than a high fidelity "full" + render (such as scene manipulation, modeling, or realtime + playback). Latency and speed are generally of greater concern + for preview renders, therefore preview materials are generally + designed to be "lighterweight" compared to full materials. + """ + } + + dictionary full = { + string doc= """Possible value for the 'materialPurpose' + parameter in UsdShadeMaterialBindingAPI, to be used when the + purpose of the render is entirely about visualizing the truest + representation of a scene, considering all lighting and material + information, at highest fidelity. + """ + } + dictionary bindMaterialAs = { + string doc = """Token valued metadata key authored on a material + binding relationship to indicate the strength of the binding + relative to bindings authored on descendants. + """ + } + dictionary weakerThanDescendants = { + string doc = """Possible value for 'bindMaterialAs' metadata on the + collection-based material binding relationship. Indicates + that the binding represented by the relationship is weaker than + any bindings authored on the descendants.""" + } + dictionary strongerThanDescendants = { + string doc = """Possible value for 'bindMaterialAs' metadata on the + collection-based material binding relationship. Indicates + that the binding represented by the relationship is stronger than + any bindings authored on the descendants.""" + } + dictionary fallbackStrength = { + string doc = """Sentinal value to be used for 'bindMaterialAs' + metadata's default value. Clients should pass this in for the + 'bindingStrength' argument to UsdShadeMaterialBindingAPI::Bind(), + if they want to author the default value (weakerThanDescendants) + sparsely. The value "fallbackStrength" never gets authored + into scene description.""" + } + } + } +) +{ + +} + +class "CoordSysAPI" +( + inherits = + doc = """UsdShadeCoordSysAPI provides a way to designate, name, + and discover coordinate systems. + + Coordinate systems are implicitly established by UsdGeomXformable + prims, using their local space. That coordinate system may be + bound (i.e., named) from another prim. The binding is encoded + as a single-target relationship. + Coordinate system bindings apply to descendants of the prim + where the binding is expressed, but names may be re-bound by + descendant prims. + + CoordSysAPI is a multi-apply API schema, where instance names + signify the named coordinate systems. The instance names are + used with the "coordSys:" namespace to determine the binding + to the UsdGeomXformable prim. + + Named coordinate systems are useful in shading (and other) workflows. + An example is projection paint, which projects a texture + from a certain view (the paint coordinate system), encoded as + (e.g.) "rel coordSys:paint:binding". Using the paint coordinate frame + avoids the need to assign a UV set to the object, and can be a + concise way to project paint across a collection of objects with + a single shared paint coordinate system. + """ + customData = { + token apiSchemaType = "multipleApply" + token propertyNamespacePrefix = "coordSys" + string extraIncludes = ''' +#include "pxr/usd/usdGeom/xformable.h"''' + } +) +{ + rel binding ( + displayName = "Bound Coordinate System" + doc = "Prim binding expressing the appropriate coordinate systems." + ) +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdShadersDiscoveryPlugin" : { + "bases": ["NdrDiscoveryPlugin"], + "displayName": "USD-based shader definition discovery plugin." + } + }, + # Allow usdShaders/shaders to be accessible by hio/glslfx.cpp's + # ShaderResourceRegistry + "ShaderResources": "shaders" + }, + "LibraryPath": "", + "Name": "usdShaders", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +#import $TOOLS/hdSt/shaders/surfaceHelpers.glslfx + +-- configuration +{ + "techniques": { + "default": { + "displacementShader": { + "source": [ "Preview.Displacement" ] + }, + "surfaceShader": { + "source": [ "Preview.LightStructures", + "SurfaceHelpers.Lighting", + "Preview.Lighting", + "Preview.LightIntegration", + "SurfaceHelpers.TangentSpace", + "Preview.NormalMapping", + "Preview.Surface" ] + } + } + } +} + + +-- glsl Preview.Displacement + +vec4 +displacementShader(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) +{ + // Calculate scalar displacement. + float texDisplacement = HdGetScalar_displacement(index); + return Peye + vec4(Neye*texDisplacement, 0); +} + + +-- glsl Preview.Surface + +vec4 +surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + float clearcoatAmount = HdGetScalar_clearcoat(); + float clearcoatRoughness = HdGetScalar_clearcoatRoughness(); + vec3 diffuseColor = HdGet_diffuseColor().xyz; + vec3 emissiveColor = HdGet_emissiveColor().xyz; + float ior = HdGetScalar_ior(); + float metallic = HdGetScalar_metallic(); + float occlusion = HdGetScalar_occlusion(); + float opacity = HdGetScalar_opacity(); + float opacityThreshold = HdGetScalar_opacityThreshold(); + float roughness = HdGetScalar_roughness(); + vec3 specularColor = HdGet_specularColor().xyz; + bool useSpecularWorkflow = (HdGetScalar_useSpecularWorkflow() == 1); + + vec3 clearcoatColor = vec3(1.0); + float specularAmount = 1.0; + +#ifdef HD_MATERIAL_TAG_MASKED + if (opacity < opacityThreshold) { + discard; + return vec4(1.0); + } + opacity = 1.0; +#endif + + // Selection highlighting. + vec4 colorAndOpacity = vec4(diffuseColor, opacity); + diffuseColor = ApplyColorOverrides(colorAndOpacity).rgb; + + // Pre-multiply diffuse color by opacity if not done so already +#ifndef diffuseColor_IS_PREMULTIPLIED + diffuseColor *= opacity; +#endif + + // Evaluate all lights. + vec3 c = evaluateLights( + emissiveColor, + diffuseColor, + useSpecularWorkflow, + ior, + metallic, + specularAmount, + specularColor, + roughness, + clearcoatAmount, + clearcoatColor, + clearcoatRoughness, + occlusion, + Peye, + perturbFragmentNormal(Peye.xyz, Neye)); + + return vec4(c, colorAndOpacity.a); +} + + +-- glsl Preview.LightStructures + +struct LightingContributions +{ + vec3 diffuse; + vec3 specular; +}; + + +-- glsl Preview.Lighting + +#define EPSILON 0.001 + + +float +SchlickFresnel(float EdotH) +{ + return pow(max(0.0, 1.0 - EdotH), 5.0); +} + +float +NormalDistribution(float specularRoughness, float NdotH) +{ + float alpha = specularRoughness * specularRoughness; + float alpha2 = alpha * alpha; + float NdotH2 = NdotH * NdotH; + float DDenom = (NdotH2 * (alpha2 - 1.0)) + 1.0; + DDenom *= DDenom; + DDenom *= PI; + float D = (alpha2 + EPSILON) / DDenom; + return D; +} + +float +Geometric( + float specularRoughness, + float NdotL, + float NdotE, + float NdotH, + float EdotH) +{ + float alpha = specularRoughness * specularRoughness; + float k = alpha * 0.5; + float G = NdotE / (NdotE * (1.0 - k) + k); + G *= NdotL / (NdotL * (1.0 - k) + k); + return G; +} + +vec3 +evaluateDirectDiffuse() +{ + return vec3(1.0 / PI); +} + +vec3 +evaluateDirectSpecular( + vec3 specularColorF0, + vec3 specularColorF90, + float specularRoughness, + float fresnel, + float NdotL, + float NdotE, + float NdotH, + float EdotH) +{ + vec3 F = mix(specularColorF0, specularColorF90, fresnel); + float D = NormalDistribution(specularRoughness, NdotH); + float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH); + vec3 RNum = F * G * D; + float RDenom = 4.0f * NdotL * NdotE + EPSILON; + return RNum / RDenom; +} + +LightingContributions +evaluateLight( + vec3 diffuseColor, + bool useSpecularWorkflow, + float ior, + float metallic, + float specularAmount, + vec3 specularColor, + float specularRoughness, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + float occlusion, + float NdotL, + float NdotE, + float NdotH, + float EdotH, + vec3 lightDiffuseIrradiance, + vec3 lightSpecularIrradiance) +{ + specularRoughness = max(0.001, specularRoughness); + clearcoatRoughness = max(0.001, clearcoatRoughness); + + float fresnel = SchlickFresnel(EdotH); + + // Evaluate diffuse + vec3 d = diffuseColor * evaluateDirectDiffuse(); + + // Evaluate specular first lobe + vec3 s1 = vec3(0.0); + const float R = (1.0 - ior) / (1.0 + ior); + if (specularAmount > 0.0) { + vec3 F0 = specularColor; + vec3 F90 = vec3(1.0); + + if (!useSpecularWorkflow) { + vec3 specColor = mix(vec3(1.0), diffuseColor, metallic); + F0 = mix(R * R * specColor, specColor, metallic); + F90 = specColor; + + // For metallic workflows, pure metals have no diffuse + d *= 1.0 - metallic; + } + + s1 = specularAmount * evaluateDirectSpecular( + F0, // Specular color 0 + F90, // Specular color 90 + specularRoughness, // Roughness + fresnel, // Fresnel + NdotL, NdotE, NdotH, EdotH); // Dot products needed for lights + + // Adjust the diffuse so glazing angles have less diffuse + d *= (1.0 - mix(F0, F90, fresnel)); + } + + // Evaluate clearcoat + vec3 s2 = vec3(0.0); + if (clearcoatAmount > 0.0) { + s2 = clearcoatAmount * evaluateDirectSpecular( + R * R * clearcoatColor, // Clearcoat color 0 + clearcoatColor, // Clearcoat color 90 + clearcoatRoughness, // Roughness + fresnel, // Fresnel + NdotL, NdotE, NdotH, EdotH); // Dot products needed for lights + } + + LightingContributions lightingContrib; + + lightingContrib.diffuse = + occlusion * NdotL * d * lightDiffuseIrradiance; + + lightingContrib.specular = + occlusion * NdotL * (s1 + s2) * lightSpecularIrradiance; + + return lightingContrib; +} + + +-- glsl Preview.LightIntegration + +mat4 GetDomeLightTransform(mat4 worldToLightTransform) +{ + // transform from view space to light space + mat4 worldToViewInverse = GetWorldToViewInverseMatrix(); + return worldToLightTransform * worldToViewInverse; +} + +LightingContributions +evaluateIndirectLighting( + vec3 diffuseColor, + vec3 specularColor, + vec3 Neye, + vec3 Reye, + float NdotE, + float EdotH, + float ior, + float metallic, + float occlusion, + float roughness, + bool useSpecularWorkflow, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + mat4 worldToLightTransform) +{ + LightingContributions indirect; + indirect.diffuse = vec3(0.0); + indirect.specular = vec3(0.0); + +#ifdef HD_HAS_domeLightIrradiance + vec3 F0 = specularColor; + vec3 F90 = vec3(1.0); + vec3 d = diffuseColor; + const float R = (1.0 - ior) / (1.0 + ior); + if (!useSpecularWorkflow) { + vec3 specColor = mix(vec3(1.0), diffuseColor, metallic); + F0 = mix(R * R * specColor, specColor, metallic); + F90 = specColor; + + // For metallic workflows, pure metals have no diffuse + d *= 1.0 - metallic; + } + // Adjust the diffuse so glazing angles have less diffuse + float fresnel = SchlickFresnel(EdotH); + vec3 F = mix(F0, F90, fresnel); + d *= (1.0 - F); + + mat4 transformationMatrix = GetDomeLightTransform(worldToLightTransform); + + // Diffuse Component + vec3 dir = normalize((transformationMatrix * vec4(Neye,0.0)).xyz); + vec2 coord = ProjectToLatLong(dir); + vec3 diffuse = HdGet_domeLightIrradiance(coord).rgb; + + // Specular Component + const float MAX_REFLECTION_LOD = + textureQueryLevels(HdGetSampler_domeLightPrefilter()); + float lod = roughness * MAX_REFLECTION_LOD; + vec3 Rdir = normalize((transformationMatrix * vec4(Reye,0.0)).xyz); + vec2 Rcoord = ProjectToLatLong(Rdir); + vec3 prefilter = HdTextureLod_domeLightPrefilter(Rcoord, lod).rgb; + + vec2 brdf = HdGet_domeLightBRDF(vec2(NdotE, roughness)).rg; + + vec3 specular = prefilter * (F * brdf.x + brdf.y); + + // Clearcoat Component + vec3 clearcoat = vec3(0.0); + if (clearcoatAmount > 0.0) { + const vec3 clearcoatF = clearcoatAmount * mix( + R * R * clearcoatColor, // Clearcoat F0 + clearcoatColor, // Clearcoat F90 + fresnel); + lod = clearcoatRoughness * MAX_REFLECTION_LOD; + prefilter = HdTextureLod_domeLightPrefilter(Rcoord, lod).rgb; + clearcoat = prefilter * (clearcoatF * brdf.x + brdf.y); + } + + // Indirect Lighting + indirect.diffuse = (d * diffuse) * occlusion; + indirect.specular = (specular + clearcoat) * occlusion; + +#endif + + return indirect; +} + +vec3 +evaluateLights( + vec3 emissiveColor, + vec3 diffuseColor, + bool useSpecularWorkflow, + float ior, + float metallic, + float specularAmount, + vec3 specularColor, + float specularRoughness, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + float occlusion, + vec4 Peye, + vec3 Neye) +{ + vec3 n = Neye; + vec3 e = normalize(-Peye.xyz); + float NdotE = max(0.0, dot(n, e)); + + vec3 Reye = reflect(-e, n); + + vec3 directLight = vec3(0.0); + vec3 indirectLight = vec3(0.0); + +#if NUM_LIGHTS > 0 + for (int i = 0; i < NUM_LIGHTS; ++i) { + LightSource light = GetLightSource(i); + + // Calculate necessary vector information for lighting + vec4 Plight = light.isIndirectLight + ? vec4(0,0,0,1) + : light.position; + vec3 l = (Plight.w == 0.0) + ? normalize(Plight.xyz) + : normalize(Plight - Peye).xyz; + vec3 h = normalize(e + l); + float NdotL = max(0.0, dot(n, l)); + float NdotH = max(0.0, dot(n, h)); + float EdotH = max(0.0, dot(e, h)); + + // Calculate light intensity + float atten = lightDistanceAttenuation(Peye, i); + float spot = lightSpotAttenuation(l, i); + + // Calculate the shadow factor + float shadow = 1.0; + #if USE_SHADOWS + shadow = light.hasShadow ? + shadowing(/*lightIndex=*/i, Peye) : 1.0; + #endif + + float intensity = atten * spot * shadow; + + vec3 lightDiffuseIrradiance = intensity * light.diffuse.rgb; + vec3 lightSpecularIrradiance = intensity * light.specular.rgb; + + LightingContributions lightingContrib = evaluateLight( + diffuseColor, + useSpecularWorkflow, + ior, + metallic, + specularAmount, + specularColor, + specularRoughness, + clearcoatAmount, + clearcoatColor, + clearcoatRoughness, + occlusion, + NdotL, + NdotE, + NdotH, + EdotH, + lightDiffuseIrradiance, + lightSpecularIrradiance); + + // calculate the indirect light (DomeLight) + if (light.isIndirectLight) { + + LightingContributions indirectLightContrib = + evaluateIndirectLighting(diffuseColor, specularColor, + Neye, Reye, NdotE, EdotH, ior, metallic, occlusion, + specularRoughness, useSpecularWorkflow, + clearcoatAmount, clearcoatColor, clearcoatRoughness, + light.worldToLightTransform); + indirectLight = (indirectLightContrib.diffuse * light.diffuse.rgb + + indirectLightContrib.specular * light.specular.rgb); + } + // all other light sources contribute to the direct lighting + else { + directLight += (lightingContrib.diffuse + lightingContrib.specular); + } + } +#endif + + return (emissiveColor + directLight + indirectLight); +} + + +-- glsl Preview.NormalMapping + +vec3 +perturbFragmentNormal(vec3 P, vec3 N) +{ +#ifdef HD_HAS_COORD_normal + vec3 Nt = normalize(HdGet_normal().xyz); + vec2 st = HdGetCoord_normal().xy; + return PerturbNormal(P, N, st, Nt); +#endif + return N; +} + + +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 + +def Shader "UsdPreviewSurface" ( + doc = "Preview surface specification" +) +{ + uniform token info:id = "UsdPreviewSurface" + uniform token info:implementationSource = "sourceAsset" + + # XXX: This doesn't resolve if it's defined as a search path. + # Might require special resolver configuration, to include the resources + # directory. + uniform asset info:glslfx:sourceAsset = @./previewSurface.glslfx@ + + # Outputs + token outputs:surface ( + sdrMetadata = { + string renderType = "terminal surface" + } + ) + token outputs:displacement ( + sdrMetadata = { + string renderType = "terminal displacement" + } + ) + + # Inputs + color3f inputs:diffuseColor = (0.18, 0.18, 0.18) ( + doc = """Parameter used as diffuseColor when using the specular + workflow, when using metallic workflow this is interpreted + as albedo.""" + ) + + color3f inputs:emissiveColor = (0.0, 0.0, 0.0) ( + doc = """Emissive component.""" + ) + + int inputs:useSpecularWorkflow = 0 ( + connectability = "interfaceOnly" + doc = """This node can fundamentally operate in two modes : + Specular workflow where you provide a texture/value to the + "specularColor" input. Or, Metallic workflow where you + provide a texture/value to the "metallic" input.""" + ) + + color3f inputs:specularColor = (0.0, 0.0, 0.0) ( + doc = """Used only in the specular workflow. + Specular color to be used. + This is the color at 0 incidence. Edge color is assumed white. + Transition between the two colors according to Schlick fresnel + approximation.""" + ) + + float inputs:metallic = 0.0 ( + doc = """Used only in the metalness workflow. + 1 for metallic surfaces and 0 for non-metallic. + - If metallic is 1, then both F0 (reflectivity at 0 degree + incidence) and edge F90 reflectivity will simply be the Albedo. + - If metallic is 0, then Albedo is ignored in the calculation of F0 + and F90; F0 is derived from ior via ( (1-ior)/(1+ior) )^2 and F90 is + white. + In between, we interpolate.""" + ) + + float inputs:roughness = 0.5 ( + doc = """Roughness for the specular lobe. The value ranges from 0 to 1, + which goes from a perfectly specular surface at 0.0 to maximum roughness + of the specular lobe. This value is usually squared before use with a + GGX or Beckmann lobe.""" + ) + + float inputs:clearcoat = 0.0 ( + doc = """Second specular lobe amount. The color is white.""" + ) + + float inputs:clearcoatRoughness = 0.01 ( + doc = """Roughness for the second specular lobe.""" + ) + + float inputs:opacity = 1.0 ( + doc = """Opacity of the material.""" + ) + + float inputs:opacityThreshold = 0.0 ( + connectability = "interfaceOnly" + doc = """Threshold used to determine opacity values that will be + considered fully transparent. A value of 0.0 indicates that no masking + is applied to the opacity input, while a value greater than 0.0 indicates + that rendering of the surface is limited to the areas where the opacity + is greater or equal to that value. Note that when opacityThreshold is + greater than zero, the opacity values less than the opacityThreshold will + not be rendered, and the opacity values greater than or equal to the + opacityThreshold will be fully visible.""" + ) + + float inputs:ior = 1.5 ( + doc = """Index of Refraction to be used for translucent objects.""" + ) + + normal3f inputs:normal = (0.0, 0.0, 1.0) ( + doc = """Expects normal in tangent space [(-1,-1,-1), (1,1,1)] + This means your texture reader implementation should provide + data to this node that is properly scaled and ready + to be consumed as a tangent space normal. + If the texture has 8 bits per component, then scale and bias must be + adjusted to be (2.0, 2.0, 2.0, 1.0) and (-1, -1, -1, 0) respectively + in order to satisfy tangent space requirements. + Normal map data is commonly expected to be linearly encoded. + However, many image-writing tools automatically set the profile of + three-channel, 8-bit images to SRGB. To prevent an unwanted + transformation, the sourceColorSpace must also be set to "raw".""" + ) + + float inputs:displacement = 0.0 ( + doc = """Displacement in the direction of the normal. """ + ) + + float inputs:occlusion = 1.0 ( + doc = """Occlusion signal. This provides extra information about the + occlusion of different parts of the mesh that this material is applied + to. Occlusion only makes sense as a surface-varying signal, and + pathtracers will likely choose to ignore it. An occlusion value of 0.0 + means the surface point is fully occluded by other parts of the surface, + and a value of 1.0 means the surface point is completely unoccluded by + other parts of the surface. """ + ) +} + +def Shader "UsdUVTexture" ( + doc = """Texture Node Specification represents a node that can be used to + read UV textures, including tiled textures such as Mari UDIM's. + + Reads from a texture file and outputs one or more values. If the texture has + 8 bits per component, [0, 255] values will first be converted to floating + point in the range [0, 1] and then any transformations (bias, scale) + indicated are applied. Otherwise any indicated transformation (bias, + scale) is just applied. If a single-channel texture is fed into a + UsdUVTexture, the r, g, and b components of the rgb output will repeat the + channel's value, while the single 'a' output will be set to 1.0. If a + two-channel texture is fed into a UsdUVTexture, the r, g, and b components + of the rgb output will repeat the first channel's value, while the single + 'a' output will be set to the second channel's value. If a three-channel + texture is fed into a UsdUVTexture, the r, g, and b components of the rgb + outputs will contain the assigned texture channel's value, while the single + 'a' output will be set to 1.0. +""" + sdrMetadata = { + token role = "texture" + } +) +{ + uniform token info:id = "UsdUVTexture" + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./uvTexture.glslfx@ + + asset inputs:file = @@ ( + connectability = "interfaceOnly" + doc = """Path to the texture this node uses.""" + ) + + float2 inputs:st = (0.0, 0.0) ( + doc = """This input provides the texture coordinates. It is usually + connected to a (primvar) node that will provide the texture + coords.""" + ) + + token inputs:wrapS = "useMetadata" ( + allowedTokens = ["black", "clamp", "repeat", "mirror", "useMetadata"] + connectability = "interfaceOnly" + doc = """ black, clamp, repeat, mirror, useMetadata.""" + ) + + token inputs:wrapT = "useMetadata" ( + allowedTokens = ["black", "clamp", "repeat", "mirror", "useMetadata"] + connectability = "interfaceOnly" + doc = """ black, clamp, repeat, mirror, useMetadata.""" + ) + + float4 inputs:fallback = (0.0, 0.0, 0.0, 1.0) ( + doc = """Fallback value to be used when no texture is connected.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float4 inputs:scale = (1.0, 1.0, 1.0, 1.0) ( + connectability = "interfaceOnly" + doc = """Scale to be applied to all components of the texture. + value * scale + bias. + Please see UsdPreviewSurface.inputs:normal for special + considerations for reading normal maps.""" + ) + + float4 inputs:bias = (0.0, 0.0, 0.0, 0.0) ( + connectability = "interfaceOnly" + doc = """Bias to be applied to all components of the texture. + value * scale + bias). + Please see UsdPreviewSurface.inputs:normal for special + considerations for reading normal maps.""" + ) + + token inputs:sourceColorSpace = "auto" ( + connectability = "interfaceOnly" + allowedTokens = ["raw", "sRGB", "auto"] + doc = """ raw, sRGB, auto. Flag indicating the color + space in which the source texture is encoded. If set to sRGB, + the texture will be read using the sRGB transfer curve, but + not filtered against the sRGB gamut. Please see + UsdPreviewSurface.inputs:normal for special considerations for + reading normal maps.""" + ) + + float outputs:r ( + doc = "Outputs the red channel." + sdrMetadata = { + token swizzle = "x" + } + ) + + float outputs:g ( + doc = "Outputs the green channel." + sdrMetadata = { + token swizzle = "y" + } + ) + + float outputs:b ( + doc = "Outputs the blue channnel." + sdrMetadata = { + token swizzle = "z" + } + ) + + float outputs:a ( + doc = "Outputs the alpha channnel." + sdrMetadata = { + token swizzle = "w" + } + ) + + float3 outputs:rgb ( + doc = "Outputs the red, green and blue channels." + sdrMetadata = { + token swizzle = "xyz" + } + ) +} + +class "UsdPrimvarReader" ( + sdrMetadata = { + token role = "primvar" + } +) +{ + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./primvarReader.glslfx@ + string inputs:varname = "" ( + connectability = "interfaceOnly" + doc = """Name of the primvar to be fetched from the geometry.""" + sdrMetadata = { + token primvarProperty = "1" + } + ) +} + +def Shader "UsdPrimvarReader_float" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float" + + float inputs:fallback = 0.0 ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float outputs:result +} + +def Shader "UsdPrimvarReader_float2" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float2" + + float2 inputs:fallback = (0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float2 outputs:result +} + +def Shader "UsdPrimvarReader_float3" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float3" + + float3 inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float3 outputs:result +} + +def Shader "UsdPrimvarReader_float4" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float4" + + float4 inputs:fallback = (0.0, 0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float4 outputs:result +} + +def Shader "UsdPrimvarReader_int" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_int" + + int inputs:fallback = 0 ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + int outputs:result +} + +def Shader "UsdPrimvarReader_string" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_string" + + string inputs:fallback = "" ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + string outputs:result +} + +def Shader "UsdPrimvarReader_normal" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_normal" + + normal3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + normal3f outputs:result +} + +def Shader "UsdPrimvarReader_point" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_point" + + point3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + point3f outputs:result +} + +def Shader "UsdPrimvarReader_vector" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_vector" + + vector3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + vector3f outputs:result +} + +def Shader "UsdPrimvarReader_matrix" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_matrix" + + matrix4d inputs:fallback = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + matrix4d outputs:result +} + +def Shader "UsdTransform2d" ( + doc = """Transform 2d represents a node that can be used to + transform 2d data (for instance, texture coordinates). + The node applies the following transformation : + in * scale * rotate + translation""" + sdrMetadata = { + token role = "math" + } +) +{ + uniform token info:id = "UsdTransform2d" + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./transform2d.glslfx@ + + float2 inputs:in = (0.0, 0.0) ( + doc = """This input provides the data. It is usually + connected to a UsdPrimvarReader_float2 that + will provide the data.""" + ) + + float inputs:rotation = 0.0 ( + connectability = "interfaceOnly" + doc = """Counter-clockwise rotation in degrees around the origin to be applied + to all components of the data.""" + ) + + float2 inputs:scale = (1.0, 1.0) ( + connectability = "interfaceOnly" + doc = """Scale around the origin to be applied to all components of the data.""" + ) + + float2 inputs:translation = (0.0, 0.0) ( + connectability = "interfaceOnly" + doc = """Translation to be applied to all components of the data.""" + ) + + float2 outputs:result ( + doc = "Outputs transformed float2 values." + ) +} +-- glslfx version 0.1 + +// +// Copyright 2020 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class SkelRoot "SkelRoot" ( + doc = '''Boundable prim type used to identify a scope beneath which + skeletally-posed primitives are defined. + + A SkelRoot must be defined at or above a skinned primitive for any skinning + behaviors in UsdSkel. + + See the extended "Skel Root Schema" documentation for + more information.''' +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Skeleton "Skeleton" ( + doc = '''Describes a skeleton. + + See the extended "Skeleton Schema" documentation for + more information. + ''' +) +{ + uniform matrix4d[] bindTransforms ( + doc = """Specifies the bind-pose transforms of each joint in + **world space**, in the ordering imposed by *joints*.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token[] jointNames ( + doc = """If authored, provides a unique name per joint. This may be + optionally set to provide better names when translating to DCC apps + that require unique joint names.""" + ) + uniform token[] joints ( + doc = """An array of path tokens identifying the set of joints that make + up the skeleton, and their order. Each token in the array must be valid + when parsed as an SdfPath. The parent-child relationships of the + corresponding paths determine the parent-child relationships of each + joint. It is not required that the name at the end of each path be + unique, but rather only that the paths themselves be unique.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform matrix4d[] restTransforms ( + doc = """Specifies the rest-pose transforms of each joint in + **local space**, in the ordering imposed by *joints*. This provides + fallback values for joint transforms when a Skeleton either has no + bound animation source, or when that animation source only contains + animation for a subset of a Skeleton's joints.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class SkelAnimation "SkelAnimation" ( + doc = '''Describes a skel animation, where joint animation is stored in a + vectorized form. + + See the extended "Skel Animation" + documentation for more information. + ''' +) +{ + uniform token[] blendShapes ( + doc = """Array of tokens identifying which blend shapes this + animation's data applies to. The tokens for blendShapes correspond to + the tokens set in the *skel:blendShapes* binding property of the + UsdSkelBindingAPI.""" + ) + float[] blendShapeWeights ( + doc = """Array of weight values for each blend shape. Each weight value + is associated with the corresponding blend shape identified within the + *blendShapes* token array, and therefore must have the same length as + *blendShapes.""" + ) + uniform token[] joints ( + doc = """Array of tokens identifying which joints this animation's + data applies to. The tokens for joints correspond to the tokens of + Skeleton primitives. The order of the joints as listed here may + vary from the order of joints on the Skeleton itself.""" + ) + quatf[] rotations ( + doc = """Joint-local unit quaternion rotations of all affected joints, + in 32-bit precision. Array length should match the size of the + *joints* attribute.""" + ) + half3[] scales ( + doc = """Joint-local scales of all affected joints, in + 16 bit precision. Array length should match the size of the *joints* + attribute.""" + ) + float3[] translations ( + doc = """Joint-local translations of all affected joints. Array length + should match the size of the *joints* attribute.""" + ) +} + +class "SkelBindingAPI" ( + doc = '''Provides API for authoring and extracting all the skinning-related + data that lives in the "geometry hierarchy" of prims and models that want + to be skeletally deformed. + + See the extended "UsdSkelBindingAPI schema" + documentation for more about bindings and how they apply in a scene graph. + ''' +) +{ + matrix4d primvars:skel:geomBindTransform ( + doc = '''Encodes the bind-time world space transforms of the prim. + If the transform is identical for a group of gprims that share a common + ancestor, the transform may be authored on the ancestor, to "inherit" + down to all the leaf gprims. If this transform is unset, an identity + transform is used instead.''' + ) + int[] primvars:skel:jointIndices ( + doc = """Indices into the *joints* attribute of the closest + (in namespace) bound Skeleton that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joint influences + apply to each point. Indices must point be valid. Null influences should + be defined by setting values in jointWeights to zero. + See UsdGeomPrimvar for more information on interpolation and + elementSize.""" + ) + float[] primvars:skel:jointWeights ( + doc = """Weights for the joints that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joints influences + apply to each point. The length, interpolation, and elementSize of + *jointWeights* must match that of *jointIndices*. See UsdGeomPrimvar + for more information on interpolation and elementSize.""" + ) + uniform token primvars:skel:skinningMethod = "classicLinear" ( + allowedTokens = ["classicLinear", "dualQuaternion"] + doc = "The skinningMethod specifies the skinning method for the prim." + ) + rel skel:animationSource ( + doc = """Animation source to be bound to Skeleton primitives at or + beneath the location at which this property is defined. + """ + ) + uniform token[] skel:blendShapes ( + doc = """An array of tokens defining the order onto which blend shape + weights from an animation source map onto the *skel:blendShapeTargets* + rel of a binding site. If authored, the number of elements must be equal + to the number of targets in the _blendShapeTargets_ rel. This property + is not inherited hierarchically, and is expected to be authored directly + on the skinnable primitive to which the blend shapes apply.""" + ) + rel skel:blendShapeTargets ( + doc = """Ordered list of all target blend shapes. This property is not + inherited hierarchically, and is expected to be authored directly on + the skinnable primitive to which the the blend shapes apply.""" + ) + uniform token[] skel:joints ( + doc = """An (optional) array of tokens defining the list of + joints to which jointIndices apply. If not defined, jointIndices applies + to the ordered list of joints defined in the bound Skeleton's *joints* + attribute. If undefined on a primitive, the primitive inherits the + value of the nearest ancestor prim, if any.""" + ) + rel skel:skeleton ( + doc = """Skeleton to be bound to this prim and its descendents that + possess a mapping and weighting to the joints of the identified + Skeleton.""" + ) +} + +class BlendShape "BlendShape" ( + doc = '''Describes a target blend shape, possibly containing inbetween + shapes. + + See the extended "Blend Shape Schema + documentation for information. + ''' +) +{ + uniform vector3f[] normalOffsets ( + doc = """**Required property**. Normal offsets which, when added to the + base pose, provides the normals of the target shape.""" + ) + uniform vector3f[] offsets ( + doc = """**Required property**. Position offsets which, when added to the + base pose, provides the target shape.""" + ) + uniform int[] pointIndices ( + doc = """**Optional property**. Indices into the original mesh that + correspond to the values in *offsets* and of any inbetween shapes. If + authored, the number of elements must be equal to the number of elements + in the *offsets* array.""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "weight": { + "appliesTo": [ + "attributes" + ], + "default": 0, + "displayGroup": "BlendShape", + "documentation": "The weight value at which an inbeteen shape is applied.", + "type": "float" + } + }, + "Types": { + "UsdSkelAnimation": { + "alias": { + "UsdSchemaBase": "SkelAnimation" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdSkelBindingAPI": { + "alias": { + "UsdSchemaBase": "SkelBindingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdSkelBlendShape": { + "alias": { + "UsdSchemaBase": "BlendShape" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdSkelRoot": { + "alias": { + "UsdSchemaBase": "SkelRoot" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdSkelSkeleton": { + "alias": { + "UsdSchemaBase": "Skeleton" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdSkel", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + """ This file contains a schema for supporting skeletal animations in USD. + """ + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdSkel" + string libraryPath = "pxr/usd/usdSkel" + + dictionary libraryTokens = { + dictionary weight = { + string doc = """UsdSkelInbetweenShape - The weight location at + which the inbetween shape applies.""" + } + } + } +) { +} + + +class SkelRoot "SkelRoot" ( + inherits = + doc = """Boundable prim type used to identify a scope beneath which + skeletally-posed primitives are defined. + + A SkelRoot must be defined at or above a skinned primitive for any skinning + behaviors in UsdSkel. + + See the extended \\ref UsdSkel_SkelRoot "Skel Root Schema" documentation for + more information.""" + customData = { + string className = "Root" + + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { +} + + +class Skeleton "Skeleton" ( + inherits = + doc = """Describes a skeleton. + + See the extended \\ref UsdSkel_Skeleton "Skeleton Schema" documentation for + more information. + """ + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + + string extraIncludes = """ +#include "pxr/usd/usdSkel/topology.h" """ + } +) { + uniform token[] joints ( + doc = """An array of path tokens identifying the set of joints that make + up the skeleton, and their order. Each token in the array must be valid + when parsed as an SdfPath. The parent-child relationships of the + corresponding paths determine the parent-child relationships of each + joint. It is not required that the name at the end of each path be + unique, but rather only that the paths themselves be unique.""" + ) + + uniform token[] jointNames ( + doc = """If authored, provides a unique name per joint. This may be + optionally set to provide better names when translating to DCC apps + that require unique joint names.""" + ) + + uniform matrix4d[] bindTransforms ( + doc = """Specifies the bind-pose transforms of each joint in + **world space**, in the ordering imposed by *joints*.""" + ) + uniform matrix4d[] restTransforms ( + doc = """Specifies the rest-pose transforms of each joint in + **local space**, in the ordering imposed by *joints*. This provides + fallback values for joint transforms when a Skeleton either has no + bound animation source, or when that animation source only contains + animation for a subset of a Skeleton's joints.""" + ) +} + + +class SkelAnimation "SkelAnimation" ( + inherits = + doc = """Describes a skel animation, where joint animation is stored in a + vectorized form. + + See the extended \\ref UsdSkel_SkelAnimation "Skel Animation" + documentation for more information. + """ + customData = { + string className = "Animation" + } +) { + uniform token[] joints ( + doc = """Array of tokens identifying which joints this animation's + data applies to. The tokens for joints correspond to the tokens of + Skeleton primitives. The order of the joints as listed here may + vary from the order of joints on the Skeleton itself.""" + ) + + float3[] translations ( + doc = """Joint-local translations of all affected joints. Array length + should match the size of the *joints* attribute.""" + ) + + quatf[] rotations ( + doc = """Joint-local unit quaternion rotations of all affected joints, + in 32-bit precision. Array length should match the size of the + *joints* attribute.""" + ) + + half3[] scales ( + doc = """Joint-local scales of all affected joints, in + 16 bit precision. Array length should match the size of the *joints* + attribute.""" + ) + + uniform token[] blendShapes ( + doc = """Array of tokens identifying which blend shapes this + animation's data applies to. The tokens for blendShapes correspond to + the tokens set in the *skel:blendShapes* binding property of the + UsdSkelBindingAPI.""" + ) + + float[] blendShapeWeights ( + doc = """Array of weight values for each blend shape. Each weight value + is associated with the corresponding blend shape identified within the + *blendShapes* token array, and therefore must have the same length as + *blendShapes.""" + ) +} + +class "SkelBindingAPI" ( + inherits = + doc = """Provides API for authoring and extracting all the skinning-related + data that lives in the "geometry hierarchy" of prims and models that want + to be skeletally deformed. + + See the extended \\ref UsdSkel_BindingAPI "UsdSkelBindingAPI schema" + documentation for more about bindings and how they apply in a scene graph. + """ + customData = { + string className = "BindingAPI" + string extraIncludes = """ +#include "pxr/base/tf/span.h" +#include "pxr/usd/usdGeom/primvar.h" +#include "pxr/usd/usdSkel/skeleton.h" """ + } +) +{ + rel skel:animationSource ( + customData = { + string apiName = "animationSource" + } + doc = """Animation source to be bound to Skeleton primitives at or + beneath the location at which this property is defined. + """ + ) + + rel skel:skeleton ( + customData = { + string apiName = "skeleton" + } + doc = """Skeleton to be bound to this prim and its descendents that + possess a mapping and weighting to the joints of the identified + Skeleton.""" + ) + + uniform token primvars:skel:skinningMethod = "classicLinear" ( + customData = { + string apiName = "skinningMethod" + } + allowedTokens = ["classicLinear", "dualQuaternion"] + doc = """The skinningMethod specifies the skinning method for the prim.""" + ) + + matrix4d primvars:skel:geomBindTransform ( + customData = { + string apiName = "geomBindTransform" + } + doc = """Encodes the bind-time world space transforms of the prim. + If the transform is identical for a group of gprims that share a common + ancestor, the transform may be authored on the ancestor, to "inherit" + down to all the leaf gprims. If this transform is unset, an identity + transform is used instead.""" + ) + + uniform token[] skel:joints ( + customData = { + string apiName = "joints" + } + doc = """An (optional) array of tokens defining the list of + joints to which jointIndices apply. If not defined, jointIndices applies + to the ordered list of joints defined in the bound Skeleton's *joints* + attribute. If undefined on a primitive, the primitive inherits the + value of the nearest ancestor prim, if any.""" + ) + + int[] primvars:skel:jointIndices ( + customData = { + string apiName = "jointIndices" + } + doc = """Indices into the *joints* attribute of the closest + (in namespace) bound Skeleton that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joint influences + apply to each point. Indices must point be valid. Null influences should + be defined by setting values in jointWeights to zero. + See UsdGeomPrimvar for more information on interpolation and + elementSize.""" + ) + + float[] primvars:skel:jointWeights ( + customData = { + string apiName = "jointWeights" + } + doc = """Weights for the joints that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joints influences + apply to each point. The length, interpolation, and elementSize of + *jointWeights* must match that of *jointIndices*. See UsdGeomPrimvar + for more information on interpolation and elementSize.""" + ) + + uniform token[] skel:blendShapes ( + customData = { + string apiName = "blendShapes" + } + doc = """An array of tokens defining the order onto which blend shape + weights from an animation source map onto the *skel:blendShapeTargets* + rel of a binding site. If authored, the number of elements must be equal + to the number of targets in the _blendShapeTargets_ rel. This property + is not inherited hierarchically, and is expected to be authored directly + on the skinnable primitive to which the blend shapes apply.""" + ) + rel skel:blendShapeTargets ( + customData = { + string apiName= "blendShapeTargets" + } + doc = """Ordered list of all target blend shapes. This property is not + inherited hierarchically, and is expected to be authored directly on + the skinnable primitive to which the the blend shapes apply.""" + ) +} + + +class BlendShape "BlendShape" ( + inherits = + doc = """Describes a target blend shape, possibly containing inbetween + shapes. + + See the extended \\ref UsdSkel_BlendShape "Blend Shape Schema + documentation for information. + """ + customData = { + string extraIncludes = """ +#include "pxr/base/tf/span.h" +#include "pxr/usd/usdSkel/inbetweenShape.h" """ + } +) +{ + uniform vector3f[] offsets ( + doc = """**Required property**. Position offsets which, when added to the + base pose, provides the target shape.""" + ) + + uniform vector3f[] normalOffsets ( + doc = """**Required property**. Normal offsets which, when added to the + base pose, provides the normals of the target shape.""" + ) + + uniform int[] pointIndices ( + doc = """**Optional property**. Indices into the original mesh that + correspond to the values in *offsets* and of any inbetween shapes. If + authored, the number of elements must be equal to the number of elements + in the *offsets* array.""" + ) +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class Volume "Volume" ( + doc = """A renderable volume primitive. A volume is made up of any number + of FieldBase primitives bound together in this volume. Each + FieldBase primitive is specified as a relationship with a + namespace prefix of \"field\". + + The relationship name is used by the renderer to associate + individual fields with the named input parameters on the volume + shader. Using this indirect approach to connecting fields to + shader parameters (rather than using the field prim's name) + allows a single field to be reused for different shader inputs, or + to be used as different shader parameters when rendering different + Volumes. This means that the name of the field prim is not + relevant to its contribution to the volume prims which refer to + it. Nor does the field prim's location in the scene graph have + any relevance, and Volumes may refer to fields anywhere in the + scene graph. **However**, unless Field prims need to be shared + by multiple Volumes, a Volume's Field prims should be located + under the Volume in namespace, for enhanced organization.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "FieldBase" ( + doc = "Base class for field primitives." +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "FieldAsset" ( + doc = "Base class for field primitives defined by an external file." +) +{ + token fieldDataType ( + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens is specified with the specific asset type. + A missing value is considered an error.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Field3DAsset "Field3DAsset" ( + doc = """Field3D field primitive. The FieldAsset filePath attribute must + specify a file in the Field3D format on disk.""" +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", "half3", "float3", "double3"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for Field3d + volumes.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + token fieldPurpose ( + doc = """Optional token which can be used to indicate the purpose or + grouping of an individual field. Clients which consume Field3D + files should treat this as the Field3D field name.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class OpenVDBAsset "OpenVDBAsset" ( + doc = """OpenVDB field primitive. The FieldAsset filePath attribute must + specify a file in the OpenVDB format on disk.""" +) +{ + token fieldClass ( + allowedTokens = ["levelSet", "fogVolume", "staggered", "unknown"] + doc = """Optional token which can be used to indicate the class of + an individual grid. This is a mapping to openvdb::GridClass + where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, + GRID_STAGGERED, and GRID_UNKNOWN.""" + ) + token fieldDataType ( + allowedTokens = ["half", "float", "double", "int", "uint", "int64", "half2", "float2", "double2", "int2", "half3", "float3", "double3", "int3", "matrix3d", "matrix4d", "quatd", "bool", "mask", "string"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for OpenVDB + volumes.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdVolField3DAsset": { + "alias": { + "UsdSchemaBase": "Field3DAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldAsset" + ], + "schemaKind": "concreteTyped" + }, + "UsdVolFieldAsset": { + "alias": { + "UsdSchemaBase": "FieldAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldBase" + ], + "schemaKind": "abstractTyped" + }, + "UsdVolFieldBase": { + "alias": { + "UsdSchemaBase": "FieldBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdVolOpenVDBAsset": { + "alias": { + "UsdSchemaBase": "OpenVDBAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldAsset" + ], + "schemaKind": "concreteTyped" + }, + "UsdVolVolume": { + "alias": { + "UsdSchemaBase": "Volume" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdVol", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 + +( + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdVol" + string libraryPath = "pxr/usd/usdVol" + dictionary libraryTokens = { + dictionary field = { + string doc = """This is the namespace prefix used to + specify the fields that make up a volume primitive.""" + } + } + } +) +{ +} + +class Volume "Volume" ( + inherits = + doc = """A renderable volume primitive. A volume is made up of any number + of FieldBase primitives bound together in this volume. Each + FieldBase primitive is specified as a relationship with a + namespace prefix of "field". + + The relationship name is used by the renderer to associate + individual fields with the named input parameters on the volume + shader. Using this indirect approach to connecting fields to + shader parameters (rather than using the field prim's name) + allows a single field to be reused for different shader inputs, or + to be used as different shader parameters when rendering different + Volumes. This means that the name of the field prim is not + relevant to its contribution to the volume prims which refer to + it. Nor does the field prim's location in the scene graph have + any relevance, and Volumes may refer to fields anywhere in the + scene graph. **However**, unless Field prims need to be shared + by multiple Volumes, a Volume's Field prims should be located + under the Volume in namespace, for enhanced organization.""" +) +{ +} + +class "FieldBase" ( + inherits = + doc = """Base class for field primitives.""" +) +{ +} + +class "FieldAsset" ( + doc = "Base class for field primitives defined by an external file." + inherits = +) +{ + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldDataType ( + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens is specified with the specific asset type. + A missing value is considered an error.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) +} + +class Field3DAsset "Field3DAsset" ( + doc = """Field3D field primitive. The FieldAsset filePath attribute must + specify a file in the Field3D format on disk.""" + inherits = +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", + "half3", "float3", "double3"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for Field3d + volumes.""" + ) + token fieldPurpose ( + doc = """Optional token which can be used to indicate the purpose or + grouping of an individual field. Clients which consume Field3D + files should treat this as the Field3D field \\em name.""" + ) +} + +class OpenVDBAsset "OpenVDBAsset" ( + doc = """OpenVDB field primitive. The FieldAsset filePath attribute must + specify a file in the OpenVDB format on disk.""" + inherits = +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", "int", "uint", "int64", + "half2", "float2", "double2", "int2", + "half3", "float3", "double3", "int3", + "matrix3d", "matrix4d", "quatd", + "bool", "mask", "string"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for OpenVDB + volumes.""" + ) + token fieldClass ( + allowedTokens = ["levelSet", "fogVolume", "staggered", "unknown"] + doc = """Optional token which can be used to indicate the class of + an individual grid. This is a mapping to openvdb::GridClass + where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, + GRID_STAGGERED, and GRID_UNKNOWN.""" + ) +} + diff --git a/web/threeVisualizer/assets/emHdBindings-qRmJXJBb.js b/web/threeVisualizer/assets/emHdBindings-qRmJXJBb.js new file mode 100644 index 0000000..86777e8 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings-qRmJXJBb.js @@ -0,0 +1 @@ +const s="/extensions/ComfyUI-Rodin/threeVisualizer/assets/emHdBindings-BNKz2vMm.wasm";export{s as default}; diff --git a/web/threeVisualizer/assets/emHdBindings.worker-CyHENA1f.js b/web/threeVisualizer/assets/emHdBindings.worker-CyHENA1f.js new file mode 100644 index 0000000..59823b4 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings.worker-CyHENA1f.js @@ -0,0 +1 @@ +const Z="data:text/javascript;base64,InVzZSBzdHJpY3QiO3ZhciBNb2R1bGU9e307dmFyIEVOVklST05NRU5UX0lTX05PREU9dHlwZW9mIHByb2Nlc3M9PSJvYmplY3QiJiZ0eXBlb2YgcHJvY2Vzcy52ZXJzaW9ucz09Im9iamVjdCImJnR5cGVvZiBwcm9jZXNzLnZlcnNpb25zLm5vZGU9PSJzdHJpbmciO2lmKEVOVklST05NRU5UX0lTX05PREUpe3ZhciBub2RlV29ya2VyVGhyZWFkcz1yZXF1aXJlKCJ3b3JrZXJfdGhyZWFkcyIpO3ZhciBwYXJlbnRQb3J0PW5vZGVXb3JrZXJUaHJlYWRzLnBhcmVudFBvcnQ7cGFyZW50UG9ydC5vbigibWVzc2FnZSIsZGF0YT0+b25tZXNzYWdlKHtkYXRhOmRhdGF9KSk7dmFyIGZzPXJlcXVpcmUoImZzIik7T2JqZWN0LmFzc2lnbihnbG9iYWwse3NlbGY6Z2xvYmFsLHJlcXVpcmU6cmVxdWlyZSxNb2R1bGU6TW9kdWxlLGxvY2F0aW9uOntocmVmOl9fZmlsZW5hbWV9LFdvcmtlcjpub2RlV29ya2VyVGhyZWFkcy5Xb3JrZXIsaW1wb3J0U2NyaXB0czpmPT4oMCxldmFsKShmcy5yZWFkRmlsZVN5bmMoZiwidXRmOCIpKyIvLyMgc291cmNlVVJMPSIrZikscG9zdE1lc3NhZ2U6bXNnPT5wYXJlbnRQb3J0LnBvc3RNZXNzYWdlKG1zZykscGVyZm9ybWFuY2U6Z2xvYmFsLnBlcmZvcm1hbmNlfHx7bm93OkRhdGUubm93fX0pfXZhciBpbml0aWFsaXplZEpTPWZhbHNlO2Z1bmN0aW9uIHRocmVhZFByaW50RXJyKCl7dmFyIHRleHQ9QXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCIgIik7aWYoRU5WSVJPTk1FTlRfSVNfTk9ERSl7ZnMud3JpdGVTeW5jKDIsdGV4dCsiXG4iKTtyZXR1cm59Y29uc29sZS5lcnJvcih0ZXh0KX1mdW5jdGlvbiB0aHJlYWRBbGVydCgpe3ZhciB0ZXh0PUFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cykuam9pbigiICIpO3Bvc3RNZXNzYWdlKHtjbWQ6ImFsZXJ0Iix0ZXh0OnRleHQsdGhyZWFkSWQ6TW9kdWxlWyJfcHRocmVhZF9zZWxmIl0oKX0pfXZhciBlcnI9dGhyZWFkUHJpbnRFcnI7c2VsZi5hbGVydD10aHJlYWRBbGVydDtNb2R1bGVbImluc3RhbnRpYXRlV2FzbSJdPShpbmZvLHJlY2VpdmVJbnN0YW5jZSk9Pnt2YXIgbW9kdWxlPU1vZHVsZVsid2FzbU1vZHVsZSJdO01vZHVsZVsid2FzbU1vZHVsZSJdPW51bGw7dmFyIGluc3RhbmNlPW5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShtb2R1bGUsaW5mbyk7cmV0dXJuIHJlY2VpdmVJbnN0YW5jZShpbnN0YW5jZSl9O3NlbGYub251bmhhbmRsZWRyZWplY3Rpb249ZT0+e3Rocm93IGUucmVhc29ufHxlfTtmdW5jdGlvbiBoYW5kbGVNZXNzYWdlKGUpe3RyeXtpZihlLmRhdGEuY21kPT09ImxvYWQiKXtsZXQgbWVzc2FnZVF1ZXVlPVtdO3NlbGYub25tZXNzYWdlPWU9Pm1lc3NhZ2VRdWV1ZS5wdXNoKGUpO3NlbGYuc3RhcnRXb3JrZXI9aW5zdGFuY2U9PntNb2R1bGU9aW5zdGFuY2U7cG9zdE1lc3NhZ2UoeyJjbWQiOiJsb2FkZWQifSk7Zm9yKGxldCBtc2cgb2YgbWVzc2FnZVF1ZXVlKXtoYW5kbGVNZXNzYWdlKG1zZyl9c2VsZi5vbm1lc3NhZ2U9aGFuZGxlTWVzc2FnZX07TW9kdWxlWyJ3YXNtTW9kdWxlIl09ZS5kYXRhLndhc21Nb2R1bGU7Zm9yKGNvbnN0IGhhbmRsZXIgb2YgZS5kYXRhLmhhbmRsZXJzKXtNb2R1bGVbaGFuZGxlcl09KC4uLmFyZ3MpPT57cG9zdE1lc3NhZ2Uoe2NtZDoiY2FsbEhhbmRsZXIiLGhhbmRsZXI6aGFuZGxlcixhcmdzOmFyZ3N9KX19TW9kdWxlWyJ3YXNtTWVtb3J5Il09ZS5kYXRhLndhc21NZW1vcnk7TW9kdWxlWyJidWZmZXIiXT1Nb2R1bGVbIndhc21NZW1vcnkiXS5idWZmZXI7TW9kdWxlWyJFTlZJUk9OTUVOVF9JU19QVEhSRUFEIl09dHJ1ZTtpZih0eXBlb2YgZS5kYXRhLnVybE9yQmxvYj09InN0cmluZyIpe2ltcG9ydFNjcmlwdHMoZS5kYXRhLnVybE9yQmxvYil9ZWxzZXt2YXIgb2JqZWN0VXJsPVVSTC5jcmVhdGVPYmplY3RVUkwoZS5kYXRhLnVybE9yQmxvYik7aW1wb3J0U2NyaXB0cyhvYmplY3RVcmwpO1VSTC5yZXZva2VPYmplY3RVUkwob2JqZWN0VXJsKX1nZXRVc2RNb2R1bGUoTW9kdWxlKX1lbHNlIGlmKGUuZGF0YS5jbWQ9PT0icnVuIil7TW9kdWxlWyJfX2Vtc2NyaXB0ZW5fdGhyZWFkX2luaXQiXShlLmRhdGEucHRocmVhZF9wdHIsMCwwLDEpO01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9tYWlsYm94X2F3YWl0Il0oZS5kYXRhLnB0aHJlYWRfcHRyKTtNb2R1bGVbImVzdGFibGlzaFN0YWNrU3BhY2UiXSgpO01vZHVsZVsiUFRocmVhZCJdLnJlY2VpdmVPYmplY3RUcmFuc2ZlcihlLmRhdGEpO01vZHVsZVsiUFRocmVhZCJdLnRocmVhZEluaXRUTFMoKTtpZighaW5pdGlhbGl6ZWRKUyl7TW9kdWxlWyJfX2VtYmluZF9pbml0aWFsaXplX2JpbmRpbmdzIl0oKTtpbml0aWFsaXplZEpTPXRydWV9dHJ5e01vZHVsZVsiaW52b2tlRW50cnlQb2ludCJdKGUuZGF0YS5zdGFydF9yb3V0aW5lLGUuZGF0YS5hcmcpfWNhdGNoKGV4KXtpZihleCE9InVud2luZCIpe3Rocm93IGV4fX19ZWxzZSBpZihlLmRhdGEuY21kPT09ImNhbmNlbCIpe2lmKE1vZHVsZVsiX3B0aHJlYWRfc2VsZiJdKCkpe01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9leGl0Il0oLTEpfX1lbHNlIGlmKGUuZGF0YS50YXJnZXQ9PT0ic2V0aW1tZWRpYXRlIil7fWVsc2UgaWYoZS5kYXRhLmNtZD09PSJjaGVja01haWxib3giKXtpZihpbml0aWFsaXplZEpTKXtNb2R1bGVbImNoZWNrTWFpbGJveCJdKCl9fWVsc2UgaWYoZS5kYXRhLmNtZCl7ZXJyKGB3b3JrZXIuanMgcmVjZWl2ZWQgdW5rbm93biBjb21tYW5kICR7ZS5kYXRhLmNtZH1gKTtlcnIoZS5kYXRhKX19Y2F0Y2goZXgpe2lmKE1vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9jcmFzaGVkIl0pe01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9jcmFzaGVkIl0oKX10aHJvdyBleH19c2VsZi5vbm1lc3NhZ2U9aGFuZGxlTWVzc2FnZTsK";export{Z as default}; diff --git a/web/threeVisualizer/assets/emHdBindings.worker-DUEm-236.js b/web/threeVisualizer/assets/emHdBindings.worker-DUEm-236.js new file mode 100644 index 0000000..16fecd4 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings.worker-DUEm-236.js @@ -0,0 +1,2 @@ +(function(){"use strict";var a={},d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(d){var l=require("worker_threads"),c=l.parentPort;c.on("message",e=>onmessage({data:e}));var m=require("fs");Object.assign(global,{self:global,require,Module:a,location:{href:__filename},Worker:l.Worker,importScripts:e=>(0,eval)(m.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>c.postMessage(e),performance:global.performance||{now:Date.now}})}var o=!1;function u(){var e=Array.prototype.slice.call(arguments).join(" ");if(d){m.writeSync(2,e+` +`);return}console.error(e)}function _(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:a._pthread_self()})}var f=u;self.alert=_,a.instantiateWasm=(e,s)=>{var r=a.wasmModule;a.wasmModule=null;var t=new WebAssembly.Instance(r,e);return s(t)},self.onunhandledrejection=e=>{throw e.reason||e};function i(e){try{if(e.data.cmd==="load"){let r=[];self.onmessage=t=>r.push(t),self.startWorker=t=>{a=t,postMessage({cmd:"loaded"});for(let n of r)i(n);self.onmessage=i},a.wasmModule=e.data.wasmModule;for(const t of e.data.handlers)a[t]=(...n)=>{postMessage({cmd:"callHandler",handler:t,args:n})};if(a.wasmMemory=e.data.wasmMemory,a.buffer=a.wasmMemory.buffer,a.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var s=URL.createObjectURL(e.data.urlOrBlob);importScripts(s),URL.revokeObjectURL(s)}getUsdModule(a)}else if(e.data.cmd==="run"){a.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),a.__emscripten_thread_mailbox_await(e.data.pthread_ptr),a.establishStackSpace(),a.PThread.receiveObjectTransfer(e.data),a.PThread.threadInitTLS(),o||(a.__embind_initialize_bindings(),o=!0);try{a.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(r){if(r!="unwind")throw r}}else e.data.cmd==="cancel"?a._pthread_self()&&a.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?o&&a.checkMailbox():e.data.cmd&&(f(`worker.js received unknown command ${e.data.cmd}`),f(e.data)))}catch(r){throw a.__emscripten_thread_crashed&&a.__emscripten_thread_crashed(),r}}self.onmessage=i})(); diff --git a/web/threeVisualizer/assets/emHdBindings.worker-t1x5VIsg.js b/web/threeVisualizer/assets/emHdBindings.worker-t1x5VIsg.js new file mode 100644 index 0000000..fe74632 --- /dev/null +++ b/web/threeVisualizer/assets/emHdBindings.worker-t1x5VIsg.js @@ -0,0 +1 @@ +const e="/extensions/ComfyUI-Rodin/threeVisualizer/assets/emHdBindings.worker-DUEm-236.js";export{e as default}; diff --git a/web/threeVisualizer/assets/index-CCfjSMW2.js b/web/threeVisualizer/assets/index-CCfjSMW2.js new file mode 100644 index 0000000..40f8cde --- /dev/null +++ b/web/threeVisualizer/assets/index-CCfjSMW2.js @@ -0,0 +1,4254 @@ +var KP=Object.defineProperty;var ZP=(n,e,t)=>e in n?KP(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var QP=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Ve=(n,e,t)=>ZP(n,typeof e!="symbol"?e+"":e,t);var r8=QP((_T,xg)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();var YS={exports:{}},Sh={},$S={exports:{}},Dt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bc=Symbol.for("react.element"),JP=Symbol.for("react.portal"),e2=Symbol.for("react.fragment"),t2=Symbol.for("react.strict_mode"),n2=Symbol.for("react.profiler"),i2=Symbol.for("react.provider"),r2=Symbol.for("react.context"),s2=Symbol.for("react.forward_ref"),a2=Symbol.for("react.suspense"),o2=Symbol.for("react.memo"),l2=Symbol.for("react.lazy"),Vb=Symbol.iterator;function c2(n){return n===null||typeof n!="object"?null:(n=Vb&&n[Vb]||n["@@iterator"],typeof n=="function"?n:null)}var qS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},KS=Object.assign,ZS={};function al(n,e,t){this.props=n,this.context=e,this.refs=ZS,this.updater=t||qS}al.prototype.isReactComponent={};al.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};al.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function QS(){}QS.prototype=al.prototype;function wg(n,e,t){this.props=n,this.context=e,this.refs=ZS,this.updater=t||qS}var Sg=wg.prototype=new QS;Sg.constructor=wg;KS(Sg,al.prototype);Sg.isPureReactComponent=!0;var Wb=Array.isArray,JS=Object.prototype.hasOwnProperty,Mg={current:null},eM={key:!0,ref:!0,__self:!0,__source:!0};function tM(n,e,t){var i,r={},s=null,a=null;if(e!=null)for(i in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)JS.call(e,i)&&!eM.hasOwnProperty(i)&&(r[i]=e[i]);var l=arguments.length-2;if(l===1)r.children=t;else if(1>>1,Pe=Y[Ae];if(0>>1;Aer(ge,_e))cer(Me,ge)?(Y[Ae]=Me,Y[ce]=_e,Ae=ce):(Y[Ae]=ge,Y[ae]=_e,Ae=ae);else if(cer(Me,_e))Y[Ae]=Me,Y[ce]=_e,Ae=ce;else break e}}return pe}function r(Y,pe){var _e=Y.sortIndex-pe.sortIndex;return _e!==0?_e:Y.id-pe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();n.unstable_now=function(){return a.now()-l}}var d=[],h=[],m=1,u=null,g=3,v=!1,w=!1,T=!1,M=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(Y){for(var pe=t(h);pe!==null;){if(pe.callback===null)i(h);else if(pe.startTime<=Y)i(h),pe.sortIndex=pe.expirationTime,e(d,pe);else break;pe=t(h)}}function P(Y){if(T=!1,E(Y),!w)if(t(d)!==null)w=!0,$(G);else{var pe=t(h);pe!==null&&ue(P,pe.startTime-Y)}}function G(Y,pe){w=!1,T&&(T=!1,b(F),F=-1),v=!0;var _e=g;try{for(E(pe),u=t(d);u!==null&&(!(u.expirationTime>pe)||Y&&!V());){var Ae=u.callback;if(typeof Ae=="function"){u.callback=null,g=u.priorityLevel;var Pe=Ae(u.expirationTime<=pe);pe=n.unstable_now(),typeof Pe=="function"?u.callback=Pe:u===t(d)&&i(d),E(pe)}else i(d);u=t(d)}if(u!==null)var Ue=!0;else{var ae=t(h);ae!==null&&ue(P,ae.startTime-pe),Ue=!1}return Ue}finally{u=null,g=_e,v=!1}}var O=!1,B=null,F=-1,D=5,L=-1;function V(){return!(n.unstable_now()-LY||125Ae?(Y.sortIndex=_e,e(h,Y),t(d)===null&&Y===t(h)&&(T?(b(F),F=-1):T=!0,ue(P,_e-Ae))):(Y.sortIndex=Pe,e(d,Y),w||v||(w=!0,$(G))),Y},n.unstable_shouldYield=V,n.unstable_wrapCallback=function(Y){var pe=g;return function(){var _e=g;g=pe;try{return Y.apply(this,arguments)}finally{g=_e}}}})(aM);sM.exports=aM;var b2=sM.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var x2=Xn,$i=b2;function Be(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Np=Object.prototype.hasOwnProperty,w2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Xb={},Yb={};function S2(n){return Np.call(Yb,n)?!0:Np.call(Xb,n)?!1:w2.test(n)?Yb[n]=!0:(Xb[n]=!0,!1)}function M2(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function E2(n,e,t,i){if(e===null||typeof e>"u"||M2(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ai(n,e,t,i,r,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){ai[n]=new Ai(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];ai[e]=new Ai(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){ai[n]=new Ai(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){ai[n]=new Ai(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){ai[n]=new Ai(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){ai[n]=new Ai(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){ai[n]=new Ai(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){ai[n]=new Ai(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){ai[n]=new Ai(n,5,!1,n.toLowerCase(),null,!1,!1)});var Tg=/[\-:]([a-z])/g;function Ag(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){ai[n]=new Ai(n,1,!1,n.toLowerCase(),null,!1,!1)});ai.xlinkHref=new Ai("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){ai[n]=new Ai(n,1,!1,n.toLowerCase(),null,!0,!0)});function Cg(n,e,t,i){var r=ai.hasOwnProperty(e)?ai[e]:null;(r!==null?r.type!==0:i||!(2l||r[a]!==s[l]){var d=` +`+r[a].replace(" at new "," at ");return n.displayName&&d.includes("")&&(d=d.replace("",n.displayName)),d}while(1<=a&&0<=l);break}}}finally{wf=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?jl(n):""}function T2(n){switch(n.tag){case 5:return jl(n.type);case 16:return jl("Lazy");case 13:return jl("Suspense");case 19:return jl("SuspenseList");case 0:case 2:case 15:return n=Sf(n.type,!1),n;case 11:return n=Sf(n.type.render,!1),n;case 1:return n=Sf(n.type,!0),n;default:return""}}function Gp(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case po:return"Fragment";case fo:return"Portal";case Bp:return"Profiler";case Rg:return"StrictMode";case zp:return"Suspense";case Hp:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case cM:return(n.displayName||"Context")+".Consumer";case lM:return(n._context.displayName||"Context")+".Provider";case Pg:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Lg:return e=n.displayName||null,e!==null?e:Gp(n.type)||"Memo";case Ds:e=n._payload,n=n._init;try{return Gp(n(e))}catch{}}return null}function A2(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gp(e);case 8:return e===Rg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function qs(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dM(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function C2(n){var e=dM(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){i=""+a,s.call(this,a)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(a){i=""+a},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function vu(n){n._valueTracker||(n._valueTracker=C2(n))}function hM(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=dM(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Bd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Vp(n,e){var t=e.checked;return Cn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function qb(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=qs(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function fM(n,e){e=e.checked,e!=null&&Cg(n,"checked",e,!1)}function Wp(n,e){fM(n,e);var t=qs(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?jp(n,e.type,t):e.hasOwnProperty("defaultValue")&&jp(n,e.type,qs(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Kb(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function jp(n,e,t){(e!=="number"||Bd(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Xl=Array.isArray;function Io(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=yu.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function pc(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var ec={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},R2=["Webkit","ms","Moz","O"];Object.keys(ec).forEach(function(n){R2.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),ec[e]=ec[n]})});function _M(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||ec.hasOwnProperty(n)&&ec[n]?(""+e).trim():e+"px"}function vM(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=_M(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var P2=Cn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $p(n,e){if(e){if(P2[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Be(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Be(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Be(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Be(62))}}function qp(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Kp=null;function Ig(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zp=null,Do=null,ko=null;function Jb(n){if(n=Gc(n)){if(typeof Zp!="function")throw Error(Be(280));var e=n.stateNode;e&&(e=Ch(e),Zp(n.stateNode,n.type,e))}}function yM(n){Do?ko?ko.push(n):ko=[n]:Do=n}function bM(){if(Do){var n=Do,e=ko;if(ko=Do=null,Jb(n),e)for(n=0;n>>=0,n===0?32:31-(H2(n)/G2|0)|0}var bu=64,xu=4194304;function Yl(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Vd(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,a=t&268435455;if(a!==0){var l=a&~r;l!==0?i=Yl(l):(s&=a,s!==0&&(i=Yl(s)))}else a=t&~r,a!==0?i=Yl(a):s!==0&&(i=Yl(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function zc(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Tr(e),n[e]=t}function X2(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=nc),lx=" ",cx=!1;function zM(n,e){switch(n){case"keyup":return bL.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function HM(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var mo=!1;function wL(n,e){switch(n){case"compositionend":return HM(e);case"keypress":return e.which!==32?null:(cx=!0,lx);case"textInput":return n=e.data,n===lx&&cx?null:n;default:return null}}function SL(n,e){if(mo)return n==="compositionend"||!zg&&zM(n,e)?(n=NM(),bd=Og=Os=null,mo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=fx(t)}}function jM(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?jM(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function XM(){for(var n=window,e=Bd();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Bd(n.document)}return e}function Hg(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function IL(n){var e=XM(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&jM(t.ownerDocument.documentElement,t)){if(i!==null&&Hg(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=px(t,s);var a=px(t,i);r&&a&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==a.node||n.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,go=null,im=null,rc=null,rm=!1;function mx(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;rm||go==null||go!==Bd(i)||(i=go,"selectionStart"in i&&Hg(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),rc&&bc(rc,i)||(rc=i,i=Xd(im,"onSelect"),0yo||(n.current=um[yo],um[yo]=null,yo--)}function cn(n,e){yo++,um[yo]=n.current,n.current=e}var Ks={},vi=ea(Ks),Ui=ea(!1),Ca=Ks;function Xo(n,e){var t=n.type.contextTypes;if(!t)return Ks;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Oi(n){return n=n.childContextTypes,n!=null}function $d(){gn(Ui),gn(vi)}function wx(n,e,t){if(vi.current!==Ks)throw Error(Be(168));cn(vi,e),cn(Ui,t)}function t1(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Be(108,A2(n)||"Unknown",r));return Cn({},t,i)}function qd(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ks,Ca=vi.current,cn(vi,n),cn(Ui,Ui.current),!0}function Sx(n,e,t){var i=n.stateNode;if(!i)throw Error(Be(169));t?(n=t1(n,e,Ca),i.__reactInternalMemoizedMergedChildContext=n,gn(Ui),gn(vi),cn(vi,n)):gn(Ui),cn(Ui,t)}var rs=null,Rh=!1,Of=!1;function n1(n){rs===null?rs=[n]:rs.push(n)}function WL(n){Rh=!0,n1(n)}function ta(){if(!Of&&rs!==null){Of=!0;var n=0,e=rn;try{var t=rs;for(rn=1;n>=a,r-=a,os=1<<32-Tr(e)+r|t<F?(D=B,B=null):D=B.sibling;var L=g(b,B,E[F],P);if(L===null){B===null&&(B=D);break}n&&B&&L.alternate===null&&e(b,B),A=s(L,A,F),O===null?G=L:O.sibling=L,O=L,B=D}if(F===E.length)return t(b,B),xn&&pa(b,F),G;if(B===null){for(;FF?(D=B,B=null):D=B.sibling;var V=g(b,B,L.value,P);if(V===null){B===null&&(B=D);break}n&&B&&V.alternate===null&&e(b,B),A=s(V,A,F),O===null?G=V:O.sibling=V,O=V,B=D}if(L.done)return t(b,B),xn&&pa(b,F),G;if(B===null){for(;!L.done;F++,L=E.next())L=u(b,L.value,P),L!==null&&(A=s(L,A,F),O===null?G=L:O.sibling=L,O=L);return xn&&pa(b,F),G}for(B=i(b,B);!L.done;F++,L=E.next())L=v(B,b,F,L.value,P),L!==null&&(n&&L.alternate!==null&&B.delete(L.key===null?F:L.key),A=s(L,A,F),O===null?G=L:O.sibling=L,O=L);return n&&B.forEach(function(ie){return e(b,ie)}),xn&&pa(b,F),G}function M(b,A,E,P){if(typeof E=="object"&&E!==null&&E.type===po&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case _u:e:{for(var G=E.key,O=A;O!==null;){if(O.key===G){if(G=E.type,G===po){if(O.tag===7){t(b,O.sibling),A=r(O,E.props.children),A.return=b,b=A;break e}}else if(O.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ds&&Tx(G)===O.type){t(b,O.sibling),A=r(O,E.props),A.ref=Ll(b,O,E),A.return=b,b=A;break e}t(b,O);break}else e(b,O);O=O.sibling}E.type===po?(A=Ta(E.props.children,b.mode,P,E.key),A.return=b,b=A):(P=Cd(E.type,E.key,E.props,null,b.mode,P),P.ref=Ll(b,A,E),P.return=b,b=P)}return a(b);case fo:e:{for(O=E.key;A!==null;){if(A.key===O)if(A.tag===4&&A.stateNode.containerInfo===E.containerInfo&&A.stateNode.implementation===E.implementation){t(b,A.sibling),A=r(A,E.children||[]),A.return=b,b=A;break e}else{t(b,A);break}else e(b,A);A=A.sibling}A=jf(E,b.mode,P),A.return=b,b=A}return a(b);case Ds:return O=E._init,M(b,A,O(E._payload),P)}if(Xl(E))return w(b,A,E,P);if(Tl(E))return T(b,A,E,P);Cu(b,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,A!==null&&A.tag===6?(t(b,A.sibling),A=r(A,E),A.return=b,b=A):(t(b,A),A=Wf(E,b.mode,P),A.return=b,b=A),a(b)):t(b,A)}return M}var $o=a1(!0),o1=a1(!1),Qd=ea(null),Jd=null,wo=null,jg=null;function Xg(){jg=wo=Jd=null}function Yg(n){var e=Qd.current;gn(Qd),n._currentValue=e}function fm(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Uo(n,e){Jd=n,jg=wo=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Fi=!0),n.firstContext=null)}function dr(n){var e=n._currentValue;if(jg!==n)if(n={context:n,memoizedValue:e,next:null},wo===null){if(Jd===null)throw Error(Be(308));wo=n,Jd.dependencies={lanes:0,firstContext:n}}else wo=wo.next=n;return e}var Sa=null;function $g(n){Sa===null?Sa=[n]:Sa.push(n)}function l1(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,$g(e)):(t.next=r.next,r.next=t),e.interleaved=t,ps(n,i)}function ps(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ks=!1;function qg(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function c1(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function ds(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Ws(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,qt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ps(n,t)}return r=i.interleaved,r===null?(e.next=e,$g(i)):(e.next=r.next,r.next=e),i.interleaved=e,ps(n,t)}function wd(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,kg(n,t)}}function Ax(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=a:s=s.next=a,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function eh(n,e,t,i){var r=n.updateQueue;ks=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var d=l,h=d.next;d.next=null,a===null?s=h:a.next=h,a=d;var m=n.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==a&&(l===null?m.firstBaseUpdate=h:l.next=h,m.lastBaseUpdate=d))}if(s!==null){var u=r.baseState;a=0,m=h=d=null,l=s;do{var g=l.lane,v=l.eventTime;if((i&g)===g){m!==null&&(m=m.next={eventTime:v,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var w=n,T=l;switch(g=e,v=t,T.tag){case 1:if(w=T.payload,typeof w=="function"){u=w.call(v,u,g);break e}u=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=T.payload,g=typeof w=="function"?w.call(v,u,g):w,g==null)break e;u=Cn({},u,g);break e;case 2:ks=!0}}l.callback!==null&&l.lane!==0&&(n.flags|=64,g=r.effects,g===null?r.effects=[l]:g.push(l))}else v={eventTime:v,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(h=m=v,d=u):m=m.next=v,a|=g;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;g=l,l=g.next,g.next=null,r.lastBaseUpdate=g,r.shared.pending=null}}while(!0);if(m===null&&(d=u),r.baseState=d,r.firstBaseUpdate=h,r.lastBaseUpdate=m,e=r.shared.interleaved,e!==null){r=e;do a|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);La|=a,n.lanes=a,n.memoizedState=u}}function Cx(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=Bf.transition;Bf.transition={};try{n(!1),e()}finally{rn=t,Bf.transition=i}}function T1(){return hr().memoizedState}function $L(n,e,t){var i=Xs(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},A1(n))C1(e,t);else if(t=l1(n,e,t,i),t!==null){var r=Mi();Ar(t,n,i,r),R1(t,e,i)}}function qL(n,e,t){var i=Xs(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(A1(n))C1(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,l=s(a,t);if(r.hasEagerState=!0,r.eagerState=l,Rr(l,a)){var d=e.interleaved;d===null?(r.next=r,$g(e)):(r.next=d.next,d.next=r),e.interleaved=r;return}}catch{}finally{}t=l1(n,e,r,i),t!==null&&(r=Mi(),Ar(t,n,i,r),R1(t,e,i))}}function A1(n){var e=n.alternate;return n===An||e!==null&&e===An}function C1(n,e){sc=nh=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function R1(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,kg(n,t)}}var ih={readContext:dr,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},KL={readContext:dr,useCallback:function(n,e){return kr().memoizedState=[n,e===void 0?null:e],n},useContext:dr,useEffect:Px,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Md(4194308,4,x1.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Md(4194308,4,n,e)},useInsertionEffect:function(n,e){return Md(4,2,n,e)},useMemo:function(n,e){var t=kr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=kr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=$L.bind(null,An,n),[i.memoizedState,n]},useRef:function(n){var e=kr();return n={current:n},e.memoizedState=n},useState:Rx,useDebugValue:i_,useDeferredValue:function(n){return kr().memoizedState=n},useTransition:function(){var n=Rx(!1),e=n[0];return n=YL.bind(null,n[1]),kr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=An,r=kr();if(xn){if(t===void 0)throw Error(Be(407));t=t()}else{if(t=e(),ni===null)throw Error(Be(349));Pa&30||f1(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Px(m1.bind(null,i,s,n),[n]),i.flags|=2048,Cc(9,p1.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=kr(),e=ni.identifierPrefix;if(xn){var t=ls,i=os;t=(i&~(1<<32-Tr(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Tc++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=a.createElement(t,{is:i.is}):(n=a.createElement(t),t==="select"&&(a=n,i.multiple?a.multiple=!0:i.size&&(a.size=i.size))):n=a.createElementNS(n,t),n[Fr]=e,n[Sc]=i,B1(n,e,!1,!1),e.stateNode=n;e:{switch(a=qp(t,i),t){case"dialog":fn("cancel",n),fn("close",n),r=i;break;case"iframe":case"object":case"embed":fn("load",n),r=i;break;case"video":case"audio":for(r=0;r<$l.length;r++)fn($l[r],n);r=i;break;case"source":fn("error",n),r=i;break;case"img":case"image":case"link":fn("error",n),fn("load",n),r=i;break;case"details":fn("toggle",n),r=i;break;case"input":qb(n,i),r=Vp(n,i),fn("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Cn({},i,{value:void 0}),fn("invalid",n);break;case"textarea":Zb(n,i),r=Xp(n,i),fn("invalid",n);break;default:r=i}$p(t,r),l=r;for(s in l)if(l.hasOwnProperty(s)){var d=l[s];s==="style"?vM(n,d):s==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,d!=null&&gM(n,d)):s==="children"?typeof d=="string"?(t!=="textarea"||d!=="")&&pc(n,d):typeof d=="number"&&pc(n,""+d):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(fc.hasOwnProperty(s)?d!=null&&s==="onScroll"&&fn("scroll",n):d!=null&&Cg(n,s,d,a))}switch(t){case"input":vu(n),Kb(n,i,!1);break;case"textarea":vu(n),Qb(n);break;case"option":i.value!=null&&n.setAttribute("value",""+qs(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?Io(n,!!i.multiple,s,!1):i.defaultValue!=null&&Io(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=Yd)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return di(e),null;case 6:if(n&&e.stateNode!=null)H1(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(Be(166));if(t=Ma(Ec.current),Ma(Hr.current),Au(e)){if(i=e.stateNode,t=e.memoizedProps,i[Fr]=e,(s=i.nodeValue!==t)&&(n=Yi,n!==null))switch(n.tag){case 3:Tu(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Tu(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Fr]=e,e.stateNode=i}return di(e),null;case 13:if(gn(En),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xn&&Xi!==null&&e.mode&1&&!(e.flags&128))s1(),Yo(),e.flags|=98560,s=!1;else if(s=Au(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(Be(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Be(317));s[Fr]=e}else Yo(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;di(e),s=!1}else Sr!==null&&(Rm(Sr),Sr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||En.current&1?$n===0&&($n=3):u_())),e.updateQueue!==null&&(e.flags|=4),di(e),null);case 4:return qo(),xm(n,e),n===null&&xc(e.stateNode.containerInfo),di(e),null;case 10:return Yg(e.type._context),di(e),null;case 17:return Oi(e.type)&&$d(),di(e),null;case 19:if(gn(En),s=e.memoizedState,s===null)return di(e),null;if(i=(e.flags&128)!==0,a=s.rendering,a===null)if(i)Il(s,!1);else{if($n!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(a=th(n),a!==null){for(e.flags|=128,Il(s,!1),i=a.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,n=a.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return cn(En,En.current&1|2),e.child}n=n.sibling}s.tail!==null&&kn()>Zo&&(e.flags|=128,i=!0,Il(s,!1),e.lanes=4194304)}else{if(!i)if(n=th(a),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Il(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!xn)return di(e),null}else 2*kn()-s.renderingStartTime>Zo&&t!==1073741824&&(e.flags|=128,i=!0,Il(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(t=s.last,t!==null?t.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=kn(),e.sibling=null,t=En.current,cn(En,i?t&1|2:t&1),e):(di(e),null);case 22:case 23:return c_(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?ji&1073741824&&(di(e),e.subtreeFlags&6&&(e.flags|=8192)):di(e),null;case 24:return null;case 25:return null}throw Error(Be(156,e.tag))}function rI(n,e){switch(Vg(e),e.tag){case 1:return Oi(e.type)&&$d(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return qo(),gn(Ui),gn(vi),Qg(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Zg(e),null;case 13:if(gn(En),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Be(340));Yo()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gn(En),null;case 4:return qo(),null;case 10:return Yg(e.type._context),null;case 22:case 23:return c_(),null;case 24:return null;default:return null}}var Pu=!1,pi=!1,sI=typeof WeakSet=="function"?WeakSet:Set,st=null;function So(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Rn(n,e,i)}else t.current=null}function wm(n,e,t){try{t()}catch(i){Rn(n,e,i)}}var Hx=!1;function aI(n,e){if(sm=Wd,n=XM(),Hg(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var a=0,l=-1,d=-1,h=0,m=0,u=n,g=null;t:for(;;){for(var v;u!==t||r!==0&&u.nodeType!==3||(l=a+r),u!==s||i!==0&&u.nodeType!==3||(d=a+i),u.nodeType===3&&(a+=u.nodeValue.length),(v=u.firstChild)!==null;)g=u,u=v;for(;;){if(u===n)break t;if(g===t&&++h===r&&(l=a),g===s&&++m===i&&(d=a),(v=u.nextSibling)!==null)break;u=g,g=u.parentNode}u=v}t=l===-1||d===-1?null:{start:l,end:d}}else t=null}t=t||{start:0,end:0}}else t=null;for(am={focusedElem:n,selectionRange:t},Wd=!1,st=e;st!==null;)if(e=st,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,st=n;else for(;st!==null;){e=st;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var T=w.memoizedProps,M=w.memoizedState,b=e.stateNode,A=b.getSnapshotBeforeUpdate(e.elementType===e.type?T:br(e.type,T),M);b.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Be(163))}}catch(P){Rn(e,e.return,P)}if(n=e.sibling,n!==null){n.return=e.return,st=n;break}st=e.return}return w=Hx,Hx=!1,w}function ac(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&wm(e,t,s)}r=r.next}while(r!==i)}}function Ih(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function Sm(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function G1(n){var e=n.alternate;e!==null&&(n.alternate=null,G1(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Fr],delete e[Sc],delete e[cm],delete e[GL],delete e[VL])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function V1(n){return n.tag===5||n.tag===3||n.tag===4}function Gx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||V1(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Mm(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Yd));else if(i!==4&&(n=n.child,n!==null))for(Mm(n,e,t),n=n.sibling;n!==null;)Mm(n,e,t),n=n.sibling}function Em(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Em(n,e,t),n=n.sibling;n!==null;)Em(n,e,t),n=n.sibling}var ri=null,wr=!1;function ws(n,e,t){for(t=t.child;t!==null;)W1(n,e,t),t=t.sibling}function W1(n,e,t){if(zr&&typeof zr.onCommitFiberUnmount=="function")try{zr.onCommitFiberUnmount(Mh,t)}catch{}switch(t.tag){case 5:pi||So(t,e);case 6:var i=ri,r=wr;ri=null,ws(n,e,t),ri=i,wr=r,ri!==null&&(wr?(n=ri,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ri.removeChild(t.stateNode));break;case 18:ri!==null&&(wr?(n=ri,t=t.stateNode,n.nodeType===8?Uf(n.parentNode,t):n.nodeType===1&&Uf(n,t),vc(n)):Uf(ri,t.stateNode));break;case 4:i=ri,r=wr,ri=t.stateNode.containerInfo,wr=!0,ws(n,e,t),ri=i,wr=r;break;case 0:case 11:case 14:case 15:if(!pi&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&wm(t,e,a),r=r.next}while(r!==i)}ws(n,e,t);break;case 1:if(!pi&&(So(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(l){Rn(t,e,l)}ws(n,e,t);break;case 21:ws(n,e,t);break;case 22:t.mode&1?(pi=(i=pi)||t.memoizedState!==null,ws(n,e,t),pi=i):ws(n,e,t);break;default:ws(n,e,t)}}function Vx(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new sI),e.forEach(function(i){var r=mI.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function pr(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=a),i&=~s}if(i=r,i=kn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*lI(i/1960))-i,10n?16:n,Ns===null)var i=!1;else{if(n=Ns,Ns=null,ah=0,qt&6)throw Error(Be(331));var r=qt;for(qt|=4,st=n.current;st!==null;){var s=st,a=s.child;if(st.flags&16){var l=s.deletions;if(l!==null){for(var d=0;dkn()-o_?Ea(n,0):a_|=t),Ni(n,e)}function Q1(n,e){e===0&&(n.mode&1?(e=xu,xu<<=1,!(xu&130023424)&&(xu=4194304)):e=1);var t=Mi();n=ps(n,e),n!==null&&(zc(n,e,t),Ni(n,t))}function pI(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),Q1(n,t)}function mI(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Be(314))}i!==null&&i.delete(e),Q1(n,t)}var J1;J1=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ui.current)Fi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Fi=!1,nI(n,e,t);Fi=!!(n.flags&131072)}else Fi=!1,xn&&e.flags&1048576&&i1(e,Zd,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Ed(n,e),n=e.pendingProps;var r=Xo(e,vi.current);Uo(e,t),r=e_(null,e,i,n,r,t);var s=t_();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Oi(i)?(s=!0,qd(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,qg(e),r.updater=Lh,e.stateNode=r,r._reactInternals=e,mm(e,i,n,t),e=vm(null,e,i,!0,s,t)):(e.tag=0,xn&&s&&Gg(e),wi(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Ed(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=_I(i),n=br(i,n),r){case 0:e=_m(null,e,i,n,t);break e;case 1:e=Nx(null,e,i,n,t);break e;case 11:e=Ux(null,e,i,n,t);break e;case 14:e=Ox(null,e,i,br(i.type,n),t);break e}throw Error(Be(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),_m(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Nx(n,e,i,r,t);case 3:e:{if(U1(e),n===null)throw Error(Be(387));i=e.pendingProps,s=e.memoizedState,r=s.element,c1(n,e),eh(e,i,null,t);var a=e.memoizedState;if(i=a.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Ko(Error(Be(423)),e),e=Bx(n,e,i,t,r);break e}else if(i!==r){r=Ko(Error(Be(424)),e),e=Bx(n,e,i,t,r);break e}else for(Xi=Vs(e.stateNode.containerInfo.firstChild),Yi=e,xn=!0,Sr=null,t=o1(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Yo(),i===r){e=ms(n,e,t);break e}wi(n,e,i,t)}e=e.child}return e;case 5:return u1(e),n===null&&hm(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,a=r.children,om(i,r)?a=null:s!==null&&om(i,s)&&(e.flags|=32),F1(n,e),wi(n,e,a,t),e.child;case 6:return n===null&&hm(e),null;case 13:return O1(n,e,t);case 4:return Kg(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=$o(e,null,i,t):wi(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Ux(n,e,i,r,t);case 7:return wi(n,e,e.pendingProps,t),e.child;case 8:return wi(n,e,e.pendingProps.children,t),e.child;case 12:return wi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,a=r.value,cn(Qd,i._currentValue),i._currentValue=a,s!==null)if(Rr(s.value,a)){if(s.children===r.children&&!Ui.current){e=ms(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var d=l.firstContext;d!==null;){if(d.context===i){if(s.tag===1){d=ds(-1,t&-t),d.tag=2;var h=s.updateQueue;if(h!==null){h=h.shared;var m=h.pending;m===null?d.next=d:(d.next=m.next,m.next=d),h.pending=d}}s.lanes|=t,d=s.alternate,d!==null&&(d.lanes|=t),fm(s.return,t,e),l.lanes|=t;break}d=d.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Be(341));a.lanes|=t,l=a.alternate,l!==null&&(l.lanes|=t),fm(a,t,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}wi(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Uo(e,t),r=dr(r),i=i(r),e.flags|=1,wi(n,e,i,t),e.child;case 14:return i=e.type,r=br(i,e.pendingProps),r=br(i.type,r),Ox(n,e,i,r,t);case 15:return D1(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Ed(n,e),e.tag=1,Oi(i)?(n=!0,qd(e)):n=!1,Uo(e,t),P1(e,i,r),mm(e,i,r,t),vm(null,e,i,!0,n,t);case 19:return N1(n,e,t);case 22:return k1(n,e,t)}throw Error(Be(156,e.tag))};function eE(n,e){return AM(n,e)}function gI(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(n,e,t,i){return new gI(n,e,t,i)}function d_(n){return n=n.prototype,!(!n||!n.isReactComponent)}function _I(n){if(typeof n=="function")return d_(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Pg)return 11;if(n===Lg)return 14}return 2}function Ys(n,e){var t=n.alternate;return t===null?(t=lr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Cd(n,e,t,i,r,s){var a=2;if(i=n,typeof n=="function")d_(n)&&(a=1);else if(typeof n=="string")a=5;else e:switch(n){case po:return Ta(t.children,r,s,e);case Rg:a=8,r|=8;break;case Bp:return n=lr(12,t,e,r|2),n.elementType=Bp,n.lanes=s,n;case zp:return n=lr(13,t,e,r),n.elementType=zp,n.lanes=s,n;case Hp:return n=lr(19,t,e,r),n.elementType=Hp,n.lanes=s,n;case uM:return kh(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case lM:a=10;break e;case cM:a=9;break e;case Pg:a=11;break e;case Lg:a=14;break e;case Ds:a=16,i=null;break e}throw Error(Be(130,n==null?n:typeof n,""))}return e=lr(a,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function Ta(n,e,t,i){return n=lr(7,n,i,e),n.lanes=t,n}function kh(n,e,t,i){return n=lr(22,n,i,e),n.elementType=uM,n.lanes=t,n.stateNode={isHidden:!1},n}function Wf(n,e,t){return n=lr(6,n,null,e),n.lanes=t,n}function jf(n,e,t){return e=lr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function vI(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ef(0),this.expirationTimes=Ef(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ef(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function h_(n,e,t,i,r,s,a,l,d){return n=new vI(n,e,t,l,d),e===1?(e=1,s===!0&&(e|=8)):e=0,s=lr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},qg(s),n}function yI(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rE)}catch(n){console.error(n)}}rE(),rM.exports=Ki;var MI=rM.exports,sE,Zx=MI;sE=Zx.createRoot,Zx.hydrateRoot;/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const g_="166",EI=0,Qx=1,TI=2,aE=1,oE=2,ts=3,gs=0,Ei=1,Si=2,Gr=0,No=1,ch=2,Jx=3,ew=4,AI=5,ya=100,CI=101,RI=102,PI=103,LI=104,II=200,DI=201,kI=202,FI=203,Pm=204,Lm=205,UI=206,OI=207,NI=208,BI=209,zI=210,HI=211,GI=212,VI=213,WI=214,jI=0,XI=1,YI=2,uh=3,$I=4,qI=5,KI=6,ZI=7,Bh=0,QI=1,JI=2,$s=0,lE=1,eD=2,tD=3,nD=4,iD=5,rD=6,sD=7,tw="attached",aD="detached",__=300,Qo=301,Jo=302,el=303,Im=304,zh=306,Vr=1e3,ti=1001,dh=1002,Fn=1003,cE=1004,ql=1005,ln=1006,Rd=1007,Er=1008,nw=1008,Bi=1009,uE=1010,dE=1011,Pc=1012,v_=1013,Da=1014,Un=1015,gi=1016,y_=1017,b_=1018,tl=1020,hE=35902,fE=1021,pE=1022,Vn=1023,mE=1024,gE=1025,Bo=1026,nl=1027,Wc=1028,x_=1029,_E=1030,w_=1031,S_=1033,Pd=33776,Ld=33777,Id=33778,Dd=33779,Dm=35840,km=35841,Fm=35842,Um=35843,Om=36196,Nm=37492,Bm=37496,zm=37808,Hm=37809,Gm=37810,Vm=37811,Wm=37812,jm=37813,Xm=37814,Ym=37815,$m=37816,qm=37817,Km=37818,Zm=37819,Qm=37820,Jm=37821,kd=36492,eg=36494,tg=36495,vE=36283,ng=36284,ig=36285,rg=36286,Lc=2300,Ic=2301,Xf=2302,iw=2400,rw=2401,sw=2402,oD=2500,lD=0,yE=1,sg=2,cD=3200,uD=3201,cl=0,dD=1,ss="",on="srgb",Sn="srgb-linear",M_="display-p3",Hh="display-p3-linear",hh="linear",pn="srgb",fh="rec709",ph="p3",ja=7680,aw=519,hD=512,fD=513,pD=514,bE=515,mD=516,gD=517,_D=518,vD=519,ag=35044,ow="300 es",cs=2e3,mh=2001;class ul{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s>8&255]+hi[n>>16&255]+hi[n>>24&255]+"-"+hi[e&255]+hi[e>>8&255]+"-"+hi[e>>16&15|64]+hi[e>>24&255]+"-"+hi[t&63|128]+hi[t>>8&255]+"-"+hi[t>>16&255]+hi[t>>24&255]+hi[i&255]+hi[i>>8&255]+hi[i>>16&255]+hi[i>>24&255]).toLowerCase()}function Wn(n,e,t){return Math.max(e,Math.min(t,n))}function E_(n,e){return(n%e+e)%e}function yD(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function bD(n,e,t){return n!==e?(t-n)/(e-n):0}function uc(n,e,t){return(1-t)*n+t*e}function xD(n,e,t,i){return uc(n,e,1-Math.exp(-t*i))}function wD(n,e=1){return e-Math.abs(E_(n,e*2)-e)}function SD(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function MD(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function ED(n,e){return n+Math.floor(Math.random()*(e-n+1))}function TD(n,e){return n+Math.random()*(e-n)}function AD(n){return n*(.5-Math.random())}function CD(n){n!==void 0&&(lw=n);let e=lw+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function RD(n){return n*cc}function PD(n){return n*il}function LD(n){return(n&n-1)===0&&n!==0}function ID(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function DD(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function kD(n,e,t,i,r){const s=Math.cos,a=Math.sin,l=s(t/2),d=a(t/2),h=s((e+i)/2),m=a((e+i)/2),u=s((e-i)/2),g=a((e-i)/2),v=s((i-e)/2),w=a((i-e)/2);switch(r){case"XYX":n.set(l*m,d*u,d*g,l*h);break;case"YZY":n.set(d*g,l*m,d*u,l*h);break;case"ZXZ":n.set(d*u,d*g,l*m,l*h);break;case"XZX":n.set(l*m,d*w,d*v,l*h);break;case"YXY":n.set(d*v,l*m,d*w,l*h);break;case"ZYZ":n.set(d*w,d*v,l*m,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Mr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function tn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const bn={DEG2RAD:cc,RAD2DEG:il,generateUUID:Cr,clamp:Wn,euclideanModulo:E_,mapLinear:yD,inverseLerp:bD,lerp:uc,damp:xD,pingpong:wD,smoothstep:SD,smootherstep:MD,randInt:ED,randFloat:TD,randFloatSpread:AD,seededRandom:CD,degToRad:RD,radToDeg:PD,isPowerOfTwo:LD,ceilPowerOfTwo:ID,floorPowerOfTwo:DD,setQuaternionFromProperEuler:kD,normalize:tn,denormalize:Mr};class et{constructor(e=0,t=0){et.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Wn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class At{constructor(e,t,i,r,s,a,l,d,h){At.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,l,d,h)}set(e,t,i,r,s,a,l,d,h){const m=this.elements;return m[0]=e,m[1]=r,m[2]=l,m[3]=t,m[4]=s,m[5]=d,m[6]=i,m[7]=a,m[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],l=i[3],d=i[6],h=i[1],m=i[4],u=i[7],g=i[2],v=i[5],w=i[8],T=r[0],M=r[3],b=r[6],A=r[1],E=r[4],P=r[7],G=r[2],O=r[5],B=r[8];return s[0]=a*T+l*A+d*G,s[3]=a*M+l*E+d*O,s[6]=a*b+l*P+d*B,s[1]=h*T+m*A+u*G,s[4]=h*M+m*E+u*O,s[7]=h*b+m*P+u*B,s[2]=g*T+v*A+w*G,s[5]=g*M+v*E+w*O,s[8]=g*b+v*P+w*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8];return t*a*m-t*l*h-i*s*m+i*l*d+r*s*h-r*a*d}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8],u=m*a-l*h,g=l*d-m*s,v=h*s-a*d,w=t*u+i*g+r*v;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=u*T,e[1]=(r*h-m*i)*T,e[2]=(l*i-r*a)*T,e[3]=g*T,e[4]=(m*t-r*d)*T,e[5]=(r*s-l*t)*T,e[6]=v*T,e[7]=(i*d-h*t)*T,e[8]=(a*t-i*s)*T,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,l){const d=Math.cos(s),h=Math.sin(s);return this.set(i*d,i*h,-i*(d*a+h*l)+a+e,-r*h,r*d,-r*(-h*a+d*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Yf.makeScale(e,t)),this}rotate(e){return this.premultiply(Yf.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yf=new At;function xE(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Dc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function FD(){const n=Dc("canvas");return n.style.display="block",n}const cw={};function T_(n){n in cw||(cw[n]=!0,console.warn(n))}function UD(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const uw=new At().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),dw=new At().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Du={[Sn]:{transfer:hh,primaries:fh,toReference:n=>n,fromReference:n=>n},[on]:{transfer:pn,primaries:fh,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Hh]:{transfer:hh,primaries:ph,toReference:n=>n.applyMatrix3(dw),fromReference:n=>n.applyMatrix3(uw)},[M_]:{transfer:pn,primaries:ph,toReference:n=>n.convertSRGBToLinear().applyMatrix3(dw),fromReference:n=>n.applyMatrix3(uw).convertLinearToSRGB()}},OD=new Set([Sn,Hh]),Kt={enabled:!0,_workingColorSpace:Sn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!OD.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Du[e].toReference,r=Du[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Du[n].primaries},getTransfer:function(n){return n===ss?hh:Du[n].transfer}};function zo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $f(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Xa;class ND{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Xa===void 0&&(Xa=Dc("canvas")),Xa.width=e.width,Xa.height=e.height;const i=Xa.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Xa}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Dc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==__)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Vr:e.x=e.x-Math.floor(e.x);break;case ti:e.x=e.x<0?0:1;break;case dh:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Vr:e.y=e.y-Math.floor(e.y);break;case ti:e.y=e.y<0?0:1;break;case dh:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qn.DEFAULT_IMAGE=null;qn.DEFAULT_MAPPING=__;qn.DEFAULT_ANISOTROPY=1;class $t{constructor(e=0,t=0,i=0,r=1){$t.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const d=e.elements,h=d[0],m=d[4],u=d[8],g=d[1],v=d[5],w=d[9],T=d[2],M=d[6],b=d[10];if(Math.abs(m-g)<.01&&Math.abs(u-T)<.01&&Math.abs(w-M)<.01){if(Math.abs(m+g)<.1&&Math.abs(u+T)<.1&&Math.abs(w+M)<.1&&Math.abs(h+v+b-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,P=(v+1)/2,G=(b+1)/2,O=(m+g)/4,B=(u+T)/4,F=(w+M)/4;return E>P&&E>G?E<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(E),r=O/i,s=B/i):P>G?P<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),i=O/r,s=F/r):G<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(G),i=B/s,r=F/s),this.set(i,r,s,t),this}let A=Math.sqrt((M-w)*(M-w)+(u-T)*(u-T)+(g-m)*(g-m));return Math.abs(A)<.001&&(A=1),this.x=(M-w)/A,this.y=(u-T)/A,this.z=(g-m)/A,this.w=Math.acos((h+v+b-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class HD extends ul{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new $t(0,0,e,t),this.scissorTest=!1,this.viewport=new $t(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ln,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new qn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const a=i.count;for(let l=0;l=0?1:-1,E=1-b*b;if(E>Number.EPSILON){const G=Math.sqrt(E),O=Math.atan2(G,b*A);M=Math.sin(M*O)/G,l=Math.sin(l*O)/G}const P=l*A;if(d=d*M+g*P,h=h*M+v*P,m=m*M+w*P,u=u*M+T*P,M===1-l){const G=1/Math.sqrt(d*d+h*h+m*m+u*u);d*=G,h*=G,m*=G,u*=G}}e[t]=d,e[t+1]=h,e[t+2]=m,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,a){const l=i[r],d=i[r+1],h=i[r+2],m=i[r+3],u=s[a],g=s[a+1],v=s[a+2],w=s[a+3];return e[t]=l*w+m*u+d*v-h*g,e[t+1]=d*w+m*g+h*u-l*v,e[t+2]=h*w+m*v+l*g-d*u,e[t+3]=m*w-l*u-d*g-h*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,d=Math.sin,h=l(i/2),m=l(r/2),u=l(s/2),g=d(i/2),v=d(r/2),w=d(s/2);switch(a){case"XYZ":this._x=g*m*u+h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u-g*v*w;break;case"YXZ":this._x=g*m*u+h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u+g*v*w;break;case"ZXY":this._x=g*m*u-h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u-g*v*w;break;case"ZYX":this._x=g*m*u-h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u+g*v*w;break;case"YZX":this._x=g*m*u+h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u-g*v*w;break;case"XZY":this._x=g*m*u-h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u+g*v*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],l=t[5],d=t[9],h=t[2],m=t[6],u=t[10],g=i+l+u;if(g>0){const v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(m-d)*v,this._y=(s-h)*v,this._z=(a-r)*v}else if(i>l&&i>u){const v=2*Math.sqrt(1+i-l-u);this._w=(m-d)/v,this._x=.25*v,this._y=(r+a)/v,this._z=(s+h)/v}else if(l>u){const v=2*Math.sqrt(1+l-i-u);this._w=(s-h)/v,this._x=(r+a)/v,this._y=.25*v,this._z=(d+m)/v}else{const v=2*Math.sqrt(1+u-i-l);this._w=(a-r)/v,this._x=(s+h)/v,this._y=(d+m)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Wn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,l=t._x,d=t._y,h=t._z,m=t._w;return this._x=i*m+a*l+r*h-s*d,this._y=r*m+a*d+s*l-i*h,this._z=s*m+a*h+i*d-r*l,this._w=a*m-i*l-r*d-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let l=a*e._w+i*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const d=1-l*l;if(d<=Number.EPSILON){const v=1-t;return this._w=v*a+t*this._w,this._x=v*i+t*this._x,this._y=v*r+t*this._y,this._z=v*s+t*this._z,this.normalize(),this}const h=Math.sqrt(d),m=Math.atan2(h,l),u=Math.sin((1-t)*m)/h,g=Math.sin(t*m)/h;return this._w=a*u+this._w*g,this._x=i*u+this._x*g,this._y=r*u+this._y*g,this._z=s*u+this._z*g,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,i=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(hw.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hw.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,l=e.z,d=e.w,h=2*(a*r-l*i),m=2*(l*t-s*r),u=2*(s*i-a*t);return this.x=t+d*h+a*u-l*m,this.y=i+d*m+l*h-s*u,this.z=r+d*u+s*m-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,l=t.y,d=t.z;return this.x=r*d-s*l,this.y=s*a-i*d,this.z=i*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Kf.copy(this).projectOnVector(e),this.sub(Kf)}reflect(e){return this.sub(Kf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Wn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Kf=new j,hw=new Gn;class Pr{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,mr),mr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(kl),Fu.subVectors(this.max,kl),Ya.subVectors(e.a,kl),$a.subVectors(e.b,kl),qa.subVectors(e.c,kl),Ss.subVectors($a,Ya),Ms.subVectors(qa,$a),oa.subVectors(Ya,qa);let t=[0,-Ss.z,Ss.y,0,-Ms.z,Ms.y,0,-oa.z,oa.y,Ss.z,0,-Ss.x,Ms.z,0,-Ms.x,oa.z,0,-oa.x,-Ss.y,Ss.x,0,-Ms.y,Ms.x,0,-oa.y,oa.x,0];return!Zf(t,Ya,$a,qa,Fu)||(t=[1,0,0,0,1,0,0,0,1],!Zf(t,Ya,$a,qa,Fu))?!1:(Uu.crossVectors(Ss,Ms),t=[Uu.x,Uu.y,Uu.z],Zf(t,Ya,$a,qa,Fu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(mr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const qr=[new j,new j,new j,new j,new j,new j,new j,new j],mr=new j,ku=new Pr,Ya=new j,$a=new j,qa=new j,Ss=new j,Ms=new j,oa=new j,kl=new j,Fu=new j,Uu=new j,la=new j;function Zf(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){la.fromArray(n,s);const l=r.x*Math.abs(la.x)+r.y*Math.abs(la.y)+r.z*Math.abs(la.z),d=e.dot(la),h=t.dot(la),m=i.dot(la);if(Math.max(-Math.max(d,h,m),Math.min(d,h,m))>l)return!1}return!0}const VD=new Pr,Fl=new j,Qf=new j;class Wr{constructor(e=new j,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):VD.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Fl.subVectors(e,this.center);const t=Fl.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Fl,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Qf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fl.copy(e.center).add(Qf)),this.expandByPoint(Fl.copy(e.center).sub(Qf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Kr=new j,Jf=new j,Ou=new j,Es=new j,ep=new j,Nu=new j,tp=new j;class jc{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Kr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Kr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kr.copy(this.origin).addScaledVector(this.direction,t),Kr.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Jf.copy(e).add(t).multiplyScalar(.5),Ou.copy(t).sub(e).normalize(),Es.copy(this.origin).sub(Jf);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ou),l=Es.dot(this.direction),d=-Es.dot(Ou),h=Es.lengthSq(),m=Math.abs(1-a*a);let u,g,v,w;if(m>0)if(u=a*d-l,g=a*l-d,w=s*m,u>=0)if(g>=-w)if(g<=w){const T=1/m;u*=T,g*=T,v=u*(u+a*g+2*l)+g*(a*u+g+2*d)+h}else g=s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;else g=-s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;else g<=-w?(u=Math.max(0,-(-a*s+l)),g=u>0?-s:Math.min(Math.max(-s,-d),s),v=-u*u+g*(g+2*d)+h):g<=w?(u=0,g=Math.min(Math.max(-s,-d),s),v=g*(g+2*d)+h):(u=Math.max(0,-(a*s+l)),g=u>0?s:Math.min(Math.max(-s,-d),s),v=-u*u+g*(g+2*d)+h);else g=a>0?-s:s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Jf).addScaledVector(Ou,g),v}intersectSphere(e,t){Kr.subVectors(e.center,this.origin);const i=Kr.dot(this.direction),r=Kr.dot(Kr)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=i-a,d=i+a;return d<0?null:l<0?this.at(d,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,l,d;const h=1/this.direction.x,m=1/this.direction.y,u=1/this.direction.z,g=this.origin;return h>=0?(i=(e.min.x-g.x)*h,r=(e.max.x-g.x)*h):(i=(e.max.x-g.x)*h,r=(e.min.x-g.x)*h),m>=0?(s=(e.min.y-g.y)*m,a=(e.max.y-g.y)*m):(s=(e.max.y-g.y)*m,a=(e.min.y-g.y)*m),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a=0?(l=(e.min.z-g.z)*u,d=(e.max.z-g.z)*u):(l=(e.max.z-g.z)*u,d=(e.min.z-g.z)*u),i>d||l>r)||((l>i||i!==i)&&(i=l),(d=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Kr)!==null}intersectTriangle(e,t,i,r,s){ep.subVectors(t,e),Nu.subVectors(i,e),tp.crossVectors(ep,Nu);let a=this.direction.dot(tp),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;Es.subVectors(this.origin,e);const d=l*this.direction.dot(Nu.crossVectors(Es,Nu));if(d<0)return null;const h=l*this.direction.dot(ep.cross(Es));if(h<0||d+h>a)return null;const m=-l*Es.dot(tp);return m<0?null:this.at(m/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ot{constructor(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M){ot.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M)}set(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M){const b=this.elements;return b[0]=e,b[4]=t,b[8]=i,b[12]=r,b[1]=s,b[5]=a,b[9]=l,b[13]=d,b[2]=h,b[6]=m,b[10]=u,b[14]=g,b[3]=v,b[7]=w,b[11]=T,b[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ot().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Ka.setFromMatrixColumn(e,0).length(),s=1/Ka.setFromMatrixColumn(e,1).length(),a=1/Ka.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),l=Math.sin(i),d=Math.cos(r),h=Math.sin(r),m=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const g=a*m,v=a*u,w=l*m,T=l*u;t[0]=d*m,t[4]=-d*u,t[8]=h,t[1]=v+w*h,t[5]=g-T*h,t[9]=-l*d,t[2]=T-g*h,t[6]=w+v*h,t[10]=a*d}else if(e.order==="YXZ"){const g=d*m,v=d*u,w=h*m,T=h*u;t[0]=g+T*l,t[4]=w*l-v,t[8]=a*h,t[1]=a*u,t[5]=a*m,t[9]=-l,t[2]=v*l-w,t[6]=T+g*l,t[10]=a*d}else if(e.order==="ZXY"){const g=d*m,v=d*u,w=h*m,T=h*u;t[0]=g-T*l,t[4]=-a*u,t[8]=w+v*l,t[1]=v+w*l,t[5]=a*m,t[9]=T-g*l,t[2]=-a*h,t[6]=l,t[10]=a*d}else if(e.order==="ZYX"){const g=a*m,v=a*u,w=l*m,T=l*u;t[0]=d*m,t[4]=w*h-v,t[8]=g*h+T,t[1]=d*u,t[5]=T*h+g,t[9]=v*h-w,t[2]=-h,t[6]=l*d,t[10]=a*d}else if(e.order==="YZX"){const g=a*d,v=a*h,w=l*d,T=l*h;t[0]=d*m,t[4]=T-g*u,t[8]=w*u+v,t[1]=u,t[5]=a*m,t[9]=-l*m,t[2]=-h*m,t[6]=v*u+w,t[10]=g-T*u}else if(e.order==="XZY"){const g=a*d,v=a*h,w=l*d,T=l*h;t[0]=d*m,t[4]=-u,t[8]=h*m,t[1]=g*u+T,t[5]=a*m,t[9]=v*u-w,t[2]=w*u-v,t[6]=l*m,t[10]=T*u+g}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(WD,e,jD)}lookAt(e,t,i){const r=this.elements;return Vi.subVectors(e,t),Vi.lengthSq()===0&&(Vi.z=1),Vi.normalize(),Ts.crossVectors(i,Vi),Ts.lengthSq()===0&&(Math.abs(i.z)===1?Vi.x+=1e-4:Vi.z+=1e-4,Vi.normalize(),Ts.crossVectors(i,Vi)),Ts.normalize(),Bu.crossVectors(Vi,Ts),r[0]=Ts.x,r[4]=Bu.x,r[8]=Vi.x,r[1]=Ts.y,r[5]=Bu.y,r[9]=Vi.y,r[2]=Ts.z,r[6]=Bu.z,r[10]=Vi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],l=i[4],d=i[8],h=i[12],m=i[1],u=i[5],g=i[9],v=i[13],w=i[2],T=i[6],M=i[10],b=i[14],A=i[3],E=i[7],P=i[11],G=i[15],O=r[0],B=r[4],F=r[8],D=r[12],L=r[1],V=r[5],ie=r[9],re=r[13],de=r[2],me=r[6],$=r[10],ue=r[14],Y=r[3],pe=r[7],_e=r[11],Ae=r[15];return s[0]=a*O+l*L+d*de+h*Y,s[4]=a*B+l*V+d*me+h*pe,s[8]=a*F+l*ie+d*$+h*_e,s[12]=a*D+l*re+d*ue+h*Ae,s[1]=m*O+u*L+g*de+v*Y,s[5]=m*B+u*V+g*me+v*pe,s[9]=m*F+u*ie+g*$+v*_e,s[13]=m*D+u*re+g*ue+v*Ae,s[2]=w*O+T*L+M*de+b*Y,s[6]=w*B+T*V+M*me+b*pe,s[10]=w*F+T*ie+M*$+b*_e,s[14]=w*D+T*re+M*ue+b*Ae,s[3]=A*O+E*L+P*de+G*Y,s[7]=A*B+E*V+P*me+G*pe,s[11]=A*F+E*ie+P*$+G*_e,s[15]=A*D+E*re+P*ue+G*Ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],l=e[5],d=e[9],h=e[13],m=e[2],u=e[6],g=e[10],v=e[14],w=e[3],T=e[7],M=e[11],b=e[15];return w*(+s*d*u-r*h*u-s*l*g+i*h*g+r*l*v-i*d*v)+T*(+t*d*v-t*h*g+s*a*g-r*a*v+r*h*m-s*d*m)+M*(+t*h*u-t*l*v-s*a*u+i*a*v+s*l*m-i*h*m)+b*(-r*l*m-t*d*u+t*l*g+r*a*u-i*a*g+i*d*m)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8],u=e[9],g=e[10],v=e[11],w=e[12],T=e[13],M=e[14],b=e[15],A=u*M*h-T*g*h+T*d*v-l*M*v-u*d*b+l*g*b,E=w*g*h-m*M*h-w*d*v+a*M*v+m*d*b-a*g*b,P=m*T*h-w*u*h+w*l*v-a*T*v-m*l*b+a*u*b,G=w*u*d-m*T*d-w*l*g+a*T*g+m*l*M-a*u*M,O=t*A+i*E+r*P+s*G;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/O;return e[0]=A*B,e[1]=(T*g*s-u*M*s-T*r*v+i*M*v+u*r*b-i*g*b)*B,e[2]=(l*M*s-T*d*s+T*r*h-i*M*h-l*r*b+i*d*b)*B,e[3]=(u*d*s-l*g*s-u*r*h+i*g*h+l*r*v-i*d*v)*B,e[4]=E*B,e[5]=(m*M*s-w*g*s+w*r*v-t*M*v-m*r*b+t*g*b)*B,e[6]=(w*d*s-a*M*s-w*r*h+t*M*h+a*r*b-t*d*b)*B,e[7]=(a*g*s-m*d*s+m*r*h-t*g*h-a*r*v+t*d*v)*B,e[8]=P*B,e[9]=(w*u*s-m*T*s-w*i*v+t*T*v+m*i*b-t*u*b)*B,e[10]=(a*T*s-w*l*s+w*i*h-t*T*h-a*i*b+t*l*b)*B,e[11]=(m*l*s-a*u*s-m*i*h+t*u*h+a*i*v-t*l*v)*B,e[12]=G*B,e[13]=(m*T*r-w*u*r+w*i*g-t*T*g-m*i*M+t*u*M)*B,e[14]=(w*l*r-a*T*r-w*i*d+t*T*d+a*i*M-t*l*M)*B,e[15]=(a*u*r-m*l*r+m*i*d-t*u*d-a*i*g+t*l*g)*B,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,l=e.y,d=e.z,h=s*a,m=s*l;return this.set(h*a+i,h*l-r*d,h*d+r*l,0,h*l+r*d,m*l+i,m*d-r*a,0,h*d-r*l,m*d+r*a,s*d*d+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,l=t._z,d=t._w,h=s+s,m=a+a,u=l+l,g=s*h,v=s*m,w=s*u,T=a*m,M=a*u,b=l*u,A=d*h,E=d*m,P=d*u,G=i.x,O=i.y,B=i.z;return r[0]=(1-(T+b))*G,r[1]=(v+P)*G,r[2]=(w-E)*G,r[3]=0,r[4]=(v-P)*O,r[5]=(1-(g+b))*O,r[6]=(M+A)*O,r[7]=0,r[8]=(w+E)*B,r[9]=(M-A)*B,r[10]=(1-(g+T))*B,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Ka.set(r[0],r[1],r[2]).length();const a=Ka.set(r[4],r[5],r[6]).length(),l=Ka.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gr.copy(this);const h=1/s,m=1/a,u=1/l;return gr.elements[0]*=h,gr.elements[1]*=h,gr.elements[2]*=h,gr.elements[4]*=m,gr.elements[5]*=m,gr.elements[6]*=m,gr.elements[8]*=u,gr.elements[9]*=u,gr.elements[10]*=u,t.setFromRotationMatrix(gr),i.x=s,i.y=a,i.z=l,this}makePerspective(e,t,i,r,s,a,l=cs){const d=this.elements,h=2*s/(t-e),m=2*s/(i-r),u=(t+e)/(t-e),g=(i+r)/(i-r);let v,w;if(l===cs)v=-(a+s)/(a-s),w=-2*a*s/(a-s);else if(l===mh)v=-a/(a-s),w=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return d[0]=h,d[4]=0,d[8]=u,d[12]=0,d[1]=0,d[5]=m,d[9]=g,d[13]=0,d[2]=0,d[6]=0,d[10]=v,d[14]=w,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,i,r,s,a,l=cs){const d=this.elements,h=1/(t-e),m=1/(i-r),u=1/(a-s),g=(t+e)*h,v=(i+r)*m;let w,T;if(l===cs)w=(a+s)*u,T=-2*u;else if(l===mh)w=s*u,T=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return d[0]=2*h,d[4]=0,d[8]=0,d[12]=-g,d[1]=0,d[5]=2*m,d[9]=0,d[13]=-v,d[2]=0,d[6]=0,d[10]=T,d[14]=-w,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Ka=new j,gr=new ot,WD=new j(0,0,0),jD=new j(1,1,1),Ts=new j,Bu=new j,Vi=new j,fw=new ot,pw=new Gn;class Pn{constructor(e=0,t=0,i=0,r=Pn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],l=r[8],d=r[1],h=r[5],m=r[9],u=r[2],g=r[6],v=r[10];switch(t){case"XYZ":this._y=Math.asin(Wn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-m,v),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(g,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Wn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(l,v),this._z=Math.atan2(d,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Wn(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,v),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(d,s));break;case"ZYX":this._y=Math.asin(-Wn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(d,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Wn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-m,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(l,v));break;case"XZY":this._z=Math.asin(-Wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-m,v),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return fw.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fw,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pw.setFromEuler(this),this.setFromQuaternion(pw,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Pn.DEFAULT_ORDER="XYZ";class A_{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(l,d){return l[d.uuid]===void 0&&(l[d.uuid]=d.toJSON(e)),d.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const d=l.shapes;if(Array.isArray(d))for(let h=0,m=d.length;h0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(i.geometries=l),d.length>0&&(i.materials=d),h.length>0&&(i.textures=h),m.length>0&&(i.images=m),u.length>0&&(i.shapes=u),g.length>0&&(i.skeletons=g),v.length>0&&(i.animations=v),w.length>0&&(i.nodes=w)}return i.object=r,i;function a(l){const d=[];for(const h in l){const m=l[h];delete m.metadata,d.push(m)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){_r.subVectors(r,t),Qr.subVectors(i,t),ip.subVectors(e,t);const a=_r.dot(_r),l=_r.dot(Qr),d=_r.dot(ip),h=Qr.dot(Qr),m=Qr.dot(ip),u=a*h-l*l;if(u===0)return s.set(0,0,0),null;const g=1/u,v=(h*d-l*m)*g,w=(a*m-l*d)*g;return s.set(1-v-w,w,v)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Jr)===null?!1:Jr.x>=0&&Jr.y>=0&&Jr.x+Jr.y<=1}static getInterpolation(e,t,i,r,s,a,l,d){return this.getBarycoord(e,t,i,r,Jr)===null?(d.x=0,d.y=0,"z"in d&&(d.z=0),"w"in d&&(d.w=0),null):(d.setScalar(0),d.addScaledVector(s,Jr.x),d.addScaledVector(a,Jr.y),d.addScaledVector(l,Jr.z),d)}static isFrontFacing(e,t,i,r){return _r.subVectors(i,t),Qr.subVectors(e,t),_r.cross(Qr).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _r.subVectors(this.c,this.b),Qr.subVectors(this.a,this.b),_r.cross(Qr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ur.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ur.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Ur.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Ur.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ur.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,l;Ja.subVectors(r,i),eo.subVectors(s,i),rp.subVectors(e,i);const d=Ja.dot(rp),h=eo.dot(rp);if(d<=0&&h<=0)return t.copy(i);sp.subVectors(e,r);const m=Ja.dot(sp),u=eo.dot(sp);if(m>=0&&u<=m)return t.copy(r);const g=d*u-m*h;if(g<=0&&d>=0&&m<=0)return a=d/(d-m),t.copy(i).addScaledVector(Ja,a);ap.subVectors(e,s);const v=Ja.dot(ap),w=eo.dot(ap);if(w>=0&&v<=w)return t.copy(s);const T=v*h-d*w;if(T<=0&&h>=0&&w<=0)return l=h/(h-w),t.copy(i).addScaledVector(eo,l);const M=m*w-v*u;if(M<=0&&u-m>=0&&v-w>=0)return bw.subVectors(s,r),l=(u-m)/(u-m+(v-w)),t.copy(r).addScaledVector(bw,l);const b=1/(M+T+g);return a=T*b,l=g*b,t.copy(i).addScaledVector(Ja,a).addScaledVector(eo,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ME={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},As={h:0,s:0,l:0},Hu={h:0,s:0,l:0};function op(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Je{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=on){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Kt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Kt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Kt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Kt.workingColorSpace){if(e=E_(e,1),t=Wn(t,0,1),i=Wn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=op(a,s,e+1/3),this.g=op(a,s,e),this.b=op(a,s,e-1/3)}return Kt.toWorkingColorSpace(this,r),this}setStyle(e,t=on){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=on){const i=ME[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=zo(e.r),this.g=zo(e.g),this.b=zo(e.b),this}copyLinearToSRGB(e){return this.r=$f(e.r),this.g=$f(e.g),this.b=$f(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=on){return Kt.fromWorkingColorSpace(fi.copy(this),e),Math.round(Wn(fi.r*255,0,255))*65536+Math.round(Wn(fi.g*255,0,255))*256+Math.round(Wn(fi.b*255,0,255))}getHexString(e=on){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Kt.workingColorSpace){Kt.fromWorkingColorSpace(fi.copy(this),t);const i=fi.r,r=fi.g,s=fi.b,a=Math.max(i,r,s),l=Math.min(i,r,s);let d,h;const m=(l+a)/2;if(l===a)d=0,h=0;else{const u=a-l;switch(h=m<=.5?u/(a+l):u/(2-a-l),a){case i:d=(r-s)/u+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==No&&(i.blending=this.blending),this.side!==gs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Pm&&(i.blendSrc=this.blendSrc),this.blendDst!==Lm&&(i.blendDst=this.blendDst),this.blendEquation!==ya&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==uh&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==aw&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ja&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ja&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ja&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const l in s){const d=s[l];delete d.metadata,a.push(d)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Or extends _i{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pn,this.combine=Bh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const as=ZD();function ZD(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let d=0;d<256;++d){const h=d-127;h<-27?(i[d]=0,i[d|256]=32768,r[d]=24,r[d|256]=24):h<-14?(i[d]=1024>>-h-14,i[d|256]=1024>>-h-14|32768,r[d]=-h-1,r[d|256]=-h-1):h<=15?(i[d]=h+15<<10,i[d|256]=h+15<<10|32768,r[d]=13,r[d|256]=13):h<128?(i[d]=31744,i[d|256]=64512,r[d]=24,r[d|256]=24):(i[d]=31744,i[d|256]=64512,r[d]=13,r[d|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let d=1;d<1024;++d){let h=d<<13,m=0;for(;!(h&8388608);)h<<=1,m-=8388608;h&=-8388609,m+=947912704,s[d]=h|m}for(let d=1024;d<2048;++d)s[d]=939524096+(d-1024<<13);for(let d=1;d<31;++d)a[d]=d<<23;a[31]=1199570944,a[32]=2147483648;for(let d=33;d<63;++d)a[d]=2147483648+(d-32<<23);a[63]=3347054592;for(let d=1;d<64;++d)d!==32&&(l[d]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function QD(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Wn(n,-65504,65504),as.floatView[0]=n;const e=as.uint32View[0],t=e>>23&511;return as.baseTable[t]+((e&8388607)>>as.shiftTable[t])}function JD(n){const e=n>>10;return as.uint32View[0]=as.mantissaTable[as.offsetTable[e]+(n&1023)]+as.exponentTable[e],as.floatView[0]}const Eo={toHalfFloat:QD,fromHalfFloat:JD},zn=new j,Gu=new et;class _n{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=ag,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Un,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return T_("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const d=this.parameters;for(const h in d)d[h]!==void 0&&(e[h]=d[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const d in i){const h=i[d];e.data.attributes[d]=h.toJSON(e.data)}const r={};let s=!1;for(const d in this.morphAttributes){const h=this.morphAttributes[d],m=[];for(let u=0,g=h.length;u0&&(r[d]=m,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const h in r){const m=r[h];this.setAttribute(h,m.clone(t))}const s=e.morphAttributes;for(const h in s){const m=[],u=s[h];for(let g=0,v=u.length;g0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(xw.copy(s).invert(),ca.copy(e.ray).applyMatrix4(xw),!(i.boundingBox!==null&&ca.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ca)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,l=s.index,d=s.attributes.position,h=s.attributes.uv,m=s.attributes.uv1,u=s.attributes.normal,g=s.groups,v=s.drawRange;if(l!==null)if(Array.isArray(a))for(let w=0,T=g.length;wt.far?null:{distance:h,point:qu.clone(),object:n}}function Ku(n,e,t,i,r,s,a,l,d,h){n.getVertexPosition(l,no),n.getVertexPosition(d,io),n.getVertexPosition(h,ro);const m=tk(n,e,t,i,no,io,ro,$u);if(m){r&&(ju.fromBufferAttribute(r,l),Xu.fromBufferAttribute(r,d),Yu.fromBufferAttribute(r,h),m.uv=Ur.getInterpolation($u,no,io,ro,ju,Xu,Yu,new et)),s&&(ju.fromBufferAttribute(s,l),Xu.fromBufferAttribute(s,d),Yu.fromBufferAttribute(s,h),m.uv1=Ur.getInterpolation($u,no,io,ro,ju,Xu,Yu,new et)),a&&(Sw.fromBufferAttribute(a,l),Mw.fromBufferAttribute(a,d),Ew.fromBufferAttribute(a,h),m.normal=Ur.getInterpolation($u,no,io,ro,Sw,Mw,Ew,new j),m.normal.dot(i.direction)>0&&m.normal.multiplyScalar(-1));const u={a:l,b:d,c:h,normal:new j,materialIndex:0};Ur.getNormal(no,io,ro,u.normal),m.face=u}return m}class Xc extends On{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const d=[],h=[],m=[],u=[];let g=0,v=0;w("z","y","x",-1,-1,i,t,e,a,s,0),w("z","y","x",1,-1,i,t,-e,a,s,1),w("x","z","y",1,1,e,i,t,r,a,2),w("x","z","y",1,-1,e,i,-t,r,a,3),w("x","y","z",1,-1,e,t,i,r,s,4),w("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(d),this.setAttribute("position",new nn(h,3)),this.setAttribute("normal",new nn(m,3)),this.setAttribute("uv",new nn(u,2));function w(T,M,b,A,E,P,G,O,B,F,D){const L=P/B,V=G/F,ie=P/2,re=G/2,de=O/2,me=B+1,$=F+1;let ue=0,Y=0;const pe=new j;for(let _e=0;_e<$;_e++){const Ae=_e*V-re;for(let Pe=0;Pe0?1:-1,m.push(pe.x,pe.y,pe.z),u.push(Pe/B),u.push(1-_e/F),ue+=1}}for(let _e=0;_e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}let CE=class extends sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ot,this.projectionMatrix=new ot,this.projectionMatrixInverse=new ot,this.coordinateSystem=cs}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const Cs=new j,Tw=new et,Aw=new et;class mi extends CE{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=il*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return il*2*Math.atan(Math.tan(cc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Cs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cs.x,Cs.y).multiplyScalar(-e/Cs.z),Cs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Cs.x,Cs.y).multiplyScalar(-e/Cs.z)}getViewSize(e,t){return this.getViewBounds(e,Tw,Aw),t.subVectors(Aw,Tw)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const d=a.fullWidth,h=a.fullHeight;s+=a.offsetX*r/d,t-=a.offsetY*i/h,r*=a.width/d,i*=a.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const so=-90,ao=1;class RE extends sn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new mi(so,ao,e,t);r.layers=this.layers,this.add(r);const s=new mi(so,ao,e,t);s.layers=this.layers,this.add(s);const a=new mi(so,ao,e,t);a.layers=this.layers,this.add(a);const l=new mi(so,ao,e,t);l.layers=this.layers,this.add(l);const d=new mi(so,ao,e,t);d.layers=this.layers,this.add(d);const h=new mi(so,ao,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,l,d]=t;for(const h of t)this.remove(h);if(e===cs)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),d.up.set(0,1,0),d.lookAt(0,0,-1);else if(e===mh)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),d.up.set(0,-1,0),d.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,d,h,m]=this.children,u=e.getRenderTarget(),g=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),w=e.xr.enabled;e.xr.enabled=!1;const T=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,l),e.setRenderTarget(i,3,r),e.render(t,d),e.setRenderTarget(i,4,r),e.render(t,h),i.texture.generateMipmaps=T,e.setRenderTarget(i,5,r),e.render(t,m),e.setRenderTarget(u,g,v),e.xr.enabled=w,i.texture.needsPMREMUpdate=!0}}class PE extends qn{constructor(e,t,i,r,s,a,l,d,h,m){e=e!==void 0?e:[],t=t!==void 0?t:Qo,super(e,t,i,r,s,a,l,d,h,m),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class LE extends Zs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new PE(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ln}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new Xc(5,5,5),s=new zi({name:"CubemapFromEquirect",uniforms:rl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ei,blending:Gr});s.uniforms.tEquirect.value=t;const a=new wn(r,s),l=t.minFilter;return t.minFilter===Er&&(t.minFilter=ln),new RE(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const up=new j,sk=new j,ak=new At;let ga=class{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=up.subVectors(i,t).cross(sk.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(up),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||ak.getNormalMatrix(e),r=this.coplanarPoint(up).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};const ua=new Wr,Zu=new j;class R_{constructor(e=new ga,t=new ga,i=new ga,r=new ga,s=new ga,a=new ga){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(i),l[3].copy(r),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=cs){const i=this.planes,r=e.elements,s=r[0],a=r[1],l=r[2],d=r[3],h=r[4],m=r[5],u=r[6],g=r[7],v=r[8],w=r[9],T=r[10],M=r[11],b=r[12],A=r[13],E=r[14],P=r[15];if(i[0].setComponents(d-s,g-h,M-v,P-b).normalize(),i[1].setComponents(d+s,g+h,M+v,P+b).normalize(),i[2].setComponents(d+a,g+m,M+w,P+A).normalize(),i[3].setComponents(d-a,g-m,M-w,P-A).normalize(),i[4].setComponents(d-l,g-u,M-T,P-E).normalize(),t===cs)i[5].setComponents(d+l,g+u,M+T,P+E).normalize();else if(t===mh)i[5].setComponents(l,u,T,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ua.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ua)}intersectsSprite(e){return ua.center.set(0,0,0),ua.radius=.7071067811865476,ua.applyMatrix4(e.matrixWorld),this.intersectsSphere(ua)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Zu.y=r.normal.y>0?e.max.y:e.min.y,Zu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Zu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function IE(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function ok(n){const e=new WeakMap;function t(l,d){const h=l.array,m=l.usage,u=h.byteLength,g=n.createBuffer();n.bindBuffer(d,g),n.bufferData(d,h,m),l.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)l.isFloat16BufferAttribute?v=n.HALF_FLOAT:v=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:g,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version,size:u}}function i(l,d,h){const m=d.array,u=d._updateRange,g=d.updateRanges;if(n.bindBuffer(h,l),u.count===-1&&g.length===0&&n.bufferSubData(h,0,m),g.length!==0){for(let v=0,w=g.length;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,Mk=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Ek=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Tk=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Ak=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,Ck=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,Rk=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,Pk=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,Lk=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,Ik=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,Dk=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,kk=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,Fk=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,Uk=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,Ok=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,Nk="gl_FragColor = linearToOutputTexel( gl_FragColor );",Bk=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +} +vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return sRGBTransferOETF( value ); +}`,zk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,Hk=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,Gk=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,Vk=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,Wk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,jk=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,Xk=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,Yk=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,$k=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,qk=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,Kk=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,Zk=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,Qk=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Jk=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,e3=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,t3=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,n3=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,i3=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,r3=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,s3=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,a3=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,o3=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,l3=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,c3=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,u3=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,d3=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,h3=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,f3=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,p3=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,m3=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,g3=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,_3=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,v3=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,y3=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,b3=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,x3=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,w3=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,S3=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,M3=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,E3=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,T3=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,A3=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,C3=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,R3=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,P3=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,L3=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,I3=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,D3=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,k3=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,F3=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,U3=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,O3=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,N3=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,B3=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,z3=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,H3=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,G3=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,V3=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,W3=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,j3=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,X3=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,Y3=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,$3=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,q3=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,K3=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,Z3=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,Q3=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,J3=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,eF=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,tF=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,nF=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,iF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,rF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,sF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,aF=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const oF=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,lF=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,cF=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,uF=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,dF=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,hF=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,fF=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,pF=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,mF=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,gF=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,_F=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,vF=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,yF=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,bF=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,xF=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,wF=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,SF=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,MF=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,EF=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,TF=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,AF=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,CF=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,RF=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,PF=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,LF=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,IF=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,DF=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,kF=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,FF=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,UF=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OF=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,NF=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,BF=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,zF=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,xt={alphahash_fragment:lk,alphahash_pars_fragment:ck,alphamap_fragment:uk,alphamap_pars_fragment:dk,alphatest_fragment:hk,alphatest_pars_fragment:fk,aomap_fragment:pk,aomap_pars_fragment:mk,batching_pars_vertex:gk,batching_vertex:_k,begin_vertex:vk,beginnormal_vertex:yk,bsdfs:bk,iridescence_fragment:xk,bumpmap_pars_fragment:wk,clipping_planes_fragment:Sk,clipping_planes_pars_fragment:Mk,clipping_planes_pars_vertex:Ek,clipping_planes_vertex:Tk,color_fragment:Ak,color_pars_fragment:Ck,color_pars_vertex:Rk,color_vertex:Pk,common:Lk,cube_uv_reflection_fragment:Ik,defaultnormal_vertex:Dk,displacementmap_pars_vertex:kk,displacementmap_vertex:Fk,emissivemap_fragment:Uk,emissivemap_pars_fragment:Ok,colorspace_fragment:Nk,colorspace_pars_fragment:Bk,envmap_fragment:zk,envmap_common_pars_fragment:Hk,envmap_pars_fragment:Gk,envmap_pars_vertex:Vk,envmap_physical_pars_fragment:e3,envmap_vertex:Wk,fog_vertex:jk,fog_pars_vertex:Xk,fog_fragment:Yk,fog_pars_fragment:$k,gradientmap_pars_fragment:qk,lightmap_pars_fragment:Kk,lights_lambert_fragment:Zk,lights_lambert_pars_fragment:Qk,lights_pars_begin:Jk,lights_toon_fragment:t3,lights_toon_pars_fragment:n3,lights_phong_fragment:i3,lights_phong_pars_fragment:r3,lights_physical_fragment:s3,lights_physical_pars_fragment:a3,lights_fragment_begin:o3,lights_fragment_maps:l3,lights_fragment_end:c3,logdepthbuf_fragment:u3,logdepthbuf_pars_fragment:d3,logdepthbuf_pars_vertex:h3,logdepthbuf_vertex:f3,map_fragment:p3,map_pars_fragment:m3,map_particle_fragment:g3,map_particle_pars_fragment:_3,metalnessmap_fragment:v3,metalnessmap_pars_fragment:y3,morphinstance_vertex:b3,morphcolor_vertex:x3,morphnormal_vertex:w3,morphtarget_pars_vertex:S3,morphtarget_vertex:M3,normal_fragment_begin:E3,normal_fragment_maps:T3,normal_pars_fragment:A3,normal_pars_vertex:C3,normal_vertex:R3,normalmap_pars_fragment:P3,clearcoat_normal_fragment_begin:L3,clearcoat_normal_fragment_maps:I3,clearcoat_pars_fragment:D3,iridescence_pars_fragment:k3,opaque_fragment:F3,packing:U3,premultiplied_alpha_fragment:O3,project_vertex:N3,dithering_fragment:B3,dithering_pars_fragment:z3,roughnessmap_fragment:H3,roughnessmap_pars_fragment:G3,shadowmap_pars_fragment:V3,shadowmap_pars_vertex:W3,shadowmap_vertex:j3,shadowmask_pars_fragment:X3,skinbase_vertex:Y3,skinning_pars_vertex:$3,skinning_vertex:q3,skinnormal_vertex:K3,specularmap_fragment:Z3,specularmap_pars_fragment:Q3,tonemapping_fragment:J3,tonemapping_pars_fragment:eF,transmission_fragment:tF,transmission_pars_fragment:nF,uv_pars_fragment:iF,uv_pars_vertex:rF,uv_vertex:sF,worldpos_vertex:aF,background_vert:oF,background_frag:lF,backgroundCube_vert:cF,backgroundCube_frag:uF,cube_vert:dF,cube_frag:hF,depth_vert:fF,depth_frag:pF,distanceRGBA_vert:mF,distanceRGBA_frag:gF,equirect_vert:_F,equirect_frag:vF,linedashed_vert:yF,linedashed_frag:bF,meshbasic_vert:xF,meshbasic_frag:wF,meshlambert_vert:SF,meshlambert_frag:MF,meshmatcap_vert:EF,meshmatcap_frag:TF,meshnormal_vert:AF,meshnormal_frag:CF,meshphong_vert:RF,meshphong_frag:PF,meshphysical_vert:LF,meshphysical_frag:IF,meshtoon_vert:DF,meshtoon_frag:kF,points_vert:FF,points_frag:UF,shadow_vert:OF,shadow_frag:NF,sprite_vert:BF,sprite_frag:zF},Ze={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new At}},envmap:{envMap:{value:null},envMapRotation:{value:new At},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new At}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new At}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new At},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new At},normalScale:{value:new et(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new At},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new At}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new At}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new At}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0},uvTransform:{value:new At}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new et(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}}},ki={basic:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:bi([Ze.common,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.roughnessmap,Ze.metalnessmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:bi([Ze.common,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.gradientmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:bi([Ze.common,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:bi([Ze.points,Ze.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:bi([Ze.common,Ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:bi([Ze.common,Ze.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:bi([Ze.common,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:bi([Ze.sprite,Ze.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new At},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xt.background_vert,fragmentShader:xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new At}},vertexShader:xt.backgroundCube_vert,fragmentShader:xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xt.cube_vert,fragmentShader:xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xt.equirect_vert,fragmentShader:xt.equirect_frag},distanceRGBA:{uniforms:bi([Ze.common,Ze.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:bi([Ze.lights,Ze.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};ki.physical={uniforms:bi([ki.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new At},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new At},clearcoatNormalScale:{value:new et(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new At},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new At},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new At},sheen:{value:0},sheenColor:{value:new Je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new At},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new At},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new At},transmissionSamplerSize:{value:new et},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new At},attenuationDistance:{value:0},attenuationColor:{value:new Je(0)},specularColor:{value:new Je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new At},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new At},anisotropyVector:{value:new et},anisotropyMap:{value:null},anisotropyMapTransform:{value:new At}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const Qu={r:0,b:0,g:0},da=new Pn,HF=new ot;function GF(n,e,t,i,r,s,a){const l=new Je(0);let d=s===!0?0:1,h,m,u=null,g=0,v=null;function w(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function T(A){let E=!1;const P=w(A);P===null?b(l,d):P&&P.isColor&&(b(P,1),E=!0);const G=n.xr.getEnvironmentBlendMode();G==="additive"?i.buffers.color.setClear(0,0,0,1,a):G==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||E)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function M(A,E){const P=w(E);P&&(P.isCubeTexture||P.mapping===zh)?(m===void 0&&(m=new wn(new Xc(1,1,1),new zi({name:"BackgroundCubeMaterial",uniforms:rl(ki.backgroundCube.uniforms),vertexShader:ki.backgroundCube.vertexShader,fragmentShader:ki.backgroundCube.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(G,O,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(m)),da.copy(E.backgroundRotation),da.x*=-1,da.y*=-1,da.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(da.y*=-1,da.z*=-1),m.material.uniforms.envMap.value=P,m.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(HF.makeRotationFromEuler(da)),m.material.toneMapped=Kt.getTransfer(P.colorSpace)!==pn,(u!==P||g!==P.version||v!==n.toneMapping)&&(m.material.needsUpdate=!0,u=P,g=P.version,v=n.toneMapping),m.layers.enableAll(),A.unshift(m,m.geometry,m.material,0,0,null)):P&&P.isTexture&&(h===void 0&&(h=new wn(new Yc(2,2),new zi({name:"BackgroundMaterial",uniforms:rl(ki.background.uniforms),vertexShader:ki.background.vertexShader,fragmentShader:ki.background.fragmentShader,side:gs,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=P,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.toneMapped=Kt.getTransfer(P.colorSpace)!==pn,P.matrixAutoUpdate===!0&&P.updateMatrix(),h.material.uniforms.uvTransform.value.copy(P.matrix),(u!==P||g!==P.version||v!==n.toneMapping)&&(h.material.needsUpdate=!0,u=P,g=P.version,v=n.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null))}function b(A,E){A.getRGB(Qu,TE(n)),i.buffers.color.setClear(Qu.r,Qu.g,Qu.b,E,a)}return{getClearColor:function(){return l},setClearColor:function(A,E=1){l.set(A),d=E,b(l,d)},getClearAlpha:function(){return d},setClearAlpha:function(A){d=A,b(l,d)},render:T,addToRenderList:M}}function VF(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=g(null);let s=r,a=!1;function l(L,V,ie,re,de){let me=!1;const $=u(re,ie,V);s!==$&&(s=$,h(s.object)),me=v(L,re,ie,de),me&&w(L,re,ie,de),de!==null&&e.update(de,n.ELEMENT_ARRAY_BUFFER),(me||a)&&(a=!1,P(L,V,ie,re),de!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(de).buffer))}function d(){return n.createVertexArray()}function h(L){return n.bindVertexArray(L)}function m(L){return n.deleteVertexArray(L)}function u(L,V,ie){const re=ie.wireframe===!0;let de=i[L.id];de===void 0&&(de={},i[L.id]=de);let me=de[V.id];me===void 0&&(me={},de[V.id]=me);let $=me[re];return $===void 0&&($=g(d()),me[re]=$),$}function g(L){const V=[],ie=[],re=[];for(let de=0;de=0){const _e=de[Y];let Ae=me[Y];if(Ae===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(Ae=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(Ae=L.instanceColor)),_e===void 0||_e.attribute!==Ae||Ae&&_e.data!==Ae.data)return!0;$++}return s.attributesNum!==$||s.index!==re}function w(L,V,ie,re){const de={},me=V.attributes;let $=0;const ue=ie.getAttributes();for(const Y in ue)if(ue[Y].location>=0){let _e=me[Y];_e===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(_e=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(_e=L.instanceColor));const Ae={};Ae.attribute=_e,_e&&_e.data&&(Ae.data=_e.data),de[Y]=Ae,$++}s.attributes=de,s.attributesNum=$,s.index=re}function T(){const L=s.newAttributes;for(let V=0,ie=L.length;V=0){let pe=de[ue];if(pe===void 0&&(ue==="instanceMatrix"&&L.instanceMatrix&&(pe=L.instanceMatrix),ue==="instanceColor"&&L.instanceColor&&(pe=L.instanceColor)),pe!==void 0){const _e=pe.normalized,Ae=pe.itemSize,Pe=e.get(pe);if(Pe===void 0)continue;const Ue=Pe.buffer,ae=Pe.type,ge=Pe.bytesPerElement,ce=ae===n.INT||ae===n.UNSIGNED_INT||pe.gpuType===v_;if(pe.isInterleavedBufferAttribute){const Me=pe.data,Ye=Me.stride,ht=pe.offset;if(Me.isInstancedInterleavedBuffer){for(let ft=0;ft0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const m=d(h);m!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",m,"instead."),h=m);const u=t.logarithmicDepthBuffer===!0,g=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=n.getParameter(n.MAX_TEXTURE_SIZE),T=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),M=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),P=v>0,G=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:d,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:u,maxTextures:g,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:T,maxAttributes:M,maxVertexUniforms:b,maxVaryings:A,maxFragmentUniforms:E,vertexTextures:P,maxSamples:G}}function XF(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new ga,l=new At,d={value:null,needsUpdate:!1};this.uniform=d,this.numPlanes=0,this.numIntersection=0,this.init=function(u,g){const v=u.length!==0||g||i!==0||r;return r=g,i=u.length,v},this.beginShadows=function(){s=!0,m(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,g){t=m(u,g,0)},this.setState=function(u,g,v){const w=u.clippingPlanes,T=u.clipIntersection,M=u.clipShadows,b=n.get(u);if(!r||w===null||w.length===0||s&&!M)s?m(null):h();else{const A=s?0:i,E=A*4;let P=b.clippingState||null;d.value=P,P=m(w,g,E,v);for(let G=0;G!==E;++G)P[G]=t[G];b.clippingState=P,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=A}};function h(){d.value!==t&&(d.value=t,d.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function m(u,g,v,w){const T=u!==null?u.length:0;let M=null;if(T!==0){if(M=d.value,w!==!0||M===null){const b=v+T*4,A=g.matrixWorldInverse;l.getNormalMatrix(A),(M===null||M.length0){const h=new LE(d.height);return h.fromEquirectangularTexture(n,a),e.set(a,h),a.addEventListener("dispose",r),t(h.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const d=e.get(l);d!==void 0&&(e.delete(l),d.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class dl extends CE{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,l=r+t,d=r-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,l-=m*this.view.offsetY,d=l-m*this.view.height}this.projectionMatrix.makeOrthographic(s,a,l,d,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const To=4,Cw=[.125,.215,.35,.446,.526,.582],ba=20,dp=new dl,Rw=new Je;let hp=null,fp=0,pp=0,mp=!1;const _a=(1+Math.sqrt(5))/2,oo=1/_a,Pw=[new j(-_a,oo,0),new j(_a,oo,0),new j(-oo,0,_a),new j(oo,0,_a),new j(0,_a,-oo),new j(0,_a,oo),new j(-1,1,-1),new j(1,1,-1),new j(-1,1,1),new j(1,1,1)];class gh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){hp=this._renderer.getRenderTarget(),fp=this._renderer.getActiveCubeFace(),pp=this._renderer.getActiveMipmapLevel(),mp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Dw(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Iw(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?E:0,E,E),m.setRenderTarget(r),T&&m.render(w,l),m.render(e,l)}w.geometry.dispose(),w.material.dispose(),m.toneMapping=g,m.autoClear=u,e.background=M}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Qo||e.mapping===Jo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Dw()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Iw());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new wn(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const d=this._cubeSize;Ju(t,0,0,3*d,2*d),i.setRenderTarget(t),i.render(a,dp)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sba&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${M} samples when the maximum is set to ${ba}`);const b=[];let A=0;for(let B=0;BE-To?r-E+To:0),O=4*(this._cubeSize-P);Ju(t,G,O,3*P,2*P),d.setRenderTarget(t),d.render(u,dp)}}function $F(n){const e=[],t=[],i=[];let r=n;const s=n-To+1+Cw.length;for(let a=0;an-To?d=Cw[a-n+To-1]:a===0&&(d=0),i.push(d);const h=1/(l-2),m=-h,u=1+h,g=[m,m,u,m,u,u,m,m,u,u,m,u],v=6,w=6,T=3,M=2,b=1,A=new Float32Array(T*w*v),E=new Float32Array(M*w*v),P=new Float32Array(b*w*v);for(let O=0;O2?0:-1,D=[B,F,0,B+2/3,F,0,B+2/3,F+1,0,B,F,0,B+2/3,F+1,0,B,F+1,0];A.set(D,T*w*O),E.set(g,M*w*O);const L=[O,O,O,O,O,O];P.set(L,b*w*O)}const G=new On;G.setAttribute("position",new _n(A,T)),G.setAttribute("uv",new _n(E,M)),G.setAttribute("faceIndex",new _n(P,b)),e.push(G),r>To&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Lw(n,e,t){const i=new Zs(n,e,t);return i.texture.mapping=zh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ju(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function qF(n,e,t){const i=new Float32Array(ba),r=new j(0,1,0);return new zi({name:"SphericalGaussianBlur",defines:{n:ba,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:P_(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Gr,depthTest:!1,depthWrite:!1})}function Iw(){return new zi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:P_(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Gr,depthTest:!1,depthWrite:!1})}function Dw(){return new zi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:P_(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Gr,depthTest:!1,depthWrite:!1})}function P_(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function KF(n){let e=new WeakMap,t=null;function i(l){if(l&&l.isTexture){const d=l.mapping,h=d===el||d===Im,m=d===Qo||d===Jo;if(h||m){let u=e.get(l);const g=u!==void 0?u.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==g)return t===null&&(t=new gh(n)),u=h?t.fromEquirectangular(l,u):t.fromCubemap(l,u),u.texture.pmremVersion=l.pmremVersion,e.set(l,u),u.texture;if(u!==void 0)return u.texture;{const v=l.image;return h&&v&&v.height>0||m&&v&&r(v)?(t===null&&(t=new gh(n)),u=h?t.fromEquirectangular(l):t.fromCubemap(l),u.texture.pmremVersion=l.pmremVersion,e.set(l,u),l.addEventListener("dispose",s),u.texture):null}}}return l}function r(l){let d=0;const h=6;for(let m=0;me.maxTextureSize&&(O=Math.ceil(G/e.maxTextureSize),G=e.maxTextureSize);const B=new Float32Array(G*O*4*u),F=new SE(B,G,O,u);F.type=Un,F.needsUpdate=!0;const D=P*4;for(let V=0;V0)return n;const r=e*t;let s=Fw[r];if(s===void 0&&(s=new Float32Array(r),Fw[r]=s),e!==0){i.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,n[a].toArray(s,l)}return s}function Kn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${l}: ${t[a]}`)}return i.join(` +`)}function KU(n){const e=Kt.getPrimaries(Kt.workingColorSpace),t=Kt.getPrimaries(n);let i;switch(e===t?i="":e===ph&&t===fh?i="LinearDisplayP3ToLinearSRGB":e===fh&&t===ph&&(i="LinearSRGBToLinearDisplayP3"),n){case Sn:case Hh:return[i,"LinearTransferOETF"];case on:case M_:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function Gw(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+qU(n.getShaderSource(e),a)}else return r}function ZU(n,e){const t=KU(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function QU(n,e){let t;switch(e){case lE:t="Linear";break;case eD:t="Reinhard";break;case tD:t="OptimizedCineon";break;case nD:t="ACESFilmic";break;case rD:t="AgX";break;case sD:t="Neutral";break;case iD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function JU(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Kl).join(` +`)}function eO(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function tO(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function og(n){return n.replace(nO,rO)}const iO=new Map;function rO(n,e){let t=xt[e];if(t===void 0){const i=iO.get(e);if(i!==void 0)t=xt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return og(t)}const sO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function jw(n){return n.replace(sO,aO)}function aO(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(M+=` +`),b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(Kl).join(` +`),b.length>0&&(b+=` +`)):(M=[Xw(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+m:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Kl).join(` +`),b=[Xw(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+m:"",t.envMap?"#define "+u:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==$s?"#define TONE_MAPPING":"",t.toneMapping!==$s?xt.tonemapping_pars_fragment:"",t.toneMapping!==$s?QU("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.colorspace_pars_fragment,ZU("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Kl).join(` +`)),a=og(a),a=Vw(a,t),a=Ww(a,t),l=og(l),l=Vw(l,t),l=Ww(l,t),a=jw(a),l=jw(l),t.isRawShaderMaterial!==!0&&(A=`#version 300 es +`,M=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+M,b=["#define varying in",t.glslVersion===ow?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ow?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+b);const E=A+M+a,P=A+b+l,G=Hw(r,r.VERTEX_SHADER,E),O=Hw(r,r.FRAGMENT_SHADER,P);r.attachShader(T,G),r.attachShader(T,O),t.index0AttributeName!==void 0?r.bindAttribLocation(T,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(T,0,"position"),r.linkProgram(T);function B(V){if(n.debug.checkShaderErrors){const ie=r.getProgramInfoLog(T).trim(),re=r.getShaderInfoLog(G).trim(),de=r.getShaderInfoLog(O).trim();let me=!0,$=!0;if(r.getProgramParameter(T,r.LINK_STATUS)===!1)if(me=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,T,G,O);else{const ue=Gw(r,G,"vertex"),Y=Gw(r,O,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(T,r.VALIDATE_STATUS)+` + +Material Name: `+V.name+` +Material Type: `+V.type+` + +Program Info Log: `+ie+` +`+ue+` +`+Y)}else ie!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ie):(re===""||de==="")&&($=!1);$&&(V.diagnostics={runnable:me,programLog:ie,vertexShader:{log:re,prefix:M},fragmentShader:{log:de,prefix:b}})}r.deleteShader(G),r.deleteShader(O),F=new Fd(r,T),D=tO(r,T)}let F;this.getUniforms=function(){return F===void 0&&B(this),F};let D;this.getAttributes=function(){return D===void 0&&B(this),D};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=r.getProgramParameter(T,YU)),L},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(T),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=$U++,this.cacheKey=e,this.usedTimes=1,this.program=T,this.vertexShader=G,this.fragmentShader=O,this}let fO=0;class pO{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new mO(e),t.set(e,i)),i}}class mO{constructor(e){this.id=fO++,this.code=e,this.usedTimes=0}}function gO(n,e,t,i,r,s,a){const l=new A_,d=new pO,h=new Set,m=[],u=r.logarithmicDepthBuffer,g=r.vertexTextures;let v=r.precision;const w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function T(D){return h.add(D),D===0?"uv":`uv${D}`}function M(D,L,V,ie,re){const de=ie.fog,me=re.geometry,$=D.isMeshStandardMaterial?ie.environment:null,ue=(D.isMeshStandardMaterial?t:e).get(D.envMap||$),Y=ue&&ue.mapping===zh?ue.image.height:null,pe=w[D.type];D.precision!==null&&(v=r.getMaxPrecision(D.precision),v!==D.precision&&console.warn("THREE.WebGLProgram.getParameters:",D.precision,"not supported, using",v,"instead."));const _e=me.morphAttributes.position||me.morphAttributes.normal||me.morphAttributes.color,Ae=_e!==void 0?_e.length:0;let Pe=0;me.morphAttributes.position!==void 0&&(Pe=1),me.morphAttributes.normal!==void 0&&(Pe=2),me.morphAttributes.color!==void 0&&(Pe=3);let Ue,ae,ge,ce;if(pe){const Ot=ki[pe];Ue=Ot.vertexShader,ae=Ot.fragmentShader}else Ue=D.vertexShader,ae=D.fragmentShader,d.update(D),ge=d.getVertexShaderID(D),ce=d.getFragmentShaderID(D);const Me=n.getRenderTarget(),Ye=re.isInstancedMesh===!0,ht=re.isBatchedMesh===!0,ft=!!D.map,Wt=!!D.matcap,Z=!!ue,Jt=!!D.aoMap,Ut=!!D.lightMap,jt=!!D.bumpMap,ut=!!D.normalMap,yn=!!D.displacementMap,yt=!!D.emissiveMap,wt=!!D.metalnessMap,X=!!D.roughnessMap,N=D.anisotropy>0,ve=D.clearcoat>0,De=D.dispersion>0,ke=D.iridescence>0,Le=D.sheen>0,lt=D.transmission>0,Qe=N&&!!D.anisotropyMap,tt=ve&&!!D.clearcoatMap,vt=ve&&!!D.clearcoatNormalMap,Ne=ve&&!!D.clearcoatRoughnessMap,nt=ke&&!!D.iridescenceMap,Rt=ke&&!!D.iridescenceThicknessMap,ct=Le&&!!D.sheenColorMap,$e=Le&&!!D.sheenRoughnessMap,bt=!!D.specularMap,Ie=!!D.specularColorMap,it=!!D.specularIntensityMap,ee=lt&&!!D.transmissionMap,He=lt&&!!D.thicknessMap,oe=!!D.gradientMap,Ce=!!D.alphaMap,Ge=D.alphaTest>0,gt=!!D.alphaHash,Pt=!!D.extensions;let un=$s;D.toneMapped&&(Me===null||Me.isXRRenderTarget===!0)&&(un=n.toneMapping);const Ln={shaderID:pe,shaderType:D.type,shaderName:D.name,vertexShader:Ue,fragmentShader:ae,defines:D.defines,customVertexShaderID:ge,customFragmentShaderID:ce,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:v,batching:ht,batchingColor:ht&&re._colorsTexture!==null,instancing:Ye,instancingColor:Ye&&re.instanceColor!==null,instancingMorph:Ye&&re.morphTexture!==null,supportsVertexTextures:g,outputColorSpace:Me===null?n.outputColorSpace:Me.isXRRenderTarget===!0?Me.texture.colorSpace:Sn,alphaToCoverage:!!D.alphaToCoverage,map:ft,matcap:Wt,envMap:Z,envMapMode:Z&&ue.mapping,envMapCubeUVHeight:Y,aoMap:Jt,lightMap:Ut,bumpMap:jt,normalMap:ut,displacementMap:g&&yn,emissiveMap:yt,normalMapObjectSpace:ut&&D.normalMapType===dD,normalMapTangentSpace:ut&&D.normalMapType===cl,metalnessMap:wt,roughnessMap:X,anisotropy:N,anisotropyMap:Qe,clearcoat:ve,clearcoatMap:tt,clearcoatNormalMap:vt,clearcoatRoughnessMap:Ne,dispersion:De,iridescence:ke,iridescenceMap:nt,iridescenceThicknessMap:Rt,sheen:Le,sheenColorMap:ct,sheenRoughnessMap:$e,specularMap:bt,specularColorMap:Ie,specularIntensityMap:it,transmission:lt,transmissionMap:ee,thicknessMap:He,gradientMap:oe,opaque:D.transparent===!1&&D.blending===No&&D.alphaToCoverage===!1,alphaMap:Ce,alphaTest:Ge,alphaHash:gt,combine:D.combine,mapUv:ft&&T(D.map.channel),aoMapUv:Jt&&T(D.aoMap.channel),lightMapUv:Ut&&T(D.lightMap.channel),bumpMapUv:jt&&T(D.bumpMap.channel),normalMapUv:ut&&T(D.normalMap.channel),displacementMapUv:yn&&T(D.displacementMap.channel),emissiveMapUv:yt&&T(D.emissiveMap.channel),metalnessMapUv:wt&&T(D.metalnessMap.channel),roughnessMapUv:X&&T(D.roughnessMap.channel),anisotropyMapUv:Qe&&T(D.anisotropyMap.channel),clearcoatMapUv:tt&&T(D.clearcoatMap.channel),clearcoatNormalMapUv:vt&&T(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ne&&T(D.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&T(D.iridescenceMap.channel),iridescenceThicknessMapUv:Rt&&T(D.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&T(D.sheenColorMap.channel),sheenRoughnessMapUv:$e&&T(D.sheenRoughnessMap.channel),specularMapUv:bt&&T(D.specularMap.channel),specularColorMapUv:Ie&&T(D.specularColorMap.channel),specularIntensityMapUv:it&&T(D.specularIntensityMap.channel),transmissionMapUv:ee&&T(D.transmissionMap.channel),thicknessMapUv:He&&T(D.thicknessMap.channel),alphaMapUv:Ce&&T(D.alphaMap.channel),vertexTangents:!!me.attributes.tangent&&(ut||N),vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!me.attributes.color&&me.attributes.color.itemSize===4,pointsUvs:re.isPoints===!0&&!!me.attributes.uv&&(ft||Ce),fog:!!de,useFog:D.fog===!0,fogExp2:!!de&&de.isFogExp2,flatShading:D.flatShading===!0,sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:re.isSkinnedMesh===!0,morphTargets:me.morphAttributes.position!==void 0,morphNormals:me.morphAttributes.normal!==void 0,morphColors:me.morphAttributes.color!==void 0,morphTargetsCount:Ae,morphTextureStride:Pe,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:D.dithering,shadowMapEnabled:n.shadowMap.enabled&&V.length>0,shadowMapType:n.shadowMap.type,toneMapping:un,decodeVideoTexture:ft&&D.map.isVideoTexture===!0&&Kt.getTransfer(D.map.colorSpace)===pn,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===Si,flipSided:D.side===Ei,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionClipCullDistance:Pt&&D.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Pt&&D.extensions.multiDraw===!0||ht)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:D.customProgramCacheKey()};return Ln.vertexUv1s=h.has(1),Ln.vertexUv2s=h.has(2),Ln.vertexUv3s=h.has(3),h.clear(),Ln}function b(D){const L=[];if(D.shaderID?L.push(D.shaderID):(L.push(D.customVertexShaderID),L.push(D.customFragmentShaderID)),D.defines!==void 0)for(const V in D.defines)L.push(V),L.push(D.defines[V]);return D.isRawShaderMaterial===!1&&(A(L,D),E(L,D),L.push(n.outputColorSpace)),L.push(D.customProgramCacheKey),L.join()}function A(D,L){D.push(L.precision),D.push(L.outputColorSpace),D.push(L.envMapMode),D.push(L.envMapCubeUVHeight),D.push(L.mapUv),D.push(L.alphaMapUv),D.push(L.lightMapUv),D.push(L.aoMapUv),D.push(L.bumpMapUv),D.push(L.normalMapUv),D.push(L.displacementMapUv),D.push(L.emissiveMapUv),D.push(L.metalnessMapUv),D.push(L.roughnessMapUv),D.push(L.anisotropyMapUv),D.push(L.clearcoatMapUv),D.push(L.clearcoatNormalMapUv),D.push(L.clearcoatRoughnessMapUv),D.push(L.iridescenceMapUv),D.push(L.iridescenceThicknessMapUv),D.push(L.sheenColorMapUv),D.push(L.sheenRoughnessMapUv),D.push(L.specularMapUv),D.push(L.specularColorMapUv),D.push(L.specularIntensityMapUv),D.push(L.transmissionMapUv),D.push(L.thicknessMapUv),D.push(L.combine),D.push(L.fogExp2),D.push(L.sizeAttenuation),D.push(L.morphTargetsCount),D.push(L.morphAttributeCount),D.push(L.numDirLights),D.push(L.numPointLights),D.push(L.numSpotLights),D.push(L.numSpotLightMaps),D.push(L.numHemiLights),D.push(L.numRectAreaLights),D.push(L.numDirLightShadows),D.push(L.numPointLightShadows),D.push(L.numSpotLightShadows),D.push(L.numSpotLightShadowsWithMaps),D.push(L.numLightProbes),D.push(L.shadowMapType),D.push(L.toneMapping),D.push(L.numClippingPlanes),D.push(L.numClipIntersection),D.push(L.depthPacking)}function E(D,L){l.disableAll(),L.supportsVertexTextures&&l.enable(0),L.instancing&&l.enable(1),L.instancingColor&&l.enable(2),L.instancingMorph&&l.enable(3),L.matcap&&l.enable(4),L.envMap&&l.enable(5),L.normalMapObjectSpace&&l.enable(6),L.normalMapTangentSpace&&l.enable(7),L.clearcoat&&l.enable(8),L.iridescence&&l.enable(9),L.alphaTest&&l.enable(10),L.vertexColors&&l.enable(11),L.vertexAlphas&&l.enable(12),L.vertexUv1s&&l.enable(13),L.vertexUv2s&&l.enable(14),L.vertexUv3s&&l.enable(15),L.vertexTangents&&l.enable(16),L.anisotropy&&l.enable(17),L.alphaHash&&l.enable(18),L.batching&&l.enable(19),L.dispersion&&l.enable(20),L.batchingColor&&l.enable(21),D.push(l.mask),l.disableAll(),L.fog&&l.enable(0),L.useFog&&l.enable(1),L.flatShading&&l.enable(2),L.logarithmicDepthBuffer&&l.enable(3),L.skinning&&l.enable(4),L.morphTargets&&l.enable(5),L.morphNormals&&l.enable(6),L.morphColors&&l.enable(7),L.premultipliedAlpha&&l.enable(8),L.shadowMapEnabled&&l.enable(9),L.doubleSided&&l.enable(10),L.flipSided&&l.enable(11),L.useDepthPacking&&l.enable(12),L.dithering&&l.enable(13),L.transmission&&l.enable(14),L.sheen&&l.enable(15),L.opaque&&l.enable(16),L.pointsUvs&&l.enable(17),L.decodeVideoTexture&&l.enable(18),L.alphaToCoverage&&l.enable(19),D.push(l.mask)}function P(D){const L=w[D.type];let V;if(L){const ie=ki[L];V=AE.clone(ie.uniforms)}else V=D.uniforms;return V}function G(D,L){let V;for(let ie=0,re=m.length;ie0?i.push(b):v.transparent===!0?r.push(b):t.push(b)}function d(u,g,v,w,T,M){const b=a(u,g,v,w,T,M);v.transmission>0?i.unshift(b):v.transparent===!0?r.unshift(b):t.unshift(b)}function h(u,g){t.length>1&&t.sort(u||vO),i.length>1&&i.sort(g||Yw),r.length>1&&r.sort(g||Yw)}function m(){for(let u=e,g=n.length;u=s.length?(a=new $w,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function bO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new Je};break;case"SpotLight":t={position:new j,direction:new j,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new Je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":t={color:new Je,position:new j,halfWidth:new j,halfHeight:new j};break}return n[e.id]=t,t}}}function xO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let wO=0;function SO(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function MO(n){const e=new bO,t=xO(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)i.probe.push(new j);const r=new j,s=new ot,a=new ot;function l(h){let m=0,u=0,g=0;for(let D=0;D<9;D++)i.probe[D].set(0,0,0);let v=0,w=0,T=0,M=0,b=0,A=0,E=0,P=0,G=0,O=0,B=0;h.sort(SO);for(let D=0,L=h.length;D0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ze.LTC_FLOAT_1,i.rectAreaLTC2=Ze.LTC_FLOAT_2):(i.rectAreaLTC1=Ze.LTC_HALF_1,i.rectAreaLTC2=Ze.LTC_HALF_2)),i.ambient[0]=m,i.ambient[1]=u,i.ambient[2]=g;const F=i.hash;(F.directionalLength!==v||F.pointLength!==w||F.spotLength!==T||F.rectAreaLength!==M||F.hemiLength!==b||F.numDirectionalShadows!==A||F.numPointShadows!==E||F.numSpotShadows!==P||F.numSpotMaps!==G||F.numLightProbes!==B)&&(i.directional.length=v,i.spot.length=T,i.rectArea.length=M,i.point.length=w,i.hemi.length=b,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=E,i.pointShadowMap.length=E,i.spotShadow.length=P,i.spotShadowMap.length=P,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=E,i.spotLightMatrix.length=P+G-O,i.spotLightMap.length=G,i.numSpotLightShadowsWithMaps=O,i.numLightProbes=B,F.directionalLength=v,F.pointLength=w,F.spotLength=T,F.rectAreaLength=M,F.hemiLength=b,F.numDirectionalShadows=A,F.numPointShadows=E,F.numSpotShadows=P,F.numSpotMaps=G,F.numLightProbes=B,i.version=wO++)}function d(h,m){let u=0,g=0,v=0,w=0,T=0;const M=m.matrixWorldInverse;for(let b=0,A=h.length;b=a.length?(l=new qw(n),a.push(l)):l=a[s],l}function i(){e=new WeakMap}return{get:t,dispose:i}}class TO extends _i{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=cD,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class AO extends _i{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const CO=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,RO=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function PO(n,e,t){let i=new R_;const r=new et,s=new et,a=new $t,l=new TO({depthPacking:uD}),d=new AO,h={},m=t.maxTextureSize,u={[gs]:Ei,[Ei]:gs,[Si]:Si},g=new zi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new et},radius:{value:4}},vertexShader:CO,fragmentShader:RO}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const w=new On;w.setAttribute("position",new _n(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const T=new wn(w,g),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=aE;let b=this.type;this.render=function(O,B,F){if(M.enabled===!1||M.autoUpdate===!1&&M.needsUpdate===!1||O.length===0)return;const D=n.getRenderTarget(),L=n.getActiveCubeFace(),V=n.getActiveMipmapLevel(),ie=n.state;ie.setBlending(Gr),ie.buffers.color.setClear(1,1,1,1),ie.buffers.depth.setTest(!0),ie.setScissorTest(!1);const re=b!==ts&&this.type===ts,de=b===ts&&this.type!==ts;for(let me=0,$=O.length;me<$;me++){const ue=O[me],Y=ue.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",ue,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;r.copy(Y.mapSize);const pe=Y.getFrameExtents();if(r.multiply(pe),s.copy(Y.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(s.x=Math.floor(m/pe.x),r.x=s.x*pe.x,Y.mapSize.x=s.x),r.y>m&&(s.y=Math.floor(m/pe.y),r.y=s.y*pe.y,Y.mapSize.y=s.y)),Y.map===null||re===!0||de===!0){const Ae=this.type!==ts?{minFilter:Fn,magFilter:Fn}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Zs(r.x,r.y,Ae),Y.map.texture.name=ue.name+".shadowMap",Y.camera.updateProjectionMatrix()}n.setRenderTarget(Y.map),n.clear();const _e=Y.getViewportCount();for(let Ae=0;Ae<_e;Ae++){const Pe=Y.getViewport(Ae);a.set(s.x*Pe.x,s.y*Pe.y,s.x*Pe.z,s.y*Pe.w),ie.viewport(a),Y.updateMatrices(ue,Ae),i=Y.getFrustum(),P(B,F,Y.camera,ue,this.type)}Y.isPointLightShadow!==!0&&this.type===ts&&A(Y,F),Y.needsUpdate=!1}b=this.type,M.needsUpdate=!1,n.setRenderTarget(D,L,V)};function A(O,B){const F=e.update(T);g.defines.VSM_SAMPLES!==O.blurSamples&&(g.defines.VSM_SAMPLES=O.blurSamples,v.defines.VSM_SAMPLES=O.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),O.mapPass===null&&(O.mapPass=new Zs(r.x,r.y)),g.uniforms.shadow_pass.value=O.map.texture,g.uniforms.resolution.value=O.mapSize,g.uniforms.radius.value=O.radius,n.setRenderTarget(O.mapPass),n.clear(),n.renderBufferDirect(B,null,F,g,T,null),v.uniforms.shadow_pass.value=O.mapPass.texture,v.uniforms.resolution.value=O.mapSize,v.uniforms.radius.value=O.radius,n.setRenderTarget(O.map),n.clear(),n.renderBufferDirect(B,null,F,v,T,null)}function E(O,B,F,D){let L=null;const V=F.isPointLight===!0?O.customDistanceMaterial:O.customDepthMaterial;if(V!==void 0)L=V;else if(L=F.isPointLight===!0?d:l,n.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0){const ie=L.uuid,re=B.uuid;let de=h[ie];de===void 0&&(de={},h[ie]=de);let me=de[re];me===void 0&&(me=L.clone(),de[re]=me,B.addEventListener("dispose",G)),L=me}if(L.visible=B.visible,L.wireframe=B.wireframe,D===ts?L.side=B.shadowSide!==null?B.shadowSide:B.side:L.side=B.shadowSide!==null?B.shadowSide:u[B.side],L.alphaMap=B.alphaMap,L.alphaTest=B.alphaTest,L.map=B.map,L.clipShadows=B.clipShadows,L.clippingPlanes=B.clippingPlanes,L.clipIntersection=B.clipIntersection,L.displacementMap=B.displacementMap,L.displacementScale=B.displacementScale,L.displacementBias=B.displacementBias,L.wireframeLinewidth=B.wireframeLinewidth,L.linewidth=B.linewidth,F.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const ie=n.properties.get(L);ie.light=F}return L}function P(O,B,F,D,L){if(O.visible===!1)return;if(O.layers.test(B.layers)&&(O.isMesh||O.isLine||O.isPoints)&&(O.castShadow||O.receiveShadow&&L===ts)&&(!O.frustumCulled||i.intersectsObject(O))){O.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,O.matrixWorld);const re=e.update(O),de=O.material;if(Array.isArray(de)){const me=re.groups;for(let $=0,ue=me.length;$=1):ue.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(ue)[1]),me=$>=2);let Y=null,pe={};const _e=n.getParameter(n.SCISSOR_BOX),Ae=n.getParameter(n.VIEWPORT),Pe=new $t().fromArray(_e),Ue=new $t().fromArray(Ae);function ae(ee,He,oe,Ce){const Ge=new Uint8Array(4),gt=n.createTexture();n.bindTexture(ee,gt),n.texParameteri(ee,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ee,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Pt=0;Pt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new et,m=new WeakMap;let u;const g=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(X,N){return v?new OffscreenCanvas(X,N):Dc("canvas")}function T(X,N,ve){let De=1;const ke=wt(X);if((ke.width>ve||ke.height>ve)&&(De=ve/Math.max(ke.width,ke.height)),De<1)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap||typeof VideoFrame<"u"&&X instanceof VideoFrame){const Le=Math.floor(De*ke.width),lt=Math.floor(De*ke.height);u===void 0&&(u=w(Le,lt));const Qe=N?w(Le,lt):u;return Qe.width=Le,Qe.height=lt,Qe.getContext("2d").drawImage(X,0,0,Le,lt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ke.width+"x"+ke.height+") to ("+Le+"x"+lt+")."),Qe}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ke.width+"x"+ke.height+")."),X;return X}function M(X){return X.generateMipmaps&&X.minFilter!==Fn&&X.minFilter!==ln}function b(X){n.generateMipmap(X)}function A(X,N,ve,De,ke=!1){if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let Le=N;if(N===n.RED&&(ve===n.FLOAT&&(Le=n.R32F),ve===n.HALF_FLOAT&&(Le=n.R16F),ve===n.UNSIGNED_BYTE&&(Le=n.R8)),N===n.RED_INTEGER&&(ve===n.UNSIGNED_BYTE&&(Le=n.R8UI),ve===n.UNSIGNED_SHORT&&(Le=n.R16UI),ve===n.UNSIGNED_INT&&(Le=n.R32UI),ve===n.BYTE&&(Le=n.R8I),ve===n.SHORT&&(Le=n.R16I),ve===n.INT&&(Le=n.R32I)),N===n.RG&&(ve===n.FLOAT&&(Le=n.RG32F),ve===n.HALF_FLOAT&&(Le=n.RG16F),ve===n.UNSIGNED_BYTE&&(Le=n.RG8)),N===n.RG_INTEGER&&(ve===n.UNSIGNED_BYTE&&(Le=n.RG8UI),ve===n.UNSIGNED_SHORT&&(Le=n.RG16UI),ve===n.UNSIGNED_INT&&(Le=n.RG32UI),ve===n.BYTE&&(Le=n.RG8I),ve===n.SHORT&&(Le=n.RG16I),ve===n.INT&&(Le=n.RG32I)),N===n.RGB&&ve===n.UNSIGNED_INT_5_9_9_9_REV&&(Le=n.RGB9_E5),N===n.RGBA){const lt=ke?hh:Kt.getTransfer(De);ve===n.FLOAT&&(Le=n.RGBA32F),ve===n.HALF_FLOAT&&(Le=n.RGBA16F),ve===n.UNSIGNED_BYTE&&(Le=lt===pn?n.SRGB8_ALPHA8:n.RGBA8),ve===n.UNSIGNED_SHORT_4_4_4_4&&(Le=n.RGBA4),ve===n.UNSIGNED_SHORT_5_5_5_1&&(Le=n.RGB5_A1)}return(Le===n.R16F||Le===n.R32F||Le===n.RG16F||Le===n.RG32F||Le===n.RGBA16F||Le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Le}function E(X,N){let ve;return X?N===null||N===Da||N===tl?ve=n.DEPTH24_STENCIL8:N===Un?ve=n.DEPTH32F_STENCIL8:N===Pc&&(ve=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):N===null||N===Da||N===tl?ve=n.DEPTH_COMPONENT24:N===Un?ve=n.DEPTH_COMPONENT32F:N===Pc&&(ve=n.DEPTH_COMPONENT16),ve}function P(X,N){return M(X)===!0||X.isFramebufferTexture&&X.minFilter!==Fn&&X.minFilter!==ln?Math.log2(Math.max(N.width,N.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?N.mipmaps.length:1}function G(X){const N=X.target;N.removeEventListener("dispose",G),B(N),N.isVideoTexture&&m.delete(N)}function O(X){const N=X.target;N.removeEventListener("dispose",O),D(N)}function B(X){const N=i.get(X);if(N.__webglInit===void 0)return;const ve=X.source,De=g.get(ve);if(De){const ke=De[N.__cacheKey];ke.usedTimes--,ke.usedTimes===0&&F(X),Object.keys(De).length===0&&g.delete(ve)}i.remove(X)}function F(X){const N=i.get(X);n.deleteTexture(N.__webglTexture);const ve=X.source,De=g.get(ve);delete De[N.__cacheKey],a.memory.textures--}function D(X){const N=i.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let De=0;De<6;De++){if(Array.isArray(N.__webglFramebuffer[De]))for(let ke=0;ke=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+r.maxTextures),L+=1,X}function re(X){const N=[];return N.push(X.wrapS),N.push(X.wrapT),N.push(X.wrapR||0),N.push(X.magFilter),N.push(X.minFilter),N.push(X.anisotropy),N.push(X.internalFormat),N.push(X.format),N.push(X.type),N.push(X.generateMipmaps),N.push(X.premultiplyAlpha),N.push(X.flipY),N.push(X.unpackAlignment),N.push(X.colorSpace),N.join()}function de(X,N){const ve=i.get(X);if(X.isVideoTexture&&yn(X),X.isRenderTargetTexture===!1&&X.version>0&&ve.__version!==X.version){const De=X.image;if(De===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(De.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ue(ve,X,N);return}}t.bindTexture(n.TEXTURE_2D,ve.__webglTexture,n.TEXTURE0+N)}function me(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){Ue(ve,X,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ve.__webglTexture,n.TEXTURE0+N)}function $(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){Ue(ve,X,N);return}t.bindTexture(n.TEXTURE_3D,ve.__webglTexture,n.TEXTURE0+N)}function ue(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){ae(ve,X,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ve.__webglTexture,n.TEXTURE0+N)}const Y={[Vr]:n.REPEAT,[ti]:n.CLAMP_TO_EDGE,[dh]:n.MIRRORED_REPEAT},pe={[Fn]:n.NEAREST,[cE]:n.NEAREST_MIPMAP_NEAREST,[ql]:n.NEAREST_MIPMAP_LINEAR,[ln]:n.LINEAR,[Rd]:n.LINEAR_MIPMAP_NEAREST,[Er]:n.LINEAR_MIPMAP_LINEAR},_e={[hD]:n.NEVER,[vD]:n.ALWAYS,[fD]:n.LESS,[bE]:n.LEQUAL,[pD]:n.EQUAL,[_D]:n.GEQUAL,[mD]:n.GREATER,[gD]:n.NOTEQUAL};function Ae(X,N){if(N.type===Un&&e.has("OES_texture_float_linear")===!1&&(N.magFilter===ln||N.magFilter===Rd||N.magFilter===ql||N.magFilter===Er||N.minFilter===ln||N.minFilter===Rd||N.minFilter===ql||N.minFilter===Er)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(X,n.TEXTURE_WRAP_S,Y[N.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,Y[N.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,Y[N.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,pe[N.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,pe[N.minFilter]),N.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,_e[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===Fn||N.minFilter!==ql&&N.minFilter!==Er||N.type===Un&&e.has("OES_texture_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){const ve=e.get("EXT_texture_filter_anisotropic");n.texParameterf(X,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,r.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function Pe(X,N){let ve=!1;X.__webglInit===void 0&&(X.__webglInit=!0,N.addEventListener("dispose",G));const De=N.source;let ke=g.get(De);ke===void 0&&(ke={},g.set(De,ke));const Le=re(N);if(Le!==X.__cacheKey){ke[Le]===void 0&&(ke[Le]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,ve=!0),ke[Le].usedTimes++;const lt=ke[X.__cacheKey];lt!==void 0&&(ke[X.__cacheKey].usedTimes--,lt.usedTimes===0&&F(N)),X.__cacheKey=Le,X.__webglTexture=ke[Le].texture}return ve}function Ue(X,N,ve){let De=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(De=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(De=n.TEXTURE_3D);const ke=Pe(X,N),Le=N.source;t.bindTexture(De,X.__webglTexture,n.TEXTURE0+ve);const lt=i.get(Le);if(Le.version!==lt.__version||ke===!0){t.activeTexture(n.TEXTURE0+ve);const Qe=Kt.getPrimaries(Kt.workingColorSpace),tt=N.colorSpace===ss?null:Kt.getPrimaries(N.colorSpace),vt=N.colorSpace===ss||Qe===tt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,vt);let Ne=T(N.image,!1,r.maxTextureSize);Ne=yt(N,Ne);const nt=s.convert(N.format,N.colorSpace),Rt=s.convert(N.type);let ct=A(N.internalFormat,nt,Rt,N.colorSpace,N.isVideoTexture);Ae(De,N);let $e;const bt=N.mipmaps,Ie=N.isVideoTexture!==!0,it=lt.__version===void 0||ke===!0,ee=Le.dataReady,He=P(N,Ne);if(N.isDepthTexture)ct=E(N.format===nl,N.type),it&&(Ie?t.texStorage2D(n.TEXTURE_2D,1,ct,Ne.width,Ne.height):t.texImage2D(n.TEXTURE_2D,0,ct,Ne.width,Ne.height,0,nt,Rt,null));else if(N.isDataTexture)if(bt.length>0){Ie&&it&&t.texStorage2D(n.TEXTURE_2D,He,ct,bt[0].width,bt[0].height);for(let oe=0,Ce=bt.length;oe0){const Ge=Kw($e.width,$e.height,N.format,N.type);for(const gt of N.layerUpdates){const Pt=$e.data.subarray(gt*Ge/$e.data.BYTES_PER_ELEMENT,(gt+1)*Ge/$e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,gt,$e.width,$e.height,1,nt,Pt,0,0)}N.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,$e.width,$e.height,Ne.depth,nt,$e.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,oe,ct,$e.width,$e.height,Ne.depth,0,$e.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?ee&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,$e.width,$e.height,Ne.depth,nt,Rt,$e.data):t.texImage3D(n.TEXTURE_2D_ARRAY,oe,ct,$e.width,$e.height,Ne.depth,0,nt,Rt,$e.data)}else{Ie&&it&&t.texStorage2D(n.TEXTURE_2D,He,ct,bt[0].width,bt[0].height);for(let oe=0,Ce=bt.length;oe0){const oe=Kw(Ne.width,Ne.height,N.format,N.type);for(const Ce of N.layerUpdates){const Ge=Ne.data.subarray(Ce*oe/Ne.data.BYTES_PER_ELEMENT,(Ce+1)*oe/Ne.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ce,Ne.width,Ne.height,1,nt,Rt,Ge)}N.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Ne.width,Ne.height,Ne.depth,nt,Rt,Ne.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ct,Ne.width,Ne.height,Ne.depth,0,nt,Rt,Ne.data);else if(N.isData3DTexture)Ie?(it&&t.texStorage3D(n.TEXTURE_3D,He,ct,Ne.width,Ne.height,Ne.depth),ee&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Ne.width,Ne.height,Ne.depth,nt,Rt,Ne.data)):t.texImage3D(n.TEXTURE_3D,0,ct,Ne.width,Ne.height,Ne.depth,0,nt,Rt,Ne.data);else if(N.isFramebufferTexture){if(it)if(Ie)t.texStorage2D(n.TEXTURE_2D,He,ct,Ne.width,Ne.height);else{let oe=Ne.width,Ce=Ne.height;for(let Ge=0;Ge>=1,Ce>>=1}}else if(bt.length>0){if(Ie&&it){const oe=wt(bt[0]);t.texStorage2D(n.TEXTURE_2D,He,ct,oe.width,oe.height)}for(let oe=0,Ce=bt.length;oe0&&He++;const Ce=wt(nt[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,He,bt,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(Ne){Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,nt[Ce].width,nt[Ce].height,ct,$e,nt[Ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,bt,nt[Ce].width,nt[Ce].height,0,ct,$e,nt[Ce].data);for(let Ge=0;Ge>Le),nt=Math.max(1,N.height>>Le);ke===n.TEXTURE_3D||ke===n.TEXTURE_2D_ARRAY?t.texImage3D(ke,Le,tt,Ne,nt,N.depth,0,lt,Qe,null):t.texImage2D(ke,Le,tt,Ne,nt,0,lt,Qe,null)}t.bindFramebuffer(n.FRAMEBUFFER,X),ut(N)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,De,ke,i.get(ve).__webglTexture,0,jt(N)):(ke===n.TEXTURE_2D||ke>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ke<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,De,ke,i.get(ve).__webglTexture,Le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ce(X,N,ve){if(n.bindRenderbuffer(n.RENDERBUFFER,X),N.depthBuffer){const De=N.depthTexture,ke=De&&De.isDepthTexture?De.type:null,Le=E(N.stencilBuffer,ke),lt=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Qe=jt(N);ut(N)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qe,Le,N.width,N.height):ve?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qe,Le,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Le,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,lt,n.RENDERBUFFER,X)}else{const De=N.textures;for(let ke=0;ke1;if(lt||(De.__webglTexture===void 0&&(De.__webglTexture=n.createTexture()),De.__version=N.version,a.memory.textures++),Le){ve.__webglFramebuffer=[];for(let Qe=0;Qe<6;Qe++)if(N.mipmaps&&N.mipmaps.length>0){ve.__webglFramebuffer[Qe]=[];for(let tt=0;tt0){ve.__webglFramebuffer=[];for(let Qe=0;Qe0&&ut(X)===!1){ve.__webglMultisampledFramebuffer=n.createFramebuffer(),ve.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ve.__webglMultisampledFramebuffer);for(let Qe=0;Qe0)for(let tt=0;tt0)for(let tt=0;tt0){if(ut(X)===!1){const N=X.textures,ve=X.width,De=X.height;let ke=n.COLOR_BUFFER_BIT;const Le=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,lt=i.get(X),Qe=N.length>1;if(Qe)for(let tt=0;tt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function yn(X){const N=a.render.frame;m.get(X)!==N&&(m.set(X,N),X.update())}function yt(X,N){const ve=X.colorSpace,De=X.format,ke=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||ve!==Sn&&ve!==ss&&(Kt.getTransfer(ve)===pn?(De!==Vn||ke!==Bi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ve)),N}function wt(X){return typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement?(h.width=X.naturalWidth||X.width,h.height=X.naturalHeight||X.height):typeof VideoFrame<"u"&&X instanceof VideoFrame?(h.width=X.displayWidth,h.height=X.displayHeight):(h.width=X.width,h.height=X.height),h}this.allocateTextureUnit=ie,this.resetTextureUnits=V,this.setTexture2D=de,this.setTexture2DArray=me,this.setTexture3D=$,this.setTextureCube=ue,this.rebindTextures=ht,this.setupRenderTarget=ft,this.updateRenderTargetMipmap=Wt,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=ut}function kO(n,e){function t(i,r=ss){let s;const a=Kt.getTransfer(r);if(i===Bi)return n.UNSIGNED_BYTE;if(i===y_)return n.UNSIGNED_SHORT_4_4_4_4;if(i===b_)return n.UNSIGNED_SHORT_5_5_5_1;if(i===hE)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===uE)return n.BYTE;if(i===dE)return n.SHORT;if(i===Pc)return n.UNSIGNED_SHORT;if(i===v_)return n.INT;if(i===Da)return n.UNSIGNED_INT;if(i===Un)return n.FLOAT;if(i===gi)return n.HALF_FLOAT;if(i===fE)return n.ALPHA;if(i===pE)return n.RGB;if(i===Vn)return n.RGBA;if(i===mE)return n.LUMINANCE;if(i===gE)return n.LUMINANCE_ALPHA;if(i===Bo)return n.DEPTH_COMPONENT;if(i===nl)return n.DEPTH_STENCIL;if(i===Wc)return n.RED;if(i===x_)return n.RED_INTEGER;if(i===_E)return n.RG;if(i===w_)return n.RG_INTEGER;if(i===S_)return n.RGBA_INTEGER;if(i===Pd||i===Ld||i===Id||i===Dd)if(a===pn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Pd)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ld)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Id)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Dd)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Pd)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ld)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Id)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Dd)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Dm||i===km||i===Fm||i===Um)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Dm)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===km)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Fm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Um)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Om||i===Nm||i===Bm)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Om||i===Nm)return a===pn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Bm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===zm||i===Hm||i===Gm||i===Vm||i===Wm||i===jm||i===Xm||i===Ym||i===$m||i===qm||i===Km||i===Zm||i===Qm||i===Jm)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===zm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Hm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Gm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Vm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Wm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===jm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Xm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Ym)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===$m)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===qm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Km)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Zm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Qm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Jm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===kd||i===eg||i===tg)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===kd)return a===pn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===eg)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===tg)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===vE||i===ng||i===ig||i===rg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===kd)return s.COMPRESSED_RED_RGTC1_EXT;if(i===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===tl?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class FO extends mi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Nr=class extends sn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const UO={type:"move"};class _p{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Nr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Nr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Nr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const l=this._targetRay,d=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const T of e.hand.values()){const M=t.getJointPose(T,i),b=this._getHandJoint(h,T);M!==null&&(b.matrix.fromArray(M.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=M.radius),b.visible=M!==null}const m=h.joints["index-finger-tip"],u=h.joints["thumb-tip"],g=m.position.distanceTo(u.position),v=.02,w=.005;h.inputState.pinching&&g>v+w?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&g<=v-w&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else d!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(d.matrix.fromArray(s.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,s.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(s.linearVelocity)):d.hasLinearVelocity=!1,s.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(s.angularVelocity)):d.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(UO)))}return l!==null&&(l.visible=r!==null),d!==null&&(d.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Nr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const OO=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,NO=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class BO{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new qn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new zi({vertexShader:OO,fragmentShader:NO,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new wn(new Yc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class zO extends ul{constructor(e,t){super();const i=this;let r=null,s=1,a=null,l="local-floor",d=1,h=null,m=null,u=null,g=null,v=null,w=null;const T=new BO,M=t.getContextAttributes();let b=null,A=null;const E=[],P=[],G=new et;let O=null;const B=new mi;B.layers.enable(1),B.viewport=new $t;const F=new mi;F.layers.enable(2),F.viewport=new $t;const D=[B,F],L=new FO;L.layers.enable(1),L.layers.enable(2);let V=null,ie=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getGripSpace()},this.getHand=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getHandSpace()};function re(ae){const ge=P.indexOf(ae.inputSource);if(ge===-1)return;const ce=E[ge];ce!==void 0&&(ce.update(ae.inputSource,ae.frame,h||a),ce.dispatchEvent({type:ae.type,data:ae.inputSource}))}function de(){r.removeEventListener("select",re),r.removeEventListener("selectstart",re),r.removeEventListener("selectend",re),r.removeEventListener("squeeze",re),r.removeEventListener("squeezestart",re),r.removeEventListener("squeezeend",re),r.removeEventListener("end",de),r.removeEventListener("inputsourceschange",me);for(let ae=0;ae=0&&(P[Me]=null,E[Me].disconnect(ce))}for(let ge=0;ge=P.length){P.push(ce),Me=ht;break}else if(P[ht]===null){P[ht]=ce,Me=ht;break}if(Me===-1)break}const Ye=E[Me];Ye&&Ye.connect(ce)}}const $=new j,ue=new j;function Y(ae,ge,ce){$.setFromMatrixPosition(ge.matrixWorld),ue.setFromMatrixPosition(ce.matrixWorld);const Me=$.distanceTo(ue),Ye=ge.projectionMatrix.elements,ht=ce.projectionMatrix.elements,ft=Ye[14]/(Ye[10]-1),Wt=Ye[14]/(Ye[10]+1),Z=(Ye[9]+1)/Ye[5],Jt=(Ye[9]-1)/Ye[5],Ut=(Ye[8]-1)/Ye[0],jt=(ht[8]+1)/ht[0],ut=ft*Ut,yn=ft*jt,yt=Me/(-Ut+jt),wt=yt*-Ut;ge.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(wt),ae.translateZ(yt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert();const X=ft+yt,N=Wt+yt,ve=ut-wt,De=yn+(Me-wt),ke=Z*Wt/N*X,Le=Jt*Wt/N*X;ae.projectionMatrix.makePerspective(ve,De,ke,Le,X,N),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}function pe(ae,ge){ge===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ge.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(r===null)return;T.texture!==null&&(ae.near=T.depthNear,ae.far=T.depthFar),L.near=F.near=B.near=ae.near,L.far=F.far=B.far=ae.far,(V!==L.near||ie!==L.far)&&(r.updateRenderState({depthNear:L.near,depthFar:L.far}),V=L.near,ie=L.far,B.near=V,B.far=ie,F.near=V,F.far=ie,B.updateProjectionMatrix(),F.updateProjectionMatrix(),ae.updateProjectionMatrix());const ge=ae.parent,ce=L.cameras;pe(L,ge);for(let Me=0;Me0&&(M.alphaTest.value=b.alphaTest);const A=e.get(b),E=A.envMap,P=A.envMapRotation;E&&(M.envMap.value=E,ha.copy(P),ha.x*=-1,ha.y*=-1,ha.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ha.y*=-1,ha.z*=-1),M.envMapRotation.value.setFromMatrix4(HO.makeRotationFromEuler(ha)),M.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,M.reflectivity.value=b.reflectivity,M.ior.value=b.ior,M.refractionRatio.value=b.refractionRatio),b.lightMap&&(M.lightMap.value=b.lightMap,M.lightMapIntensity.value=b.lightMapIntensity,t(b.lightMap,M.lightMapTransform)),b.aoMap&&(M.aoMap.value=b.aoMap,M.aoMapIntensity.value=b.aoMapIntensity,t(b.aoMap,M.aoMapTransform))}function a(M,b){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform))}function l(M,b){M.dashSize.value=b.dashSize,M.totalSize.value=b.dashSize+b.gapSize,M.scale.value=b.scale}function d(M,b,A,E){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,M.size.value=b.size*A,M.scale.value=E*.5,b.map&&(M.map.value=b.map,t(b.map,M.uvTransform)),b.alphaMap&&(M.alphaMap.value=b.alphaMap,t(b.alphaMap,M.alphaMapTransform)),b.alphaTest>0&&(M.alphaTest.value=b.alphaTest)}function h(M,b){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,M.rotation.value=b.rotation,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform)),b.alphaMap&&(M.alphaMap.value=b.alphaMap,t(b.alphaMap,M.alphaMapTransform)),b.alphaTest>0&&(M.alphaTest.value=b.alphaTest)}function m(M,b){M.specular.value.copy(b.specular),M.shininess.value=Math.max(b.shininess,1e-4)}function u(M,b){b.gradientMap&&(M.gradientMap.value=b.gradientMap)}function g(M,b){M.metalness.value=b.metalness,b.metalnessMap&&(M.metalnessMap.value=b.metalnessMap,t(b.metalnessMap,M.metalnessMapTransform)),M.roughness.value=b.roughness,b.roughnessMap&&(M.roughnessMap.value=b.roughnessMap,t(b.roughnessMap,M.roughnessMapTransform)),b.envMap&&(M.envMapIntensity.value=b.envMapIntensity)}function v(M,b,A){M.ior.value=b.ior,b.sheen>0&&(M.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),M.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(M.sheenColorMap.value=b.sheenColorMap,t(b.sheenColorMap,M.sheenColorMapTransform)),b.sheenRoughnessMap&&(M.sheenRoughnessMap.value=b.sheenRoughnessMap,t(b.sheenRoughnessMap,M.sheenRoughnessMapTransform))),b.clearcoat>0&&(M.clearcoat.value=b.clearcoat,M.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(M.clearcoatMap.value=b.clearcoatMap,t(b.clearcoatMap,M.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(M.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,t(b.clearcoatRoughnessMap,M.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(M.clearcoatNormalMap.value=b.clearcoatNormalMap,t(b.clearcoatNormalMap,M.clearcoatNormalMapTransform),M.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===Ei&&M.clearcoatNormalScale.value.negate())),b.dispersion>0&&(M.dispersion.value=b.dispersion),b.iridescence>0&&(M.iridescence.value=b.iridescence,M.iridescenceIOR.value=b.iridescenceIOR,M.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],M.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(M.iridescenceMap.value=b.iridescenceMap,t(b.iridescenceMap,M.iridescenceMapTransform)),b.iridescenceThicknessMap&&(M.iridescenceThicknessMap.value=b.iridescenceThicknessMap,t(b.iridescenceThicknessMap,M.iridescenceThicknessMapTransform))),b.transmission>0&&(M.transmission.value=b.transmission,M.transmissionSamplerMap.value=A.texture,M.transmissionSamplerSize.value.set(A.width,A.height),b.transmissionMap&&(M.transmissionMap.value=b.transmissionMap,t(b.transmissionMap,M.transmissionMapTransform)),M.thickness.value=b.thickness,b.thicknessMap&&(M.thicknessMap.value=b.thicknessMap,t(b.thicknessMap,M.thicknessMapTransform)),M.attenuationDistance.value=b.attenuationDistance,M.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(M.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(M.anisotropyMap.value=b.anisotropyMap,t(b.anisotropyMap,M.anisotropyMapTransform))),M.specularIntensity.value=b.specularIntensity,M.specularColor.value.copy(b.specularColor),b.specularColorMap&&(M.specularColorMap.value=b.specularColorMap,t(b.specularColorMap,M.specularColorMapTransform)),b.specularIntensityMap&&(M.specularIntensityMap.value=b.specularIntensityMap,t(b.specularIntensityMap,M.specularIntensityMapTransform))}function w(M,b){b.matcap&&(M.matcap.value=b.matcap)}function T(M,b){const A=e.get(b).light;M.referencePosition.value.setFromMatrixPosition(A.matrixWorld),M.nearDistance.value=A.shadow.camera.near,M.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function VO(n,e,t,i){let r={},s={},a=[];const l=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function d(A,E){const P=E.program;i.uniformBlockBinding(A,P)}function h(A,E){let P=r[A.id];P===void 0&&(w(A),P=m(A),r[A.id]=P,A.addEventListener("dispose",M));const G=E.program;i.updateUBOMapping(A,G);const O=e.render.frame;s[A.id]!==O&&(g(A),s[A.id]=O)}function m(A){const E=u();A.__bindingPointIndex=E;const P=n.createBuffer(),G=A.__size,O=A.usage;return n.bindBuffer(n.UNIFORM_BUFFER,P),n.bufferData(n.UNIFORM_BUFFER,G,O),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,E,P),P}function u(){for(let A=0;A0&&(P+=G-O),A.__size=P,A.__cache={},this}function T(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function M(A){const E=A.target;E.removeEventListener("dispose",M);const P=a.indexOf(E.__bindingPointIndex);a.splice(P,1),n.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function b(){for(const A in r)n.deleteBuffer(r[A]);a=[],r={},s={}}return{bind:d,update:h,dispose:b}}class WO{constructor(e={}){const{canvas:t=FD(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:h=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=a;const v=new Uint32Array(4),w=new Int32Array(4);let T=null,M=null;const b=[],A=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=on,this.toneMapping=$s,this.toneMappingExposure=1;const E=this;let P=!1,G=0,O=0,B=null,F=-1,D=null;const L=new $t,V=new $t;let ie=null;const re=new Je(0);let de=0,me=t.width,$=t.height,ue=1,Y=null,pe=null;const _e=new $t(0,0,me,$),Ae=new $t(0,0,me,$);let Pe=!1;const Ue=new R_;let ae=!1,ge=!1;const ce=new ot,Me=new j,Ye=new $t,ht={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ft=!1;function Wt(){return B===null?ue:1}let Z=i;function Jt(z,q){return t.getContext(z,q)}try{const z={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:d,preserveDrawingBuffer:h,powerPreference:m,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${g_}`),t.addEventListener("webglcontextlost",oe,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Ge,!1),Z===null){const q="webgl2";if(Z=Jt(q,z),Z===null)throw Jt(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(z){throw console.error("THREE.WebGLRenderer: "+z.message),z}let Ut,jt,ut,yn,yt,wt,X,N,ve,De,ke,Le,lt,Qe,tt,vt,Ne,nt,Rt,ct,$e,bt,Ie,it;function ee(){Ut=new ZF(Z),Ut.init(),bt=new kO(Z,Ut),jt=new jF(Z,Ut,e,bt),ut=new LO(Z),yn=new eU(Z),yt=new _O,wt=new DO(Z,Ut,ut,yt,jt,bt,yn),X=new YF(E),N=new KF(E),ve=new ok(Z),Ie=new VF(Z,ve),De=new QF(Z,ve,yn,Ie),ke=new nU(Z,De,ve,yn),Rt=new tU(Z,jt,wt),vt=new XF(yt),Le=new gO(E,X,N,Ut,jt,Ie,vt),lt=new GO(E,yt),Qe=new yO,tt=new EO(Ut),nt=new GF(E,X,N,ut,ke,g,d),Ne=new PO(E,ke,jt),it=new VO(Z,yn,jt,ut),ct=new WF(Z,Ut,yn),$e=new JF(Z,Ut,yn),yn.programs=Le.programs,E.capabilities=jt,E.extensions=Ut,E.properties=yt,E.renderLists=Qe,E.shadowMap=Ne,E.state=ut,E.info=yn}ee();const He=new zO(E,Z);this.xr=He,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const z=Ut.get("WEBGL_lose_context");z&&z.loseContext()},this.forceContextRestore=function(){const z=Ut.get("WEBGL_lose_context");z&&z.restoreContext()},this.getPixelRatio=function(){return ue},this.setPixelRatio=function(z){z!==void 0&&(ue=z,this.setSize(me,$,!1))},this.getSize=function(z){return z.set(me,$)},this.setSize=function(z,q,S=!0){if(He.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}me=z,$=q,t.width=Math.floor(z*ue),t.height=Math.floor(q*ue),S===!0&&(t.style.width=z+"px",t.style.height=q+"px"),this.setViewport(0,0,z,q)},this.getDrawingBufferSize=function(z){return z.set(me*ue,$*ue).floor()},this.setDrawingBufferSize=function(z,q,S){me=z,$=q,ue=S,t.width=Math.floor(z*S),t.height=Math.floor(q*S),this.setViewport(0,0,z,q)},this.getCurrentViewport=function(z){return z.copy(L)},this.getViewport=function(z){return z.copy(_e)},this.setViewport=function(z,q,S,I){z.isVector4?_e.set(z.x,z.y,z.z,z.w):_e.set(z,q,S,I),ut.viewport(L.copy(_e).multiplyScalar(ue).round())},this.getScissor=function(z){return z.copy(Ae)},this.setScissor=function(z,q,S,I){z.isVector4?Ae.set(z.x,z.y,z.z,z.w):Ae.set(z,q,S,I),ut.scissor(V.copy(Ae).multiplyScalar(ue).round())},this.getScissorTest=function(){return Pe},this.setScissorTest=function(z){ut.setScissorTest(Pe=z)},this.setOpaqueSort=function(z){Y=z},this.setTransparentSort=function(z){pe=z},this.getClearColor=function(z){return z.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(z=!0,q=!0,S=!0){let I=0;if(z){let k=!1;if(B!==null){const W=B.texture.format;k=W===S_||W===w_||W===x_}if(k){const W=B.texture.type,te=W===Bi||W===Da||W===Pc||W===tl||W===y_||W===b_,Q=nt.getClearColor(),le=nt.getClearAlpha(),R=Q.r,fe=Q.g,J=Q.b;te?(v[0]=R,v[1]=fe,v[2]=J,v[3]=le,Z.clearBufferuiv(Z.COLOR,0,v)):(w[0]=R,w[1]=fe,w[2]=J,w[3]=le,Z.clearBufferiv(Z.COLOR,0,w))}else I|=Z.COLOR_BUFFER_BIT}q&&(I|=Z.DEPTH_BUFFER_BIT),S&&(I|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(I)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",oe,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Ge,!1),Qe.dispose(),tt.dispose(),yt.dispose(),X.dispose(),N.dispose(),ke.dispose(),Ie.dispose(),it.dispose(),Le.dispose(),He.dispose(),He.removeEventListener("sessionstart",ii),He.removeEventListener("sessionend",Nt),fr.stop()};function oe(z){z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const z=yn.autoReset,q=Ne.enabled,S=Ne.autoUpdate,I=Ne.needsUpdate,k=Ne.type;ee(),yn.autoReset=z,Ne.enabled=q,Ne.autoUpdate=S,Ne.needsUpdate=I,Ne.type=k}function Ge(z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function gt(z){const q=z.target;q.removeEventListener("dispose",gt),Pt(q)}function Pt(z){un(z),yt.remove(z)}function un(z){const q=yt.get(z).programs;q!==void 0&&(q.forEach(function(S){Le.releaseProgram(S)}),z.isShaderMaterial&&Le.releaseShaderCache(z))}this.renderBufferDirect=function(z,q,S,I,k,W){q===null&&(q=ht);const te=k.isMesh&&k.matrixWorld.determinant()<0,Q=Ba(z,q,S,I,k);ut.setMaterial(I,te);let le=S.index,R=1;if(I.wireframe===!0){if(le=De.getWireframeAttribute(S),le===void 0)return;R=2}const fe=S.drawRange,J=S.attributes.position;let be=fe.start*R,Fe=(fe.start+fe.count)*R;W!==null&&(be=Math.max(be,W.start*R),Fe=Math.min(Fe,(W.start+W.count)*R)),le!==null?(be=Math.max(be,0),Fe=Math.min(Fe,le.count)):J!=null&&(be=Math.max(be,0),Fe=Math.min(Fe,J.count));const Oe=Fe-be;if(Oe<0||Oe===1/0)return;Ie.setup(k,I,Q,S,le);let We,Ee=ct;if(le!==null&&(We=ve.get(le),Ee=$e,Ee.setIndex(We)),k.isMesh)I.wireframe===!0?(ut.setLineWidth(I.wireframeLinewidth*Wt()),Ee.setMode(Z.LINES)):Ee.setMode(Z.TRIANGLES);else if(k.isLine){let Te=I.linewidth;Te===void 0&&(Te=1),ut.setLineWidth(Te*Wt()),k.isLineSegments?Ee.setMode(Z.LINES):k.isLineLoop?Ee.setMode(Z.LINE_LOOP):Ee.setMode(Z.LINE_STRIP)}else k.isPoints?Ee.setMode(Z.POINTS):k.isSprite&&Ee.setMode(Z.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Ee.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(Ut.get("WEBGL_multi_draw"))Ee.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const Te=k._multiDrawStarts,Xe=k._multiDrawCounts,qe=k._multiDrawCount,Tt=le?ve.get(le).bytesPerElement:1,Ht=yt.get(I).currentProgram.getUniforms();for(let en=0;en{function W(){if(I.forEach(function(te){yt.get(te).currentProgram.isReady()&&I.delete(te)}),I.size===0){k(z);return}setTimeout(W,10)}Ut.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let Ot=null;function oi(z){Ot&&Ot(z)}function ii(){fr.stop()}function Nt(){fr.start()}const fr=new IE;fr.setAnimationLoop(oi),typeof self<"u"&&fr.setContext(self),this.setAnimationLoop=function(z){Ot=z,He.setAnimationLoop(z),z===null?fr.stop():fr.start()},He.addEventListener("sessionstart",ii),He.addEventListener("sessionend",Nt),this.render=function(z,q){if(q!==void 0&&q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),He.enabled===!0&&He.isPresenting===!0&&(He.cameraAutoUpdate===!0&&He.updateCamera(q),q=He.getCamera()),z.isScene===!0&&z.onBeforeRender(E,z,q,B),M=tt.get(z,A.length),M.init(q),A.push(M),ce.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),Ue.setFromProjectionMatrix(ce),ge=this.localClippingEnabled,ae=vt.init(this.clippingPlanes,ge),T=Qe.get(z,b.length),T.init(),b.push(T),He.enabled===!0&&He.isPresenting===!0){const W=E.xr.getDepthSensingMesh();W!==null&&ys(W,q,-1/0,E.sortObjects)}ys(z,q,0,E.sortObjects),T.finish(),E.sortObjects===!0&&T.sort(Y,pe),ft=He.enabled===!1||He.isPresenting===!1||He.hasDepthSensing()===!1,ft&&nt.addToRenderList(T,z),this.info.render.frame++,ae===!0&&vt.beginShadows();const S=M.state.shadowsArray;Ne.render(S,z,q),ae===!0&&vt.endShadows(),this.info.autoReset===!0&&this.info.reset();const I=T.opaque,k=T.transmissive;if(M.setupLights(),q.isArrayCamera){const W=q.cameras;if(k.length>0)for(let te=0,Q=W.length;te0&&ra(I,k,z,q),ft&&nt.render(z),Ci(T,z,q);B!==null&&(wt.updateMultisampleRenderTarget(B),wt.updateRenderTargetMipmap(B)),z.isScene===!0&&z.onAfterRender(E,z,q),Ie.resetDefaultState(),F=-1,D=null,A.pop(),A.length>0?(M=A[A.length-1],ae===!0&&vt.setGlobalState(E.clippingPlanes,M.state.camera)):M=null,b.pop(),b.length>0?T=b[b.length-1]:T=null};function ys(z,q,S,I){if(z.visible===!1)return;if(z.layers.test(q.layers)){if(z.isGroup)S=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(q);else if(z.isLight)M.pushLight(z),z.castShadow&&M.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||Ue.intersectsSprite(z)){I&&Ye.setFromMatrixPosition(z.matrixWorld).applyMatrix4(ce);const te=ke.update(z),Q=z.material;Q.visible&&T.push(z,te,Q,S,Ye.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||Ue.intersectsObject(z))){const te=ke.update(z),Q=z.material;if(I&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),Ye.copy(z.boundingSphere.center)):(te.boundingSphere===null&&te.computeBoundingSphere(),Ye.copy(te.boundingSphere.center)),Ye.applyMatrix4(z.matrixWorld).applyMatrix4(ce)),Array.isArray(Q)){const le=te.groups;for(let R=0,fe=le.length;R0&&Ri(k,q,S),W.length>0&&Ri(W,q,S),te.length>0&&Ri(te,q,S),ut.buffers.depth.setTest(!0),ut.buffers.depth.setMask(!0),ut.buffers.color.setMask(!0),ut.setPolygonOffset(!1)}function ra(z,q,S,I){if((S.isScene===!0?S.overrideMaterial:null)!==null)return;M.state.transmissionRenderTarget[I.id]===void 0&&(M.state.transmissionRenderTarget[I.id]=new Zs(1,1,{generateMipmaps:!0,type:Ut.has("EXT_color_buffer_half_float")||Ut.has("EXT_color_buffer_float")?gi:Bi,minFilter:Er,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const W=M.state.transmissionRenderTarget[I.id],te=I.viewport||L;W.setSize(te.z,te.w);const Q=E.getRenderTarget();E.setRenderTarget(W),E.getClearColor(re),de=E.getClearAlpha(),de<1&&E.setClearColor(16777215,.5),ft?nt.render(S):E.clear();const le=E.toneMapping;E.toneMapping=$s;const R=I.viewport;if(I.viewport!==void 0&&(I.viewport=void 0),M.setupLightsView(I),ae===!0&&vt.setGlobalState(E.clippingPlanes,I),Ri(z,S,I),wt.updateMultisampleRenderTarget(W),wt.updateRenderTargetMipmap(W),Ut.has("WEBGL_multisampled_render_to_texture")===!1){let fe=!1;for(let J=0,be=q.length;J0),J=!!S.morphAttributes.position,be=!!S.morphAttributes.normal,Fe=!!S.morphAttributes.color;let Oe=$s;I.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(Oe=E.toneMapping);const We=S.morphAttributes.position||S.morphAttributes.normal||S.morphAttributes.color,Ee=We!==void 0?We.length:0,Te=yt.get(I),Xe=M.state.lights;if(ae===!0&&(ge===!0||z!==D)){const Xt=z===D&&I.id===F;vt.setState(I,z,Xt)}let qe=!1;I.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==Xe.state.version||Te.outputColorSpace!==Q||k.isBatchedMesh&&Te.batching===!1||!k.isBatchedMesh&&Te.batching===!0||k.isBatchedMesh&&Te.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Te.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Te.instancing===!1||!k.isInstancedMesh&&Te.instancing===!0||k.isSkinnedMesh&&Te.skinning===!1||!k.isSkinnedMesh&&Te.skinning===!0||k.isInstancedMesh&&Te.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Te.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Te.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Te.instancingMorph===!1&&k.morphTexture!==null||Te.envMap!==le||I.fog===!0&&Te.fog!==W||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==vt.numPlanes||Te.numIntersection!==vt.numIntersection)||Te.vertexAlphas!==R||Te.vertexTangents!==fe||Te.morphTargets!==J||Te.morphNormals!==be||Te.morphColors!==Fe||Te.toneMapping!==Oe||Te.morphTargetsCount!==Ee)&&(qe=!0):(qe=!0,Te.__version=I.version);let Tt=Te.currentProgram;qe===!0&&(Tt=Qi(I,q,k));let Ht=!1,en=!1,Bt=!1;const pt=Tt.getUniforms(),Gt=Te.uniforms;if(ut.useProgram(Tt.program)&&(Ht=!0,en=!0,Bt=!0),I.id!==F&&(F=I.id,en=!0),Ht||D!==z){pt.setValue(Z,"projectionMatrix",z.projectionMatrix),pt.setValue(Z,"viewMatrix",z.matrixWorldInverse);const Xt=pt.map.cameraPosition;Xt!==void 0&&Xt.setValue(Z,Me.setFromMatrixPosition(z.matrixWorld)),jt.logarithmicDepthBuffer&&pt.setValue(Z,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshLambertMaterial||I.isMeshBasicMaterial||I.isMeshStandardMaterial||I.isShaderMaterial)&&pt.setValue(Z,"isOrthographic",z.isOrthographicCamera===!0),D!==z&&(D=z,en=!0,Bt=!0)}if(k.isSkinnedMesh){pt.setOptional(Z,k,"bindMatrix"),pt.setOptional(Z,k,"bindMatrixInverse");const Xt=k.skeleton;Xt&&(Xt.boneTexture===null&&Xt.computeBoneTexture(),pt.setValue(Z,"boneTexture",Xt.boneTexture,wt))}k.isBatchedMesh&&(pt.setOptional(Z,k,"batchingTexture"),pt.setValue(Z,"batchingTexture",k._matricesTexture,wt),pt.setOptional(Z,k,"batchingIdTexture"),pt.setValue(Z,"batchingIdTexture",k._indirectTexture,wt),pt.setOptional(Z,k,"batchingColorTexture"),k._colorsTexture!==null&&pt.setValue(Z,"batchingColorTexture",k._colorsTexture,wt));const In=S.morphAttributes;if((In.position!==void 0||In.normal!==void 0||In.color!==void 0)&&Rt.update(k,S,Tt),(en||Te.receiveShadow!==k.receiveShadow)&&(Te.receiveShadow=k.receiveShadow,pt.setValue(Z,"receiveShadow",k.receiveShadow)),I.isMeshGouraudMaterial&&I.envMap!==null&&(Gt.envMap.value=le,Gt.flipEnvMap.value=le.isCubeTexture&&le.isRenderTargetTexture===!1?-1:1),I.isMeshStandardMaterial&&I.envMap===null&&q.environment!==null&&(Gt.envMapIntensity.value=q.environmentIntensity),en&&(pt.setValue(Z,"toneMappingExposure",E.toneMappingExposure),Te.needsLights&&Ji(Gt,Bt),W&&I.fog===!0&<.refreshFogUniforms(Gt,W),lt.refreshMaterialUniforms(Gt,I,ue,$,M.state.transmissionRenderTarget[z.id]),Fd.upload(Z,xs(Te),Gt,wt)),I.isShaderMaterial&&I.uniformsNeedUpdate===!0&&(Fd.upload(Z,xs(Te),Gt,wt),I.uniformsNeedUpdate=!1),I.isSpriteMaterial&&pt.setValue(Z,"center",k.center),pt.setValue(Z,"modelViewMatrix",k.modelViewMatrix),pt.setValue(Z,"normalMatrix",k.normalMatrix),pt.setValue(Z,"modelMatrix",k.matrixWorld),I.isShaderMaterial||I.isRawShaderMaterial){const Xt=I.uniformsGroups;for(let St=0,Zt=Xt.length;St0&&wt.useMultisampledRTT(z)===!1?k=yt.get(z).__webglMultisampledFramebuffer:Array.isArray(fe)?k=fe[S]:k=fe,L.copy(z.viewport),V.copy(z.scissor),ie=z.scissorTest}else L.copy(_e).multiplyScalar(ue).floor(),V.copy(Ae).multiplyScalar(ue).floor(),ie=Pe;if(ut.bindFramebuffer(Z.FRAMEBUFFER,k)&&I&&ut.drawBuffers(z,k),ut.viewport(L),ut.scissor(V),ut.setScissorTest(ie),W){const le=yt.get(z.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+q,le.__webglTexture,S)}else if(te){const le=yt.get(z.texture),R=q||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,le.__webglTexture,S||0,R)}F=-1},this.readRenderTargetPixels=function(z,q,S,I,k,W,te){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Q=yt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&te!==void 0&&(Q=Q[te]),Q){ut.bindFramebuffer(Z.FRAMEBUFFER,Q);try{const le=z.texture,R=le.format,fe=le.type;if(!jt.textureFormatReadable(R)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!jt.textureTypeReadable(fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=z.width-I&&S>=0&&S<=z.height-k&&Z.readPixels(q,S,I,k,bt.convert(R),bt.convert(fe),W)}finally{const le=B!==null?yt.get(B).__webglFramebuffer:null;ut.bindFramebuffer(Z.FRAMEBUFFER,le)}}},this.readRenderTargetPixelsAsync=async function(z,q,S,I,k,W,te){if(!(z&&z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Q=yt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&te!==void 0&&(Q=Q[te]),Q){ut.bindFramebuffer(Z.FRAMEBUFFER,Q);try{const le=z.texture,R=le.format,fe=le.type;if(!jt.textureFormatReadable(R))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!jt.textureTypeReadable(fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(q>=0&&q<=z.width-I&&S>=0&&S<=z.height-k){const J=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,J),Z.bufferData(Z.PIXEL_PACK_BUFFER,W.byteLength,Z.STREAM_READ),Z.readPixels(q,S,I,k,bt.convert(R),bt.convert(fe),0),Z.flush();const be=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);await UD(Z,be,4);try{Z.bindBuffer(Z.PIXEL_PACK_BUFFER,J),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,W)}finally{Z.deleteBuffer(J),Z.deleteSync(be)}return W}}finally{const le=B!==null?yt.get(B).__webglFramebuffer:null;ut.bindFramebuffer(Z.FRAMEBUFFER,le)}}},this.copyFramebufferToTexture=function(z,q=null,S=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),q=arguments[0]||null,z=arguments[1]);const I=Math.pow(2,-S),k=Math.floor(z.image.width*I),W=Math.floor(z.image.height*I),te=q!==null?q.x:0,Q=q!==null?q.y:0;wt.setTexture2D(z,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,S,0,0,te,Q,k,W),ut.unbindTexture()},this.copyTextureToTexture=function(z,q,S=null,I=null,k=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),I=arguments[0]||null,z=arguments[1],q=arguments[2],k=arguments[3]||0,S=null);let W,te,Q,le,R,fe;S!==null?(W=S.max.x-S.min.x,te=S.max.y-S.min.y,Q=S.min.x,le=S.min.y):(W=z.image.width,te=z.image.height,Q=0,le=0),I!==null?(R=I.x,fe=I.y):(R=0,fe=0);const J=bt.convert(q.format),be=bt.convert(q.type);wt.setTexture2D(q,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,q.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,q.unpackAlignment);const Fe=Z.getParameter(Z.UNPACK_ROW_LENGTH),Oe=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),We=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ee=Z.getParameter(Z.UNPACK_SKIP_ROWS),Te=Z.getParameter(Z.UNPACK_SKIP_IMAGES),Xe=z.isCompressedTexture?z.mipmaps[k]:z.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Xe.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Xe.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Q),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,le),z.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,k,R,fe,W,te,J,be,Xe.data):z.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,k,R,fe,Xe.width,Xe.height,J,Xe.data):Z.texSubImage2D(Z.TEXTURE_2D,k,R,fe,W,te,J,be,Xe),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Fe),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Oe),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,We),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ee),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Te),k===0&&q.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),ut.unbindTexture()},this.copyTextureToTexture3D=function(z,q,S=null,I=null,k=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),S=arguments[0]||null,I=arguments[1]||null,z=arguments[2],q=arguments[3],k=arguments[4]||0);let W,te,Q,le,R,fe,J,be,Fe;const Oe=z.isCompressedTexture?z.mipmaps[k]:z.image;S!==null?(W=S.max.x-S.min.x,te=S.max.y-S.min.y,Q=S.max.z-S.min.z,le=S.min.x,R=S.min.y,fe=S.min.z):(W=Oe.width,te=Oe.height,Q=Oe.depth,le=0,R=0,fe=0),I!==null?(J=I.x,be=I.y,Fe=I.z):(J=0,be=0,Fe=0);const We=bt.convert(q.format),Ee=bt.convert(q.type);let Te;if(q.isData3DTexture)wt.setTexture3D(q,0),Te=Z.TEXTURE_3D;else if(q.isDataArrayTexture||q.isCompressedArrayTexture)wt.setTexture2DArray(q,0),Te=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,q.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,q.unpackAlignment);const Xe=Z.getParameter(Z.UNPACK_ROW_LENGTH),qe=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Tt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ht=Z.getParameter(Z.UNPACK_SKIP_ROWS),en=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Oe.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Oe.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,le),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,R),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,fe),z.isDataTexture||z.isData3DTexture?Z.texSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Ee,Oe.data):q.isCompressedArrayTexture?Z.compressedTexSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Oe.data):Z.texSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Ee,Oe),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Xe),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,qe),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Tt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ht),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,en),k===0&&q.generateMipmaps&&Z.generateMipmap(Te),ut.unbindTexture()},this.initRenderTarget=function(z){yt.get(z).__webglFramebuffer===void 0&&wt.setupRenderTarget(z)},this.initTexture=function(z){z.isCubeTexture?wt.setTextureCube(z,0):z.isData3DTexture?wt.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?wt.setTexture2DArray(z,0):wt.setTexture2D(z,0),ut.unbindTexture()},this.resetState=function(){G=0,O=0,B=null,ut.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===M_?"display-p3":"srgb",t.unpackColorSpace=Kt.workingColorSpace===Hh?"display-p3":"srgb"}}class kc extends sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Pn,this.environmentIntensity=1,this.environmentRotation=new Pn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class jO{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ag,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Cr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return T_("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;si)return;bp.applyMatrix4(n.matrixWorld);const d=e.ray.origin.distanceTo(bp);if(!(de.far))return{distance:d,point:aS.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const oS=new j,lS=new j;class bh extends Wh{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:d,index:e,face:null,object:a})}}class ZO{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let l=0,d=s-1,h;for(;l<=d;)if(r=Math.floor(l+(d-l)/2),h=i[r]-a,h<0)l=r+1;else if(h>0)d=r-1;else{d=r;break}if(r=d,i[r]===a)return r/(s-1);const m=i[r],g=i[r+1]-m,v=(a-m)/g;return(r+v)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),d=t||(a.isVector2?new et:new j);return d.copy(l).sub(a).normalize(),d}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new j,r=[],s=[],a=[],l=new j,d=new ot;for(let v=0;v<=e;v++){const w=v/e;r[v]=this.getTangentAt(w,new j)}s[0]=new j,a[0]=new j;let h=Number.MAX_VALUE;const m=Math.abs(r[0].x),u=Math.abs(r[0].y),g=Math.abs(r[0].z);m<=h&&(h=m,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),g<=h&&i.set(0,0,1),l.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),a[v]=a[v-1].clone(),l.crossVectors(r[v-1],r[v]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(Wn(r[v-1].dot(r[v]),-1,1));s[v].applyMatrix4(d.makeRotationAxis(l,w))}a[v].crossVectors(r[v],s[v])}if(t===!0){let v=Math.acos(Wn(s[0].dot(s[e]),-1,1));v/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(v=-v);for(let w=1;w<=e;w++)s[w].applyMatrix4(d.makeRotationAxis(r[w],v*w)),a[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}const QO={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=BE(n,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,d,h,m,u,g,v;if(i&&(s=iN(n,e,s,t)),n.length>80*t){l=h=n[0],d=m=n[1];for(let w=t;wh&&(h=u),g>m&&(m=g);v=Math.max(h-l,m-d),v=v!==0?32767/v:0}return Fc(s,a,t,l,d,v,0),a}};function BE(n,e,t,i,r){let s,a;if(r===pN(n,e,t,i)>0)for(s=e;s=e;s-=i)a=dS(s,n[s],n[s+1],a);return a&&jh(a,a.next)&&(Oc(a),a=a.next),a}function ka(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(jh(t,t.next)||Tn(t.prev,t,t.next)===0)){if(Oc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Fc(n,e,t,i,r,s,a){if(!n)return;!a&&s&&lN(n,i,r,s);let l=n,d,h;for(;n.prev!==n.next;){if(d=n.prev,h=n.next,s?eN(n,i,r,s):JO(n)){e.push(d.i/t|0),e.push(n.i/t|0),e.push(h.i/t|0),Oc(n),n=h.next,l=h.next;continue}if(n=h,n===l){a?a===1?(n=tN(ka(n),e,t),Fc(n,e,t,i,r,s,2)):a===2&&nN(n,e,t,i,r,s):Fc(ka(n),e,t,i,r,s,1);break}}}function JO(n){const e=n.prev,t=n,i=n.next;if(Tn(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,l=e.y,d=t.y,h=i.y,m=rs?r>a?r:a:s>a?s:a,v=l>d?l>h?l:h:d>h?d:h;let w=i.next;for(;w!==e;){if(w.x>=m&&w.x<=g&&w.y>=u&&w.y<=v&&Co(r,l,s,d,a,h,w.x,w.y)&&Tn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function eN(n,e,t,i){const r=n.prev,s=n,a=n.next;if(Tn(r,s,a)>=0)return!1;const l=r.x,d=s.x,h=a.x,m=r.y,u=s.y,g=a.y,v=ld?l>h?l:h:d>h?d:h,M=m>u?m>g?m:g:u>g?u:g,b=ug(v,w,e,t,i),A=ug(T,M,e,t,i);let E=n.prevZ,P=n.nextZ;for(;E&&E.z>=b&&P&&P.z<=A;){if(E.x>=v&&E.x<=T&&E.y>=w&&E.y<=M&&E!==r&&E!==a&&Co(l,m,d,u,h,g,E.x,E.y)&&Tn(E.prev,E,E.next)>=0||(E=E.prevZ,P.x>=v&&P.x<=T&&P.y>=w&&P.y<=M&&P!==r&&P!==a&&Co(l,m,d,u,h,g,P.x,P.y)&&Tn(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;E&&E.z>=b;){if(E.x>=v&&E.x<=T&&E.y>=w&&E.y<=M&&E!==r&&E!==a&&Co(l,m,d,u,h,g,E.x,E.y)&&Tn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;P&&P.z<=A;){if(P.x>=v&&P.x<=T&&P.y>=w&&P.y<=M&&P!==r&&P!==a&&Co(l,m,d,u,h,g,P.x,P.y)&&Tn(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function tN(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!jh(r,s)&&zE(r,i,i.next,s)&&Uc(r,s)&&Uc(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Oc(i),Oc(i.next),i=n=s),i=i.next}while(i!==n);return ka(i)}function nN(n,e,t,i,r,s){let a=n;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&dN(a,l)){let d=HE(a,l);a=ka(a,a.next),d=ka(d,d.next),Fc(a,e,t,i,r,s,0),Fc(d,e,t,i,r,s,0);return}l=l.next}a=a.next}while(a!==n)}function iN(n,e,t,i){const r=[];let s,a,l,d,h;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const g=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=s&&g>i&&(i=g,r=t.x=t.x&&t.x>=d&&s!==t.x&&Co(ar.x||t.x===r.x&&oN(r,t)))&&(r=t,m=u)),t=t.next;while(t!==l);return r}function oN(n,e){return Tn(n.prev,n,e.prev)<0&&Tn(e.next,n,n.next)<0}function lN(n,e,t,i){let r=n;do r.z===0&&(r.z=ug(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,cN(r)}function cN(n){let e,t,i,r,s,a,l,d,h=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,l=0,e=0;e0||d>0&&i;)l!==0&&(d===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,l--):(r=i,i=i.nextZ,d--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,h*=2}while(a>1);return n}function ug(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function uN(n){let e=n,t=n;do(e.x=(n-a)*(s-l)&&(n-a)*(i-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(i-l)}function dN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!hN(n,e)&&(Uc(n,e)&&Uc(e,n)&&fN(n,e)&&(Tn(n.prev,n,e.prev)||Tn(n,e.prev,e))||jh(n,e)&&Tn(n.prev,n,n.next)>0&&Tn(e.prev,e,e.next)>0)}function Tn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function jh(n,e){return n.x===e.x&&n.y===e.y}function zE(n,e,t,i){const r=od(Tn(n,e,t)),s=od(Tn(n,e,i)),a=od(Tn(t,i,n)),l=od(Tn(t,i,e));return!!(r!==s&&a!==l||r===0&&ad(n,t,e)||s===0&&ad(n,i,e)||a===0&&ad(t,n,i)||l===0&&ad(t,e,i))}function ad(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function od(n){return n>0?1:n<0?-1:0}function hN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&zE(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Uc(n,e){return Tn(n.prev,n,n.next)<0?Tn(n,e,n.next)>=0&&Tn(n,n.prev,e)>=0:Tn(n,e,n.prev)<0||Tn(n,n.next,e)<0}function fN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function HE(n,e){const t=new dg(n.i,n.x,n.y),i=new dg(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function dS(n,e,t,i){const r=new dg(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Oc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function dg(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pN(n,e,t,i){let r=0;for(let s=e,a=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function fS(n,e){for(let t=0;t0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Od extends _i{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Je(16777215),this.specular=new Je(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pn,this.combine=Bh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class mN extends _i{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Je(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class gN extends _i{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pn,this.combine=Bh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class _N extends _i{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Je(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}function ld(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function vN(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function yN(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function pS(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const l=t[s]*e;for(let d=0;d!==e;++d)r[a++]=n[l+d]}return r}function GE(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}class qc{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let a;n:{i:if(!(e=s)){const l=t[1];e=s)break t}a=i,i=0;break n}break e}for(;i>>1;et;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const l=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*l,a*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==s;l++){const d=i[l];if(typeof d=="number"&&isNaN(d)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,d),e=!1;break}if(a!==null&&a>d){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,d,a),e=!1;break}a=d}if(r!==void 0&&vN(r))for(let l=0,d=r.length;l!==d;++l){const h=r[l];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Xf,s=e.length-1;let a=1;for(let l=1;l0){e[a]=e[s];for(let l=s*i,d=a*i,h=0;h!==i;++h)t[d+h]=t[l+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}jr.prototype.TimeBufferType=Float32Array;jr.prototype.ValueBufferType=Float32Array;jr.prototype.DefaultInterpolation=Ic;class fl extends jr{constructor(e,t,i){super(e,t,i)}}fl.prototype.ValueTypeName="bool";fl.prototype.ValueBufferType=Array;fl.prototype.DefaultInterpolation=Lc;fl.prototype.InterpolantFactoryMethodLinear=void 0;fl.prototype.InterpolantFactoryMethodSmooth=void 0;class VE extends jr{}VE.prototype.ValueTypeName="color";class Fa extends jr{}Fa.prototype.ValueTypeName="number";class SN extends qc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=(i-t)/(r-t);let h=e*l;for(let m=h+l;h!==m;h+=4)Gn.slerpFlat(s,0,a,h-l,a,h,d);return s}}class Qs extends jr{InterpolantFactoryMethodLinear(e){return new SN(this.times,this.values,this.getValueSize(),e)}}Qs.prototype.ValueTypeName="quaternion";Qs.prototype.InterpolantFactoryMethodSmooth=void 0;class pl extends jr{constructor(e,t,i){super(e,t,i)}}pl.prototype.ValueTypeName="string";pl.prototype.ValueBufferType=Array;pl.prototype.DefaultInterpolation=Lc;pl.prototype.InterpolantFactoryMethodLinear=void 0;pl.prototype.InterpolantFactoryMethodSmooth=void 0;class Ua extends jr{}Ua.prototype.ValueTypeName="vector";class WE{constructor(e="",t=-1,i=[],r=oD){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Cr(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,l=i.length;a!==l;++a)t.push(EN(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(jr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let l=0;l1){const u=m[1];let g=r[u];g||(r[u]=g=[]),g.push(h)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(u,g,v,w,T){if(v.length!==0){const M=[],b=[];GE(v,M,b,w),M.length!==0&&T.push(new u(g,M,b))}},r=[],s=e.name||"default",a=e.fps||30,l=e.blendMode;let d=e.length||-1;const h=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(es[e]!==void 0){es[e].push({onLoad:t,onProgress:i,onError:r});return}es[e]=[],es[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,d=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const m=es[e],u=h.body.getReader(),g=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),v=g?parseInt(g):0,w=v!==0;let T=0;const M=new ReadableStream({start(b){A();function A(){u.read().then(({done:E,value:P})=>{if(E)b.close();else{T+=P.byteLength;const G=new ProgressEvent("progress",{lengthComputable:w,loaded:T,total:v});for(let O=0,B=m.length;O{b.error(E)})}}});return new Response(M)}else throw new AN(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(d){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(m=>new DOMParser().parseFromString(m,l));case"json":return h.json();default:if(l===void 0)return h.text();{const u=/charset="?([^;"\s]*)"?/i.exec(l),g=u&&u[1]?u[1].toLowerCase():void 0,v=new TextDecoder(g);return h.arrayBuffer().then(w=>v.decode(w))}}}).then(h=>{Bs.add(e,h);const m=es[e];delete es[e];for(let u=0,g=m.length;u{const m=es[e];if(m===void 0)throw this.manager.itemError(e),h;delete es[e];for(let u=0,g=m.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class CN extends Hi{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Bs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const l=Dc("img");function d(){m(),Bs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(u){m(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function m(){l.removeEventListener("load",d,!1),l.removeEventListener("error",h,!1)}return l.addEventListener("load",d,!1),l.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class D_ extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new $c,l=new _s(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(d){let h;try{h=s.parse(d)}catch(m){if(r!==void 0)r(m);else{console.error(m);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:ti,a.wrapT=h.wrapT!==void 0?h.wrapT:ti,a.magFilter=h.magFilter!==void 0?h.magFilter:ln,a.minFilter=h.minFilter!==void 0?h.minFilter:ln,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(a.colorSpace=h.colorSpace),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Er),h.mipmapCount===1&&(a.minFilter=ln),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},i,r),a}}class Xh extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=new qn,a=new CN(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Yh extends sn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Je(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const xp=new ot,mS=new j,gS=new j;class k_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new et(512,512),this.map=null,this.mapPass=null,this.matrix=new ot,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new R_,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new $t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;mS.setFromMatrixPosition(e.matrixWorld),t.position.copy(mS),gS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(gS),t.updateMatrixWorld(),xp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xp),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(xp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class RN extends k_{constructor(){super(new mi(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=il*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class XE extends Yh{constructor(e,t,i=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new RN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const _S=new ot,Hl=new j,wp=new j;class PN extends k_{constructor(){super(new mi(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new et(4,2),this._viewportCount=6,this._viewports=[new $t(2,1,1,1),new $t(0,1,1,1),new $t(3,1,1,1),new $t(1,1,1,1),new $t(3,0,1,1),new $t(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Hl.setFromMatrixPosition(e.matrixWorld),i.position.copy(Hl),wp.copy(i.position),wp.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(wp),i.updateMatrixWorld(),r.makeTranslation(-Hl.x,-Hl.y,-Hl.z),_S.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_S)}}class hg extends Yh{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new PN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class LN extends k_{constructor(){super(new dl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class F_ extends Yh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.shadow=new LN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class YE extends Yh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ho{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Bs.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{r&&r(h)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;const d=fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Bs.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){r&&r(h),Bs.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Bs.add(e,d),s.manager.itemStart(e)}}const U_="\\[\\]\\.:\\/",DN=new RegExp("["+U_+"]","g"),O_="[^"+U_+"]",kN="[^"+U_.replace("\\.","")+"]",FN=/((?:WC+[\/:])*)/.source.replace("WC",O_),UN=/(WCOD+)?/.source.replace("WCOD",kN),ON=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",O_),NN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",O_),BN=new RegExp("^"+FN+UN+ON+NN+"$"),zN=["material","materials","bones","map"];class HN{constructor(e,t,i){const r=i||Yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Yt{constructor(e,t,i){this.path=t,this.parsedPath=i||Yt.parseTrackName(t),this.node=Yt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Yt.Composite(e,t,i):new Yt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(DN,"")}static parseTrackName(e){const t=BN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);zN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a +Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE +version 0.8.2 +*/var or=Uint8Array,Ro=Uint16Array,WN=Int32Array,$E=new or([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),qE=new or([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jN=new or([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),KE=function(n,e){for(var t=new Ro(31),i=0;i<31;++i)t[i]=e+=1<>1|(mn&21845)<<1;Rs=(Rs&52428)>>2|(Rs&13107)<<2,Rs=(Rs&61680)>>4|(Rs&3855)<<4,pg[mn]=((Rs&65280)>>8|(Rs&255)<<8)>>1}var dc=function(n,e,t){for(var i=n.length,r=0,s=new Ro(e);r>d]=h}else for(l=new Ro(i),r=0;r>15-n[r]);return l},Kc=new or(288);for(var mn=0;mn<144;++mn)Kc[mn]=8;for(var mn=144;mn<256;++mn)Kc[mn]=9;for(var mn=256;mn<280;++mn)Kc[mn]=7;for(var mn=280;mn<288;++mn)Kc[mn]=8;var JE=new or(32);for(var mn=0;mn<32;++mn)JE[mn]=5;var qN=dc(Kc,9,1),KN=dc(JE,5,1),Sp=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},vr=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},Mp=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},ZN=function(n){return(n+7)/8|0},QN=function(n,e,t){return(t==null||t>n.length)&&(t=n.length),new or(n.subarray(e,t))},JN=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],xr=function(n,e,t){var i=new Error(e||JN[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,xr),!t)throw i;return i},eB=function(n,e,t,i){var r=n.length,s=0;if(!r||e.f&&!e.l)return t||new or(0);var a=!t,l=a||e.i!=2,d=e.i;a&&(t=new or(r*3));var h=function(Wt){var Z=t.length;if(Wt>Z){var Jt=new or(Math.max(Z*2,Wt));Jt.set(t),t=Jt}},m=e.f||0,u=e.p||0,g=e.b||0,v=e.l,w=e.d,T=e.m,M=e.n,b=r*8;do{if(!v){m=vr(n,u,1);var A=vr(n,u+1,3);if(u+=3,A)if(A==1)v=qN,w=KN,T=9,M=5;else if(A==2){var O=vr(n,u,31)+257,B=vr(n,u+10,15)+4,F=O+vr(n,u+5,31)+1;u+=14;for(var D=new or(F),L=new or(19),V=0;V>4;if(E<16)D[V++]=E;else{var $=0,ue=0;for(E==16?(ue=3+vr(n,u,3),u+=2,$=D[V-1]):E==17?(ue=3+vr(n,u,7),u+=3):E==18&&(ue=11+vr(n,u,127),u+=7);ue--;)D[V++]=$}}var Y=D.subarray(0,O),pe=D.subarray(O);T=Sp(Y),M=Sp(pe),v=dc(Y,T,1),w=dc(pe,M,1)}else xr(1);else{var E=ZN(u)+4,P=n[E-4]|n[E-3]<<8,G=E+P;if(G>r){d&&xr(0);break}l&&h(g+P),t.set(n.subarray(E,G),g),e.b=g+=P,e.p=u=G*8,e.f=m;continue}if(u>b){d&&xr(0);break}}l&&h(g+131072);for(var _e=(1<>4;if(u+=$&15,u>b){d&&xr(0);break}if($||xr(2),Ue<256)t[g++]=Ue;else if(Ue==256){Pe=u,v=null;break}else{var ae=Ue-254;if(Ue>264){var V=Ue-257,ge=$E[V];ae=vr(n,u,(1<>4;ce||xr(3),u+=ce&15;var pe=$N[Me];if(Me>3){var ge=qE[Me];pe+=Mp(n,u)&(1<b){d&&xr(0);break}l&&h(g+131072);var Ye=g+ae;if(g>4>7||(n[0]<<8|n[1])%31)&&xr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&xr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function Zl(n,e){return eB(n.subarray(nB(n,e),-4),{i:2},e,e)}var iB=typeof TextDecoder<"u"&&new TextDecoder,rB=0;try{iB.decode(tB,{stream:!0}),rB=1}catch{}class eT extends D_{constructor(e){super(e),this.type=gi}parse(e){const D=Math.pow(2.7182818,2.2);function L(S,I){let k=0;for(let te=0;te<65536;++te)(te==0||S[te>>3]&1<<(te&7))&&(I[k++]=te);const W=k-1;for(;k<65536;)I[k++]=0;return W}function V(S){for(let I=0;I<16384;I++)S[I]={},S[I].len=0,S[I].lit=0,S[I].p=null}const ie={l:0,c:0,lc:0};function re(S,I,k,W,te){for(;k>k&(1<0;--k){const W=I+de[k]>>1;de[k]=I,I=W}for(let k=0;k<65537;++k){const W=S[k];W>0&&(S[k]=W|de[W]++<<6)}}function $(S,I,k,W,te,Q){const le=I;let R=0,fe=0;for(;W<=te;W++){if(le.value-I.value>k)return!1;re(6,R,fe,S,le);const J=ie.l;if(R=ie.c,fe=ie.lc,Q[W]=J,J==63){if(le.value-I.value>k)throw new Error("Something wrong with hufUnpackEncTable");re(8,R,fe,S,le);let be=ie.l+6;if(R=ie.c,fe=ie.lc,W+be>te+1)throw new Error("Something wrong with hufUnpackEncTable");for(;be--;)Q[W++]=0;W--}else if(J>=59){let be=J-59+2;if(W+be>te+1)throw new Error("Something wrong with hufUnpackEncTable");for(;be--;)Q[W++]=0;W--}}me(Q)}function ue(S){return S&63}function Y(S){return S>>6}function pe(S,I,k,W){for(;I<=k;I++){const te=Y(S[I]),Q=ue(S[I]);if(te>>Q)throw new Error("Invalid table entry");if(Q>14){const le=W[te>>Q-14];if(le.len)throw new Error("Invalid table entry");if(le.lit++,le.p){const R=le.p;le.p=new Array(le.lit);for(let fe=0;fe0;R--){const fe=W[(te<<14-Q)+le];if(fe.len||fe.p)throw new Error("Invalid table entry");fe.len=Q,fe.lit=I,le++}}}return!0}const _e={c:0,lc:0};function Ae(S,I,k,W){S=S<<8|bt(k,W),I+=8,_e.c=S,_e.lc=I}const Pe={c:0,lc:0};function Ue(S,I,k,W,te,Q,le,R,fe){if(S==I){W<8&&(Ae(k,W,te,Q),k=_e.c,W=_e.lc),W-=8;let J=k>>W;if(J=new Uint8Array([J])[0],R.value+J>fe)return!1;const be=le[R.value-1];for(;J-- >0;)le[R.value++]=be}else if(R.value32767?I-65536:I}const ce={a:0,b:0};function Me(S,I){const k=ge(S),te=ge(I),Q=k+(te&1)+(te>>1),le=Q,R=Q-te;ce.a=le,ce.b=R}function Ye(S,I){const k=ae(S),W=ae(I),te=k-(W>>1)&65535,Q=W+te-32768&65535;ce.a=Q,ce.b=te}function ht(S,I,k,W,te,Q,le){const R=le<16384,fe=k>te?te:k;let J=1,be,Fe;for(;J<=fe;)J<<=1;for(J>>=1,be=J,J>>=1;J>=1;){Fe=0;const Oe=Fe+Q*(te-be),We=Q*J,Ee=Q*be,Te=W*J,Xe=W*be;let qe,Tt,Ht,en;for(;Fe<=Oe;Fe+=Ee){let Bt=Fe;const pt=Fe+W*(k-be);for(;Bt<=pt;Bt+=Xe){const Gt=Bt+Te,In=Bt+We,Xt=In+Te;R?(Me(S[Bt+I],S[In+I]),qe=ce.a,Ht=ce.b,Me(S[Gt+I],S[Xt+I]),Tt=ce.a,en=ce.b,Me(qe,Tt),S[Bt+I]=ce.a,S[Gt+I]=ce.b,Me(Ht,en),S[In+I]=ce.a,S[Xt+I]=ce.b):(Ye(S[Bt+I],S[In+I]),qe=ce.a,Ht=ce.b,Ye(S[Gt+I],S[Xt+I]),Tt=ce.a,en=ce.b,Ye(qe,Tt),S[Bt+I]=ce.a,S[Gt+I]=ce.b,Ye(Ht,en),S[In+I]=ce.a,S[Xt+I]=ce.b)}if(k&J){const Gt=Bt+We;R?Me(S[Bt+I],S[Gt+I]):Ye(S[Bt+I],S[Gt+I]),qe=ce.a,S[Gt+I]=ce.b,S[Bt+I]=qe}}if(te&J){let Bt=Fe;const pt=Fe+W*(k-be);for(;Bt<=pt;Bt+=Xe){const Gt=Bt+Te;R?Me(S[Bt+I],S[Gt+I]):Ye(S[Bt+I],S[Gt+I]),qe=ce.a,S[Gt+I]=ce.b,S[Bt+I]=qe}}be=J,J>>=1}return Fe}function ft(S,I,k,W,te,Q,le,R,fe){let J=0,be=0;const Fe=le,Oe=Math.trunc(W.value+(te+7)/8);for(;W.value=14;){const Ee=J>>be-14&16383,Te=I[Ee];if(Te.len)be-=Te.len,Ue(Te.lit,Q,J,be,k,W,R,fe,Fe),J=Pe.c,be=Pe.lc;else{if(!Te.p)throw new Error("hufDecode issues");let Xe;for(Xe=0;Xe=qe&&Y(S[Te.p[Xe]])==(J>>be-qe&(1<>=We,be-=We;be>0;){const Ee=I[J<<14-be&16383];if(Ee.len)be-=Ee.len,Ue(Ee.lit,Q,J,be,k,W,R,fe,Fe),J=Pe.c,be=Pe.lc;else throw new Error("hufDecode issues")}return!0}function Wt(S,I,k,W,te,Q){const le={value:0},R=k.value,fe=$e(I,k),J=$e(I,k);k.value+=4;const be=$e(I,k);if(k.value+=4,fe<0||fe>=65537||J<0||J>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const Fe=new Array(65537),Oe=new Array(16384);V(Oe);const We=W-(k.value-R);if($(S,k,We,fe,J,Fe),be>8*(W-(k.value-R)))throw new Error("Something wrong with hufUncompress");pe(Fe,fe,J,Oe),ft(Fe,Oe,S,k,be,J,Q,te,le)}function Z(S,I,k){for(let W=0;WQ||(I[te++]=S[k++],te>Q));)I[te++]=S[W++]}function jt(S){let I=S.byteLength;const k=new Array;let W=0;const te=new DataView(S);for(;I>0;){const Q=te.getInt8(W++);if(Q<0){const le=-Q;I-=le+1;for(let R=0;R>8==255?te+=W&255:(k[te]=W,te++),S.value++}function yt(S,I){I[0]=oe(S[0]),I[1]=oe(S[1]),I[2]=oe(S[5]),I[3]=oe(S[6]),I[4]=oe(S[14]),I[5]=oe(S[15]),I[6]=oe(S[27]),I[7]=oe(S[28]),I[8]=oe(S[2]),I[9]=oe(S[4]),I[10]=oe(S[7]),I[11]=oe(S[13]),I[12]=oe(S[16]),I[13]=oe(S[26]),I[14]=oe(S[29]),I[15]=oe(S[42]),I[16]=oe(S[3]),I[17]=oe(S[8]),I[18]=oe(S[12]),I[19]=oe(S[17]),I[20]=oe(S[25]),I[21]=oe(S[30]),I[22]=oe(S[41]),I[23]=oe(S[43]),I[24]=oe(S[9]),I[25]=oe(S[11]),I[26]=oe(S[18]),I[27]=oe(S[24]),I[28]=oe(S[31]),I[29]=oe(S[40]),I[30]=oe(S[44]),I[31]=oe(S[53]),I[32]=oe(S[10]),I[33]=oe(S[19]),I[34]=oe(S[23]),I[35]=oe(S[32]),I[36]=oe(S[39]),I[37]=oe(S[45]),I[38]=oe(S[52]),I[39]=oe(S[54]),I[40]=oe(S[20]),I[41]=oe(S[22]),I[42]=oe(S[33]),I[43]=oe(S[38]),I[44]=oe(S[46]),I[45]=oe(S[51]),I[46]=oe(S[55]),I[47]=oe(S[60]),I[48]=oe(S[21]),I[49]=oe(S[34]),I[50]=oe(S[37]),I[51]=oe(S[47]),I[52]=oe(S[50]),I[53]=oe(S[56]),I[54]=oe(S[59]),I[55]=oe(S[61]),I[56]=oe(S[35]),I[57]=oe(S[36]),I[58]=oe(S[48]),I[59]=oe(S[49]),I[60]=oe(S[57]),I[61]=oe(S[58]),I[62]=oe(S[62]),I[63]=oe(S[63])}function wt(S){const I=.5*Math.cos(.7853975),k=.5*Math.cos(3.14159/16),W=.5*Math.cos(3.14159/8),te=.5*Math.cos(3*3.14159/16),Q=.5*Math.cos(5*3.14159/16),le=.5*Math.cos(3*3.14159/8),R=.5*Math.cos(7*3.14159/16),fe=new Array(4),J=new Array(4),be=new Array(4),Fe=new Array(4);for(let Oe=0;Oe<8;++Oe){const We=Oe*8;fe[0]=W*S[We+2],fe[1]=le*S[We+2],fe[2]=W*S[We+6],fe[3]=le*S[We+6],J[0]=k*S[We+1]+te*S[We+3]+Q*S[We+5]+R*S[We+7],J[1]=te*S[We+1]-R*S[We+3]-k*S[We+5]-Q*S[We+7],J[2]=Q*S[We+1]-k*S[We+3]+R*S[We+5]+te*S[We+7],J[3]=R*S[We+1]-Q*S[We+3]+te*S[We+5]-k*S[We+7],be[0]=I*(S[We+0]+S[We+4]),be[3]=I*(S[We+0]-S[We+4]),be[1]=fe[0]+fe[3],be[2]=fe[1]-fe[2],Fe[0]=be[0]+be[1],Fe[1]=be[3]+be[2],Fe[2]=be[3]-be[2],Fe[3]=be[0]-be[1],S[We+0]=Fe[0]+J[0],S[We+1]=Fe[1]+J[1],S[We+2]=Fe[2]+J[2],S[We+3]=Fe[3]+J[3],S[We+4]=Fe[3]-J[3],S[We+5]=Fe[2]-J[2],S[We+6]=Fe[1]-J[1],S[We+7]=Fe[0]-J[0]}for(let Oe=0;Oe<8;++Oe)fe[0]=W*S[16+Oe],fe[1]=le*S[16+Oe],fe[2]=W*S[48+Oe],fe[3]=le*S[48+Oe],J[0]=k*S[8+Oe]+te*S[24+Oe]+Q*S[40+Oe]+R*S[56+Oe],J[1]=te*S[8+Oe]-R*S[24+Oe]-k*S[40+Oe]-Q*S[56+Oe],J[2]=Q*S[8+Oe]-k*S[24+Oe]+R*S[40+Oe]+te*S[56+Oe],J[3]=R*S[8+Oe]-Q*S[24+Oe]+te*S[40+Oe]-k*S[56+Oe],be[0]=I*(S[Oe]+S[32+Oe]),be[3]=I*(S[Oe]-S[32+Oe]),be[1]=fe[0]+fe[3],be[2]=fe[1]-fe[2],Fe[0]=be[0]+be[1],Fe[1]=be[3]+be[2],Fe[2]=be[3]-be[2],Fe[3]=be[0]-be[1],S[0+Oe]=Fe[0]+J[0],S[8+Oe]=Fe[1]+J[1],S[16+Oe]=Fe[2]+J[2],S[24+Oe]=Fe[3]+J[3],S[32+Oe]=Fe[3]-J[3],S[40+Oe]=Fe[2]-J[2],S[48+Oe]=Fe[1]-J[1],S[56+Oe]=Fe[0]-J[0]}function X(S){for(let I=0;I<64;++I){const k=S[0][I],W=S[1][I],te=S[2][I];S[0][I]=k+1.5747*te,S[1][I]=k-.1873*W-.4682*te,S[2][I]=k+1.8556*W}}function N(S,I,k){for(let W=0;W<64;++W)I[k+W]=Eo.toHalfFloat(ve(S[W]))}function ve(S){return S<=1?Math.sign(S)*Math.pow(Math.abs(S),2.2):Math.sign(S)*Math.pow(D,Math.abs(S)-1)}function De(S){return new DataView(S.array.buffer,S.offset.value,S.size)}function ke(S){const I=S.viewer.buffer.slice(S.offset.value,S.offset.value+S.size),k=new Uint8Array(jt(I)),W=new Uint8Array(k.length);return Jt(k),Ut(k,W),new DataView(W.buffer)}function Le(S){const I=S.array.slice(S.offset.value,S.offset.value+S.size),k=Zl(I),W=new Uint8Array(k.length);return Jt(k),Ut(k,W),new DataView(W.buffer)}function lt(S){const I=S.viewer,k={value:S.offset.value},W=new Uint16Array(S.columns*S.lines*(S.inputChannels.length*S.type)),te=new Uint8Array(8192);let Q=0;const le=new Array(S.inputChannels.length);for(let Ee=0,Te=S.inputChannels.length;Ee=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(R<=fe)for(let Ee=0;Ee0;){const Te=vt(I.buffer,k),Xe=Ie(I,k),qe=Xe>>2&3,Tt=(Xe>>4)-1,Ht=new Int8Array([Tt])[0],en=Ie(I,k);Q.push({name:Te,index:Ht,type:en,compression:qe}),le-=Te.length+3}const R=z.channels,fe=new Array(S.inputChannels.length);for(let Te=0;Te=0&&(J.idx[Tt.index]=Te),Xe.offset=Te)}}let be,Fe,Oe;if(te.acCompressedSize>0)switch(te.acCompression){case 0:be=new Uint16Array(te.totalAcUncompressedCount),Wt(S.array,I,k,te.acCompressedSize,be,te.totalAcUncompressedCount);break;case 1:const Te=S.array.slice(k.value,k.value+te.totalAcUncompressedCount),Xe=Zl(Te);be=new Uint16Array(Xe.buffer),k.value+=te.totalAcUncompressedCount;break}if(te.dcCompressedSize>0){const Te={array:S.array,offset:k,size:te.dcCompressedSize};Fe=new Uint16Array(Le(Te).buffer),k.value+=te.dcCompressedSize}if(te.rleRawSize>0){const Te=S.array.slice(k.value,k.value+te.rleCompressedSize),Xe=Zl(Te);Oe=jt(Xe.buffer),k.value+=te.rleCompressedSize}let We=0;const Ee=new Array(fe.length);for(let Te=0;Te>10,k=S&1023;return(S>>15?-1:1)*(I?I===31?k?NaN:1/0:Math.pow(2,I-15)*(1+k/1024):6103515625e-14*(k/1024))}function Ce(S,I){const k=S.getUint16(I.value,!0);return I.value+=2,k}function Ge(S,I){return oe(Ce(S,I))}function gt(S,I,k,W){const te=k.value,Q=[];for(;k.value>4]}}function Nt(S,I){const k=ee(S,I),W=ee(S,I);return[k,W]}function fr(S,I){const k=ee(S,I),W=ee(S,I),te=ee(S,I);return[k,W,te]}function ys(S,I,k,W,te){if(W==="string"||W==="stringvector"||W==="iccProfile")return Ne(I,k,te);if(W==="chlist")return gt(S,I,k,te);if(W==="chromaticities")return Pt(S,k);if(W==="compression")return un(S,k);if(W==="box2i")return Ln(S,k);if(W==="envmap")return oi(S,k);if(W==="tiledesc")return ii(S,k);if(W==="lineOrder")return Ot(S,k);if(W==="float")return ee(S,k);if(W==="v2f")return Nt(S,k);if(W==="v3f")return fr(S,k);if(W==="int")return ct(S,k);if(W==="rational")return nt(S,k);if(W==="timecode")return Rt(S,k);if(W==="preview")return k.value+=te,"skipped";k.value+=te}function Ci(S,I){const k=Math.log2(S);return I=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function ra(S,I,k){let W=0;switch(S.levelMode){case"ONE_LEVEL":W=1;break;case"MIPMAP_LEVELS":W=Ci(Math.max(I,k),S.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return W}function Ri(S,I,k,W){const te=new Array(S);for(let Q=0;QS.width?S.width-le:S.blockWidth,S.lines=R+S.blockHeight>S.height?S.height-R:S.blockHeight;const fe=S.columns*S.totalBytes,be=S.sizeS.height?S.height-te:S.blockHeight;const Q=S.columns*S.totalBytes,R=S.size=S.height)continue;const Fe=fe*Q,Oe=(S.height-1-be)*S.outLineWidth;for(let We=0;Webe:Q.scanOrder=be=>Q.height-1-be,Q.outputChannels==4?(Q.format=Vn,Q.colorSpace=Sn):(Q.format=Wc,Q.colorSpace=ss),S.spec.singleTile){Q.blockHeight=S.tiles.ySize,Q.blockWidth=S.tiles.xSize;const be=ra(S.tiles,Q.width,Q.height),Fe=Ri(be,Q.width,S.tiles.xSize,S.tiles.roundingMode),Oe=Ri(be,Q.height,S.tiles.ySize,S.tiles.roundingMode);Q.tileCount=Fe[0]*Oe[0];for(let We=0;We=t[i])return i-1;if(e<=t[n])return n;let r=n,s=i,a=Math.floor((r+s)/2);for(;e=t[a+1];)e=T&&(w[v][0]=w[g][0]/l[A+1][b],M=w[v][0]*l[b][A]);const E=b>=-1?1:-b,P=u-1<=A?T-1:t-u;for(let O=E;O<=P;++O)w[v][O]=(w[g][O]-w[g][O-1])/l[A+1][b+O],M+=w[v][O]*l[b+O][A];u<=A&&(w[v][T]=-w[g][T-1]/l[A+1][u],M+=w[v][T]*l[u][A]),a[T][u]=M;const G=g;g=v,v=G}}let m=t;for(let u=1;u<=i;++u){for(let g=0;g<=t;++g)a[u][g]*=m;m*=t-u}return a}function lB(n,e,t,i,r){const s=r0,d=typeof s.Content=="string"&&s.Content!=="";if(l||d){const h=this.parseImage(i[r]);t[s.RelativeFilename||s.Filename]=h}}}}for(const i in e){const r=e[i];t[r]!==void 0?e[i]=t[r]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Ct.Objects){const i=Ct.Objects.Texture;for(const r in i){const s=this.parseTexture(i[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,a=r!==void 0?r.value:0,l=s!==void 0?s.value:0;if(i.wrapS=a===0?Vr:ti,i.wrapT=l===0?Vr:ti,"Scaling"in e){const d=e.Scaling.value;i.repeat.x=d[0],i.repeat.y=d[1]}if("Translation"in e){const d=e.Translation.value;i.offset.x=d[0],i.offset.y=d[1]}return i}loadTexture(e,t){const i=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),r=e.FileName.split(".").pop().toLowerCase(),s=i.has(r)?this.manager.getHandler(`.${r}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${r.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new qn;const a=s.path;a||s.setPath(this.textureLoader.path);const l=Dn.get(e.id).children;let d;l!==void 0&&l.length>0&&t[l[0].ID]!==void 0&&(d=t[l[0].ID],(d.indexOf("blob:")===0||d.indexOf("data:")===0)&&s.setPath(void 0));const h=s.load(d);return s.setPath(a),h}parseMaterials(e){const t=new Map;if("Material"in Ct.Objects){const i=Ct.Objects.Material;for(const r in i){const s=this.parseMaterial(i[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const i=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Dn.has(i))return null;const a=this.parseParameters(e,t,i);let l;switch(s.toLowerCase()){case"phong":l=new Od;break;case"lambert":l=new gN;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),l=new Od;break}return l.setValues(a),l.name=r,l}parseParameters(e,t,i){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new Je().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new Je().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new Je().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new Je().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new Je().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new Je().fromArray(e.SpecularColor.value).convertSRGBToLinear());const s=this;return Dn.get(i).children.forEach(function(a){const l=a.relationship;switch(l){case"Bump":r.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,a.ID),r.map!==void 0&&(r.map.colorSpace=on);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,a.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=on);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,a.ID),r.envMap!==void 0&&(r.envMap.mapping=el,r.envMap.colorSpace=on);break;case"SpecularColor":r.specularMap=s.getTexture(t,a.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=on);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,a.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in Ct.Objects&&t in Ct.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Dn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Ct.Objects){const i=Ct.Objects.Deformer;for(const r in i){const s=i[r],a=Dn.get(parseInt(r));if(s.attrType==="Skin"){const l=this.parseSkeleton(a,i);l.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=a.parents[0].ID,e[r]=l}else if(s.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(a,i),l.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const a={ID:r.ID,indices:[],weights:[],transformLink:new ot().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),i.push(a)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let r=0;r1?a=l:l.length>0?a=l[0]:(a=new Od({name:Hi.DEFAULT_MATERIAL_NAME,color:13421772}),l.push(a)),"color"in s.attributes&&l.forEach(function(d){d.vertexColors=!0}),s.FBX_Deformer?(r=new NE(s,a),r.normalizeSkinWeights()):r=new wn(s,a),r}createCurve(e,t){const i=e.children.reduce(function(s,a){return t.has(a.ID)&&(s=t.get(a.ID)),s},null),r=new Aa({name:Hi.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Wh(i,r)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=rT(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&Dn.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=Ct.Objects.Model[r.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),xi.add(e.target)):e.lookAt(new j().fromArray(a))}}})}bindSkeleton(e,t,i){const r=this.parsePoseNodes();for(const s in e){const a=e[s];Dn.get(parseInt(a.ID)).parents.forEach(function(d){if(t.has(d.ID)){const h=d.ID;Dn.get(h).parents.forEach(function(u){i.has(u.ID)&&i.get(u.ID).bind(new Vh(a.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Ct.Objects){const t=Ct.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const r=t[i].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new ot().fromArray(s.Matrix.a)}):e[r.Node]=new ot().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Ct){if("AmbientColor"in Ct.GlobalSettings){const e=Ct.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],r=e[2];if(t!==0||i!==0||r!==0){const s=new Je(t,i,r).convertSRGBToLinear();xi.add(new YE(s,1))}}"UnitScaleFactor"in Ct.GlobalSettings&&(xi.userData.unitScaleFactor=Ct.GlobalSettings.UnitScaleFactor.value)}}}class mB{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Ct.Objects){const i=Ct.Objects.Geometry;for(const r in i){const s=Dn.get(parseInt(r)),a=this.parseGeometry(s,i[r],e);t.set(parseInt(r),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const r=i.skeletons,s=[],a=e.parents.map(function(u){return Ct.Objects.Model[u.ID]});if(a.length===0)return;const l=e.children.reduce(function(u,g){return r[g.ID]!==void 0&&(u=r[g.ID]),u},null);e.children.forEach(function(u){i.morphTargets[u.ID]!==void 0&&s.push(i.morphTargets[u.ID])});const d=a[0],h={};"RotationOrder"in d&&(h.eulerOrder=rT(d.RotationOrder.value)),"InheritType"in d&&(h.inheritType=parseInt(d.InheritType.value)),"GeometricTranslation"in d&&(h.translation=d.GeometricTranslation.value),"GeometricRotation"in d&&(h.rotation=d.GeometricRotation.value),"GeometricScaling"in d&&(h.scale=d.GeometricScaling.value);const m=iT(h);return this.genGeometry(t,l,s,m)}genGeometry(e,t,i,r){const s=new On;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,t),l=this.genBuffers(a),d=new nn(l.vertex,3);if(d.applyMatrix4(r),s.setAttribute("position",d),l.colors.length>0&&s.setAttribute("color",new nn(l.colors,3)),t&&(s.setAttribute("skinIndex",new C_(l.weightsIndices,4)),s.setAttribute("skinWeight",new nn(l.vertexWeights,4)),s.FBX_Deformer=t),l.normal.length>0){const h=new At().getNormalMatrix(r),m=new nn(l.normal,3);m.applyNormalMatrix(h),s.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){const u=m===0?"uv":`uv${m}`;s.setAttribute(u,new nn(l.uvs[m],2))}),a.material&&a.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,g){u!==h&&(s.addGroup(m,g-m,h),h=u,m=g)}),s.groups.length>0){const u=s.groups[s.groups.length-1],g=u.start+u.count;g!==l.materialIndex.length&&s.addGroup(g,l.materialIndex.length-g,h)}s.groups.length===0&&s.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(s,e,i,r),s}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(a,l){i.weightTable[a]===void 0&&(i.weightTable[a]=[]),i.weightTable[a].push({id:s,weight:r.weights[l]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,r=0,s=!1,a=[],l=[],d=[],h=[],m=[],u=[];const g=this;return e.vertexIndices.forEach(function(v,w){let T,M=!1;v<0&&(v=v^-1,M=!0);let b=[],A=[];if(a.push(v*3,v*3+1,v*3+2),e.color){const E=cd(w,i,v,e.color);d.push(E[0],E[1],E[2])}if(e.skeleton){if(e.weightTable[v]!==void 0&&e.weightTable[v].forEach(function(E){A.push(E.weight),b.push(E.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const E=[0,0,0,0],P=[0,0,0,0];A.forEach(function(G,O){let B=G,F=b[O];P.forEach(function(D,L,V){if(B>D){V[L]=B,B=D;const ie=E[L];E[L]=F,F=ie}})}),b=E,A=P}for(;A.length<4;)A.push(0),b.push(0);for(let E=0;E<4;++E)m.push(A[E]),u.push(b[E])}if(e.normal){const E=cd(w,i,v,e.normal);l.push(E[0],E[1],E[2])}e.material&&e.material.mappingType!=="AllSame"&&(T=cd(w,i,v,e.material)[0],T<0&&(g.negativeMaterialIndices=!0,T=0)),e.uv&&e.uv.forEach(function(E,P){const G=cd(w,i,v,E);h[P]===void 0&&(h[P]=[]),h[P].push(G[0]),h[P].push(G[1])}),r++,M&&(g.genFace(t,e,a,T,l,d,h,m,u,r),i++,r=0,a=[],l=[],d=[],h=[],m=[],u=[])}),t}getNormalNewell(e){const t=new j(0,0,0);for(let i=0;i.5?new j(0,1,0):new j(0,0,1)).cross(t).normalize(),s=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:s}}flattenVertex(e,t,i){return new et(e.dot(t),e.dot(i))}genFace(e,t,i,r,s,a,l,d,h,m){let u;if(m>3){const g=[],v=t.baseVertexPositions||t.vertexPositions;for(let b=0;b1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);i[r]={name:t[r].attrName,layer:a}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(r){t=t.concat(i.generateTracks(r))}),new WE(e.name,-1,t)}generateTracks(e){const t=[];let i=new j,r=new j;if(e.transform&&e.transform.decompose(i,new Gn,r),i=i.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,i,r){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,i);return new Ua(e+"."+r,s,a)}generateRotationTrack(e,t,i,r,s){let a,l;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const u=this.interpolateRotations(t.x,t.y,t.z,s);a=u[0],l=u[1]}i!==void 0&&(i=i.map(bn.degToRad),i.push(s),i=new Pn().fromArray(i),i=new Gn().setFromEuler(i)),r!==void 0&&(r=r.map(bn.degToRad),r.push(s),r=new Pn().fromArray(r),r=new Gn().setFromEuler(r).invert());const d=new Gn,h=new Pn,m=[];if(!l||!a)return new Qs(e+".quaternion",[0],[0]);for(let u=0;u2&&new Gn().fromArray(m,(u-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(m,u/3*4);return new Qs(e+".quaternion",a,m)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(s){return s/100}),r=xi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Fa(e.modelName+".morphTargetInfluences["+r+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,r){return i-r}),t.length>1){let i=1,r=t[0];for(let s=1;s=180||v[1]>=180||v[2]>=180){const T=Math.max(...v)/180,M=new Pn(...h,r),b=new Pn(...u,r),A=new Gn().setFromEuler(M),E=new Gn().setFromEuler(b);A.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);const P=e.times[l-1],G=e.times[l]-P,O=new Gn,B=new Pn;for(let F=0;F<1;F+=1/T)O.copy(A.clone().slerp(E.clone(),F)),s.push(P+F*G),B.setFromQuaternion(O,r),a.push(B.x),a.push(B.y),a.push(B.z)}else s.push(e.times[l]),a.push(bn.degToRad(e.values[l])),a.push(bn.degToRad(t.values[l])),a.push(bn.degToRad(i.values[l]))}return[s,a]}}class _B{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new nT,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(r,s){const a=r.match(/^[\s\t]*;/),l=r.match(/^[\s\t]*$/);if(a||l)return;const d=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),m=r.match("^\\t{"+(t.currentIndent-1)+"}}");d?t.parseNodeBegin(r,d):h?t.parseNodeProperty(r,h,i[++s]):m?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(d){return d.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:i},a=this.parseNodeAttr(r),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,s):i in l?(i==="PoseNode"?l.PoseNode.push(s):l[i].id!==void 0&&(l[i]={},l[i][l[i].id]=l[i]),a.id!==""&&(l[i][a.id]=s)):typeof a.id=="number"?(l[i]={},l[i][a.id]=s):i!=="Properties70"&&(i==="PoseNode"?l[i]=[s]:l[i]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",r="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:i,type:r}}parseNodeProperty(e,t,i){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=i.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const d=s.split(",").slice(1),h=parseInt(d[0]),m=parseInt(d[1]);let u=s.split(",").slice(3);u=u.map(function(g){return g.trim().replace(/^"/,"")}),r="connections",s=[h,m],SB(s,u),a[r]===void 0&&(a[r]=[])}r==="Node"&&(a.id=s),r in a&&Array.isArray(a[r])?a[r].push(s):r!=="a"?a[r]=s:a.a=s,this.setCurrentProp(a,r),r==="a"&&s.slice(-1)!==","&&(a.a=Tp(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Tp(t.a))}parseNodeSpecialProperty(e,t,i){const r=i.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],a=r[1],l=r[2],d=r[3];let h=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Tp(h);break}this.getPrevNode()[s]={type:a,type2:l,flag:d,value:h},this.setCurrentProp(this.getPrevNode(),s)}}class vB{parse(e){const t=new bS(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const r=new nT;for(;!this.endOfContent(t);){const s=this.parseNode(t,i);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),l=e.getString(a);if(r===0)return null;const d=[];for(let g=0;g0?d[0]:"",m=d.length>1?d[1]:"",u=d.length>2?d[2]:"";for(i.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(l,i,g)}return i.propertyList=d,typeof h=="number"&&(i.id=h),m!==""&&(i.attrName=m),u!==""&&(i.attrType=u),l!==""&&(i.name=l),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const r=i.propertyList[0];Array.isArray(r)?(t[i.name]=i,i.a=r):t[i.name]=r}else if(e==="Connections"&&i.name==="C"){const r=[];i.propertyList.forEach(function(s,a){a!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(i.name==="Properties70")Object.keys(i).forEach(function(s){t[s]=i[s]});else if(e==="Properties70"&&i.name==="P"){let r=i.propertyList[0],s=i.propertyList[1];const a=i.propertyList[2],l=i.propertyList[3];let d;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?d=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:d=i.propertyList[4],t[r]={type:s,type2:a,flag:l,value:d}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=Zl(new Uint8Array(e.getArrayBuffer(a))),d=new bS(l.buffer);switch(t){case"b":case"c":return d.getBooleanArray(r);case"d":return d.getFloat64Array(r);case"f":return d.getFloat32Array(r);case"i":return d.getInt32Array(r);case"l":return d.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class bS{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i=0&&(i=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(i)}}class nT{add(e,t){this[e]=t}}function yB(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===sT(n,0,e.length)}function bB(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(r){const s=n[r-1];return n=n.slice(t+r),t++,s}for(let r=0;r=2.0 are supported."));return}const h=new i4(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let m=0;m=0&&l[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}h.setExtensions(a),h.setPlugins(l),h.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function EB(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class TB{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class zB{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],l=r.images[a.source];let d=i.textureLoader;if(l.uri){const h=i.options.manager.getHandler(l.uri);h!==null&&(d=h)}return this.detectSupport().then(function(h){if(h)return i.loadTextureImage(e,a.source,d);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class HB{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],l=r.images[a.source];let d=i.textureLoader;if(l.uri){const h=i.options.manager.getHandler(l.uri);h!==null&&(d=h)}return this.detectSupport().then(function(h){if(h)return i.loadTextureImage(e,a.source,d);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class GB{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(l){const d=r.byteOffset||0,h=r.byteLength||0,m=r.count,u=r.byteStride,g=new Uint8Array(l,d,h);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(m,u,g,r.mode,r.filter).then(function(v){return v.buffer}):a.ready.then(function(){const v=new ArrayBuffer(m*u);return a.decodeGltfBuffer(new Uint8Array(v),m,u,g,r.mode,r.filter),v})})}else return null}}class VB{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const h of r.primitives)if(h.mode!==ir.TRIANGLES&&h.mode!==ir.TRIANGLE_STRIP&&h.mode!==ir.TRIANGLE_FAN&&h.mode!==void 0)return null;const a=i.extensions[this.name].attributes,l=[],d={};for(const h in a)l.push(this.parser.getDependency("accessor",a[h]).then(m=>(d[h]=m,d[h])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(h=>{const m=h.pop(),u=m.isGroup?m.children:[m],g=h[0].count,v=[];for(const w of u){const T=new ot,M=new j,b=new Gn,A=new j(1,1,1),E=new qO(w.geometry,w.material,g);for(let P=0;P0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const n4=new ot;class i4{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new EB,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,s=!1,a=-1;if(typeof navigator<"u"){const l=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(l)===!0;const d=l.match(/Version\/(\d+)/);r=i&&d?parseInt(d[1],10):-1,s=l.indexOf("Firefox")>-1,a=s?l.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&a<98?this.textureLoader=new Xh(this.options.manager):this.textureLoader=new IN(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _s(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(a){const l={scene:a[0][r.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:r.asset,parser:i,userData:{}};return fa(s,l,r),is(l,r),Promise.all(i._invokeAll(function(d){return d.afterRoot&&d.afterRoot(l)})).then(function(){for(const d of l.scenes)d.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const d=this.associations.get(a);d!=null&&this.associations.set(l,d);for(const[h,m]of a.children.entries())s(m,l.children[h])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&M.setY(D,O[B*d+1]),d>=3&&M.setZ(D,O[B*d+2]),d>=4&&M.setW(D,O[B*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return M})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,a=t.images[s];let l=this.textureLoader;if(a.uri){const d=i.manager.getHandler(a.uri);d!==null&&(l=d)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,i){const r=this,s=this.json,a=s.textures[e],l=s.images[t],d=(l.uri||l.bufferView)+":"+a.sampler;if(this.textureCache[d])return this.textureCache[d];const h=this.loadImageSource(t,i).then(function(m){m.flipY=!1,m.name=a.name||l.name||"",m.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(m.name=l.uri);const g=(s.samplers||{})[a.sampler]||{};return m.magFilter=MS[g.magFilter]||ln,m.minFilter=MS[g.minFilter]||Er,m.wrapS=ES[g.wrapS]||Vr,m.wrapT=ES[g.wrapT]||Vr,r.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[d]=h,h}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=r.images[e],l=self.URL||self.webkitURL;let d=a.uri||"",h=!1;if(a.bufferView!==void 0)d=i.getDependency("bufferView",a.bufferView).then(function(u){h=!0;const g=new Blob([u],{type:a.mimeType});return d=l.createObjectURL(g),d});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(d).then(function(u){return new Promise(function(g,v){let w=g;t.isImageBitmapLoader===!0&&(w=function(T){const M=new qn(T);M.needsUpdate=!0,g(M)}),t.load(Ho.resolveURL(u,s.path),w,void 0,v)})}).then(function(u){return h===!0&&l.revokeObjectURL(d),is(u,a),u.userData.mimeType=a.mimeType||t4(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),u});return this.sourceCache[e]=m,m}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(a=a.clone(),a.channel=i.texCoord),s.extensions[It.KHR_TEXTURE_TRANSFORM]){const l=i.extensions!==void 0?i.extensions[It.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const d=s.associations.get(a);a=s.extensions[It.KHR_TEXTURE_TRANSFORM].extendTexture(a,l),s.associations.set(a,d)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+i.uuid;let d=this.cache.get(l);d||(d=new Ao,_i.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,d.sizeAttenuation=!1,this.cache.add(l,d)),i=d}else if(e.isLine){const l="LineBasicMaterial:"+i.uuid;let d=this.cache.get(l);d||(d=new Aa,_i.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,this.cache.add(l,d)),i=d}if(r||s||a){let l="ClonedMaterial:"+i.uuid+":";r&&(l+="derivative-tangents:"),s&&(l+="vertex-colors:"),a&&(l+="flat-shading:");let d=this.cache.get(l);d||(d=i.clone(),s&&(d.vertexColors=!0),a&&(d.flatShading=!0),r&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(l,d),this.associations.set(d,this.associations.get(i))),i=d}e.material=i}getMaterialType(){return na}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let a;const l={},d=s.extensions||{},h=[];if(d[It.KHR_MATERIALS_UNLIT]){const u=r[It.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),h.push(u.extendParams(l,s,t))}else{const u=s.pbrMetallicRoughness||{};if(l.color=new Je(1,1,1),l.opacity=1,Array.isArray(u.baseColorFactor)){const g=u.baseColorFactor;l.color.setRGB(g[0],g[1],g[2],Sn),l.opacity=g[3]}u.baseColorTexture!==void 0&&h.push(t.assignTexture(l,"map",u.baseColorTexture,on)),l.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,l.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(l,"metalnessMap",u.metallicRoughnessTexture)),h.push(t.assignTexture(l,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,l)})))}s.doubleSided===!0&&(l.side=Si);const m=s.alphaMode||Cp.OPAQUE;if(m===Cp.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===Cp.MASK&&(l.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Or&&(h.push(t.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new et(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;l.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&a!==Or&&(h.push(t.assignTexture(l,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Or){const u=s.emissiveFactor;l.emissive=new Je().setRGB(u[0],u[1],u[2],Sn)}return s.emissiveTexture!==void 0&&a!==Or&&h.push(t.assignTexture(l,"emissiveMap",s.emissiveTexture,on)),Promise.all(h).then(function(){const u=new a(l);return s.name&&(u.name=s.name),is(u,s),t.associations.set(u,{materials:e}),s.extensions&&fa(r,u,s),u})}createUniqueName(e){const t=Yt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(l){return i[It.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(d){return TS(d,l,t)})}const a=[];for(let l=0,d=e.length;l0&&JB(b,s),b.name=t.createUniqueName(s.name||"mesh_"+e),is(b,s),M.extensions&&fa(r,b,M),t.assignFinalMaterial(b),u.push(b)}for(let v=0,w=u.length;v1?m=new Nr:h.length===1?m=h[0]:m=new sn,m!==h[0])for(let u=0,g=h.length;u{const u=new Map;for(const[g,v]of r.associations)(g instanceof _i||g instanceof qn)&&u.set(g,v);return m.traverse(g=>{const v=r.associations.get(g);v!=null&&u.set(g,v)}),u};return r.associations=h(s),s})}_createAnimationTracks(e,t,i,r,s){const a=[],l=e.name?e.name:e.uuid,d=[];Ps[s.path]===Ps.weights?e.traverse(function(g){g.morphTargetInfluences&&d.push(g.name?g.name:g.uuid)}):d.push(l);let h;switch(Ps[s.path]){case Ps.weights:h=Fa;break;case Ps.rotation:h=Qs;break;case Ps.position:case Ps.scale:h=Ua;break;default:switch(i.itemSize){case 1:h=Fa;break;case 2:case 3:default:h=Ua;break}break}const m=r.interpolation!==void 0?KB[r.interpolation]:Ic,u=this._getArrayFromAccessor(i);for(let g=0,v=d.length;g{this.parse(a,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,on,i).catch(i)}decodeDracoFile(e,t,i,r,s=Sn,a=()=>{}){const l={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:s};return this.decodeGeometry(e,l).then(t).catch(a)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Pp.has(e)){const d=Pp.get(e);if(d.key===i)return d.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,a=e.byteLength,l=this._getWorker(s,a).then(d=>(r=d,new Promise((h,m)=>{r._callbacks[s]={resolve:h,reject:m},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(d=>this._createGeometry(d.geometry));return l.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Pp.set(e,{key:i,promise:l}),l}_createGeometry(e){const t=new On;e.index&&t.setIndex(new _n(e.index.array,1));for(let i=0;i{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=s4.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengths._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const u=m.draco,g=new u.Decoder;try{const v=t(u,g,new Int8Array(d),h),w=v.attributes.map(T=>T.array.buffer);v.index&&w.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},w)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{u.destroy(g)}});break}};function t(a,l,d,h){const m=h.attributeIDs,u=h.attributeTypes;let g,v;const w=l.GetEncodedGeometryType(d);if(w===a.TRIANGULAR_MESH)g=new a.Mesh,v=l.DecodeArrayToMesh(d,d.byteLength,g);else if(w===a.POINT_CLOUD)g=new a.PointCloud,v=l.DecodeArrayToPointCloud(d,d.byteLength,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const T={index:null,attributes:[]};for(const M in m){const b=self[u[M]];let A,E;if(h.useUniqueIDs)E=m[M],A=l.GetAttributeByUniqueId(g,E);else{if(E=l.GetAttributeId(g,a[m[M]]),E===-1)continue;A=l.GetAttribute(g,E)}const P=r(a,l,g,M,b,A);M==="color"&&(P.vertexColorSpace=h.vertexColorSpace),T.attributes.push(P)}return w===a.TRIANGULAR_MESH&&(T.index=i(a,l,g)),a.destroy(g),T}function i(a,l,d){const m=d.num_faces()*3,u=m*4,g=a._malloc(u);l.GetTrianglesUInt32Array(d,u,g);const v=new Uint32Array(a.HEAPF32.buffer,g,m).slice();return a._free(g),{array:v,itemSize:1}}function r(a,l,d,h,m,u){const g=u.num_components(),w=d.num_points()*g,T=w*m.BYTES_PER_ELEMENT,M=s(a,m),b=a._malloc(T);l.GetAttributeDataArrayForAllPoints(d,u,M,T,b);const A=new m(a.HEAPF32.buffer,b,w).slice();return a._free(b),{name:h,array:A,itemSize:g}}function s(a,l){switch(l){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}var H_=function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var r=WebAssembly.validate(t)?e:n,s,a=WebAssembly.instantiate(l(r),{}).then(function(b){s=b.instance,s.exports.__wasm_call_ctors()});function l(b){for(var A=new Uint8Array(b.length),E=0;E96?P-97:P>64?P-39:P+4}for(var G=0,E=0;E0?T(b,A,E,m[P],h[G]):a.then(function(){var O=new Uint8Array(b*A);return d(s.exports[m[P]],O,b,A,E,s.exports[h[G]]),O})}}}();class a4 extends D_{constructor(e){super(e),this.type=gi}parse(e){const a=function(F,D){switch(F){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(D||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(D||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(D||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(D||""))}},m=` +`,u=function(F,D,L){D=D||1024;let ie=F.pos,re=-1,de=0,me="",$=String.fromCharCode.apply(null,new Uint16Array(F.subarray(ie,ie+128)));for(;0>(re=$.indexOf(m))&&de=F.byteLength||!(me=u(F)))&&a(1,"no header found"),($=me.match(D))||a(3,"bad initial token"),de.valid|=1,de.programtype=$[1],de.string+=me+` +`;me=u(F),me!==!1;){if(de.string+=me+` +`,me.charAt(0)==="#"){de.comments+=me+` +`;continue}if(($=me.match(L))&&(de.gamma=parseFloat($[1])),($=me.match(V))&&(de.exposure=parseFloat($[1])),($=me.match(ie))&&(de.valid|=2,de.format=$[1]),($=me.match(re))&&(de.valid|=4,de.height=parseInt($[1],10),de.width=parseInt($[2],10)),de.valid&2&&de.valid&4)break}return de.valid&2||a(3,"missing format specifier"),de.valid&4||a(3,"missing image size specifier"),de},v=function(F,D,L){const V=D;if(V<8||V>32767||F[0]!==2||F[1]!==2||F[2]&128)return new Uint8Array(F);V!==(F[2]<<8|F[3])&&a(3,"wrong scanline width");const ie=new Uint8Array(4*D*L);ie.length||a(4,"unable to allocate buffer space");let re=0,de=0;const me=4*V,$=new Uint8Array(4),ue=new Uint8Array(me);let Y=L;for(;Y>0&&deF.byteLength&&a(1),$[0]=F[de++],$[1]=F[de++],$[2]=F[de++],$[3]=F[de++],($[0]!=2||$[1]!=2||($[2]<<8|$[3])!=V)&&a(3,"bad rgbe scanline format");let pe=0,_e;for(;pe128;if(Pe&&(_e-=128),(_e===0||pe+_e>me)&&a(3,"bad scanline data"),Pe){const Ue=F[de++];for(let ae=0;ae<_e;ae++)ue[pe++]=Ue}else ue.set(F.subarray(de,de+_e),pe),pe+=_e,de+=_e}const Ae=V;for(let Pe=0;Pe-1&&(e.splice(t,1),e.length===0&&delete this._events[i]),this}clear(){return this._events={},this}has(e){return!!this._events[e]}on(e,t,i,r=!1){let s=this._events[e];if(s==null&&(s=this._events[e]=[]),s.findIndex(l=>l.callback===t&&(!i||l.target===i))>-1){console.warn(`event: ${e} duplicate registered`);return}return s.push({name:e,callback:t,target:i,once:r}),this}off(e,t,i){let r=this._events[e];if(r){let s=r.findIndex(a=>a.callback===t&&(!i||a.target===i));this._removeEvent(r,s,e)}return this}onof(e,t,i){return i._listeners===void 0&&(i._listeners=[]),i._listeners.push({name:e,callback:t}),this.on(e,t),this}offof(e){for(let t of e._listeners)this.off(t.name,t.callback);return this}targetOff(e){for(let t in this._events){let i=this._events[t];for(let r=i.length;r--;)i[r].target===e&&this._removeEvent(i,r,t)}return this}emit(e,...t){let i=this._events[e];if(i)for(let r=i.length;r--;){let s=i[r];s&&(s.once&&this._removeEvent(i,r,e),s.target?s.callback.apply(s.target,t):s.callback(...t))}return this}constructor(){this._events={}}}console.log.bind(console);console.info.bind(console);console.warn.bind(console);console.error.bind(console);function lT(n,e=[]){return typeof n=="function"?new n(...e):n}const Br=Object.freeze({Linear:Object.freeze({None(n){return n},In(n){return n},Out(n){return n},InOut(n){return n}}),Quadratic:Object.freeze({In(n){return n*n},Out(n){return n*(2-n)},InOut(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In(n){return n*n*n},Out(n){return--n*n*n+1},InOut(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In(n){return n*n*n*n},Out(n){return 1- --n*n*n*n},InOut(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In(n){return n*n*n*n*n},Out(n){return--n*n*n*n*n+1},InOut(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In(n){return 1-Math.sin((1-n)*Math.PI/2)},Out(n){return Math.sin(n*Math.PI/2)},InOut(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In(n){return n===0?0:Math.pow(1024,n-1)},Out(n){return n===1?1:1-Math.pow(2,-10*n)},InOut(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In(n){return 1-Math.sqrt(1-n*n)},Out(n){return Math.sqrt(1- --n*n)},InOut(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In(n){return n===1?1:n*n*((1.70158+1)*n-1.70158)},Out(n){return n===0?0:--n*n*((1.70158+1)*n+1.70158)+1},InOut(n){const e=2.5949095;return(n*=2)<1?.5*(n*n*((e+1)*n-e)):.5*((n-=2)*n*((e+1)*n+e)+2)}}),Bounce:Object.freeze({In(n){return 1-Br.Bounce.Out(1-n)},Out(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut(n){return n<.5?Br.Bounce.In(n*2)*.5:Br.Bounce.Out(n*2-1)*.5+.5}}),generatePow(n=4){return n=n1e4?1e4:n,{In(e){return e**n},Out(e){return 1-(1-e)**n},InOut(e){return e<.5?(e*2)**n/2:(1-(2-e*2)**n)/2+.5}}}}),Po={Linear:function(n,e){const t=n.length-1,i=t*e,r=Math.floor(i),s=Po.Utils.Linear;return e<0?s(n[0],n[1],i):e>1?s(n[t],n[t-1],t-i):s(n[r],n[r+1>t?t:r+1],i-r)},Bezier:function(n,e){let t=0;const i=n.length-1,r=Math.pow,s=Po.Utils.Bernstein;for(let a=0;a<=i;a++)t+=r(1-e,i-a)*r(e,a)*n[a]*s(i,a);return t},CatmullRom:function(n,e){const t=n.length-1;let i=t*e,r=Math.floor(i);const s=Po.Utils.CatmullRom;return n[0]===n[t]?(e<0&&(r=Math.floor(i=t*(1+e))),s(n[(r-1+t)%t],n[r],n[(r+1)%t],n[(r+2)%t],i-r)):e<0?n[0]-(s(n[0],n[0],n[1],n[1],-i)-n[0]):e>1?n[t]-(s(n[t],n[t],n[t-1],n[t-1],i-t)-n[t]):s(n[r?r-1:0],n[r],n[t1;i--)t*=i;return n[e]=t,t}}(),CatmullRom:function(n,e,t,i,r){const s=(t-n)*.5,a=(i-e)*.5,l=r*r,d=r*l;return(2*e-2*t+s+a)*d+(-3*e+3*t-2*s-a)*l+s*r+e}}},Ql=()=>performance.now()*.001;class cT{getAll(){return Object.keys(this._tweens).map(e=>this._tweens[e])}removeAll(){this._tweens={}}add(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e}remove(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]}update(e=Ql(),t=!1){let i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r"u"||s)&&(t[a]=l),d||(t[a]*=1),m?r[a]=i[a].slice().reverse():r[a]=t[a]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(e=Ql()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)}resume(e=Ql()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let e=0,t=this._chainedTweens.length;e{let i=this._chainedTweens.findIndex(r=>r===t);i>-1&&this._chainedTweens.splice(i,1)}),this}onStart(e){return this._onStartCallback=e,this}onEveryStart(e){return this._onEveryStartCallback=e,this}onUpdate(e){return this._onUpdateCallback=e,this}onRepeat(e){return this._onRepeatCallback=e,this}onComplete(e){return this._onCompleteCallback=e,this}onStop(e){return this._onStopCallback=e,this}update(e=Ql(),t=!0){if(this._isPaused)return!0;const i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,ei)return 1;const r=e%t,s=Math.min(r/this._duration,1);return s===0&&e!==0&&e%this._duration===0?1:s}_calculateCompletionStatus(e,t){return this._duration!==0&&e0?Math.trunc((e-this._duration)/t)+1:1,this._repeat);isFinite(this._repeat)&&(this._repeat-=i);for(const r in this._valuesStartRepeat){const s=this._valuesEnd[r];!this._yoyo&&typeof s=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(s)),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*i}_updateProperties(e,t,i,r){for(const s in i){if(t[s]===void 0)continue;const a=t[s]||0;let l=i[s];const d=Array.isArray(e[s]),h=Array.isArray(l);if(!d&&h)e[s]=this._interpolationFunction(l,r);else if(typeof l=="object"&&l){this._updateProperties(e[s],a,l,r);let u=Object.getOwnPropertyDescriptor(e,s);u&&u.set&&(e[s]=e[s])}else l=this._handleRelativeValue(a,l),typeof l=="number"&&(e[s]=a+(l-a)*r)}}_handleRelativeValue(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)}_swapEndStartRepeatValues(e){const t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t}constructor(e,t=AS){this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=0,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Br.Linear.None,this._interpolationFunction=Po.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=$h.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._headTween=null,this._tailTween=null,this._headTweenStartFired=!1,this._goToEnd=!1}}class o4{start(){return this._tween.start(),this}stop(){return this._tween.stop(),this}repeat(e){return this._chainedTween.repeat(e),this}union(){return this._chainedTween=this._tween=new Lp(this._object,this._group).union(this._tween,this._chainedTween),this}call(e){return this._chainTween().call(e),this}delay(e){return this._chainTween().delay(e),this}to(e,t,i){let r=this._chainTween().to(e,t);return i&&(i.from&&r.from(i.from),i.easing&&r.easing(i.easing),i.onStart&&r.onStart(i.onStart),i.onStop&&r.onStop(i.onStop),i.onComplete&&r.onComplete(i.onComplete),i.onUpdate&&r.onUpdate(i.onUpdate),i.onRepeat&&r.onRepeat(i.onRepeat)),this}_chainTween(){let e=this._tween;return this._chainedTween&&(e=new Lp(this._object,this._group),this._chainedTween.chain(e)),this._chainedTween=e,e}constructor(e,t){this._object=e,this._group=t,this._tween=new Lp(e,t)}}class l4{destroy(){this._group.removeAll()}update(e){this._group.update(e)}timeline(e){return new o4(e,this._group)}killTweensOf(e){this._group.getAll().forEach(t=>t._object===e&&this._group.remove(t))}constructor(){this._group=new cT}}class Nn{static _setUserData(e){const t=Nn._texKeys,i=[],r={},s={},a=[e];for(;a.length!==0;){let l=a.shift();if(l.isMesh){i.push(l);const d=l.material;Array.isArray(d)?d.forEach(h=>s[h.uuid]=h):s[d.uuid]=d}a.push(...l.children)}return Object.values(s).forEach(l=>{t.forEach(d=>{let h=l[d];h&&(r[h.uuid]=h)})}),Object.assign(e.userData,{meshes:i,materials:s,textures:r}),e}constructor(e){this.manager=e}}Nn._texKeys=["map","alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","metalnessMap","normalMap","roughnessMap","specularMap","alphaMap"];class c4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new eT),h.manager=r,h.setPath(t),h.setResourcePath(i),h.load(e,m=>a(Object.assign(m,s)),l,d)}constructor(...e){super(...e),this.extension=["exr"]}}class u4 extends Nn{load({url:e,buffer:t,path:i,resourcePath:r,manager:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new fB),h.manager=s,h.setPath(i),h.setResourcePath(r);const m=u=>{a(Nn._setUserData(u))};t?m(h.parse(t,r)):h.load(e,m,l,d)}constructor(...e){super(...e),this.extension=["fbx"]}}class d4 extends Nn{load({url:e,buffer:t,path:i,resourcePath:r,dracoPath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._dracoLoader;m===void 0&&(m=this._dracoLoader=new z_),m.manager=a,m.setDecoderPath(s);let u=this._loader;u===void 0&&(u=this._loader=new B_,u.setDRACOLoader(m),u.setMeshoptDecoder(H_)),u.manager=a,u.setPath(i),u.setResourcePath(r);const g=v=>{const w=v.scene;w.animations.push(...v.animations),l(Nn._setUserData(w))};t?u.parse(t,r,g,h):u.load(e,g,d,h)}constructor(...e){super(...e),this.extension=["gltf","glb"]}}class h4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new a4),h.manager=r,h.setPath(t),h.setResourcePath(i);const m=Object.assign({mapping:el},s);h.load(e,u=>a(Object.assign(u,m)),l,d)}constructor(...e){super(...e),this.extension=["hdr"]}}class f4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,onLoad:s,onProgress:a,onError:l}){let d=this._loader;d===void 0&&(d=this._loader=new _s),d.manager=r,d.setPath(t),d.setResourcePath(i),d.load(e,h=>s(JSON.parse(h)),a,l)}constructor(...e){super(...e),this.extension=["json"]}}class p4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new Xh),h.manager=r,h.setPath(t),h.setResourcePath(i);const m=u=>{u.colorSpace=on,a(Object.assign(u,s))};h.load(e,m,l,d)}constructor(...e){super(...e),this.extension=["png","jpg","webp","avif"]}}function Et(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var l=n.length-1;l>=0;l--)(a=n[l])&&(s=(r<3?a(s):r>3?a(e,t,s):a(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}class m4{property(e,t={}){return this._properties[e]=t,this}applyProperties(e){return Object.assign(e,this._properties),e}constructor(e){this.clsName=e,this._properties=Object.create(null)}}class Ii{static _hasProperties(e){return Ii._propertyMap.has(e)}static _getProperties(e,t=!0){let i=Ii._propertyMap.get(e);return i===void 0&&t&&(i=Object.create(null),Ii._propertyMap.set(e,i)),i}static _getMergedProperties(e){let t=null;for(;e!==Object.constructor.prototype;){let i=Ii._getProperties(e,!1);i&&(t===null&&(t=Object.create(null)),Object.assign(t,i)),e=Object.getPrototypeOf(e)}return t}static _getClassProperties(e,t=!0){let i=Ii._classMap.get(e);return i===void 0&&t&&(i=new m4(e),Ii._classMap.set(e,i)),i}static _applyClassProperties(e,t){let i=Ii._getClassProperties(e,!1);return i?i.applyProperties(Ii._getProperties(t)):Ii._getProperties(t,!1)}}Ii._classMap=new Map;Ii._propertyMap=new Map;function rt(n,e){let t=null;function i(r,s){Ii._getProperties(r.constructor)[s]=t}if(n===void 0)return rt({});if(typeof e>"u")return t=n,i;t={},i(n,e)}const uT={Linear:Br.Linear.None,QuadraticIn:Br.Quadratic.In,QuadraticOut:Br.Quadratic.Out,QuadraticInOut:Br.Quadratic.InOut};class V_{constructor(){this.style=uT.QuadraticInOut,this.time=4}}Et([rt({value:uT})],V_.prototype,"style",void 0);Et([rt],V_.prototype,"time",void 0);class Zc{constructor(){this.instanceId=Zc._instanceCount++,this.uuid=bn.generateUUID(),this.name="",this.type="ObjectInstance"}}Zc._instanceCount=0;class sl extends Zc{get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.manager.componentScheduler.enableComponent(this,e))}_onPreDestroy(){this.unscheduleAll(),this.manager.removeComponent(this.node,this),this._enabled&&this.manager.componentScheduler.enableComponent(this,!1),this.onDestroy&&this.flags.OnLoadCalled&&this.onDestroy()}schedule(e,t,i=-1){this.manager.scheduler.schedule(this,e,t,i)}unshedule(e){this.manager.scheduler.unshedule(this,e)}unscheduleAll(){this.manager.scheduler.unscheduleAll(this)}destroy(){return this.flags.Destroyed?!1:(this.destroyImmediate(),!0)}destroyImmediate(){this._onPreDestroy&&this._onPreDestroy(),this.flags.Destroyed=!0}constructor(...e){super(...e),this._enabled=!0,this.type="Component",this.flags={}}}const{clamp:g4,lerp:_4}=bn;class dT extends sl{get vcam(){return this._vcam}get vcams(){return this._vcams}lastUpdate(e){let t=this.getActiveCamera();if(t!=null)if(this._vcams.forEach(i=>{i.locked||(i.enabled=i===t)}),this._lerpTimee.enabled||e.locked).sort((e,t)=>t.priority-e.priority)[0]}_lerpToMainCamera(e,t){const i=this.node,r=e,{lens:s,finalPosition:a,finalRotation:l}=r,d=i.fov!=s.fov||i.near!=s.near||i.far!=s.far;i.position.lerp(a,t),i.quaternion.slerp(l,t),i.fov=_4(i.fov,s.fov,t),i.near=s.near,i.far=s.far,d&&i.updateProjectionMatrix()}constructor(...e){super(...e),this._vcam=null,this._vcamSolo=null,this._vcams=[],this._lerpTime=4,this.brainBlend=new V_}}Et([rt],dT.prototype,"brainBlend",void 0);class qh{constructor(){this.fov=45,this.near=.1,this.far=1e3}}Et([rt],qh.prototype,"fov",void 0);Et([rt],qh.prototype,"near",void 0);Et([rt],qh.prototype,"far",void 0);class W_ extends sl{get finalPosition(){return this._finalPosition.copy(this.node.position).add(this.correctPosition)}get finalRotation(){return this._finalRotation.copy(this.node.quaternion).multiply(this.correctRotation)}onLoad(){const e=this.viewer.camera;this.node.isCamera=!0,this.lens.fov=e.fov,this.lens.near=e.near,this.lens.far=e.far,this.brain=this.viewer.getComponent(e,dT,!0),this.brain.addCamera(this)}onDestroy(){this.brain.removeCamera(this)}constructor(...e){super(...e),this._finalPosition=new j,this._finalRotation=new Gn,this.locked=!1,this.priority=10,this.lens=new qh,this.correctPosition=new j,this.correctRotation=new Gn}}Et([rt],W_.prototype,"lens",void 0);const Ls={NONE:1,SELECTED:2,IN:4};class v4{connect(e){let t=this._connectors.find(i=>i.target===e);t===void 0&&(t={target:e,state:Ls.NONE},this._connectors.push(t))}disconnect(e){let t=this._connectors.findIndex(i=>i.target===e);t!==-1&&this._connectors.splice(t,1)}pointerDown(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("click")||i.target.has("pointerdown")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length&&(i.state|=Ls.SELECTED,i.target.emit("pointerdown",{intersects:r}))}}}pointerUp(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("click")||i.target.has("pointerup")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length&&(i.state&Ls.SELECTED&&(i.state&=~Ls.SELECTED,i.target.emit("click",{intersects:r})),i.target.emit("pointerup",{intersects:r}))}}}pointerMove(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("pointerover")||i.target.has("pointerout")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length?i.state&Ls.IN||(i.state|=Ls.IN,i.target.emit("pointerover",{intersects:r})):i.state&Ls.IN&&(i.state&=~Ls.IN,i.target.emit("pointerout",{intersects:r}))}}}constructor(){this._raycaster=new GN,this._connectors=[]}}class mt{get pointerButton(){return this._pointerButton}get pointer(){return this._pointer}get pointerPosition(){return this._pointerPosition}get mouseWheel(){return this._mouseWheel}get touchCount(){return this._touchCount}get touches(){return this._touches}get keys(){return this._keys}addEventListeners(){const e=this.viewer.canvas;e.style.touchAction="none",this._addEventListener(e,"contextmenu",t=>t.preventDefault()),this._addEventListener(e,"pointerdown",t=>this._onPointerDown(t),{passive:!1}),this._addEventListener(e,"pointerup",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointercancel",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointerout",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointermove",t=>this._onPointerMove(t),{passive:!0}),this._addEventListener(e,"wheel",t=>this._onMouseWheel(t),{passive:!1}),this._addEventListener(e,"touchstart",t=>this._onTouchStart(t),{passive:!0}),this._addEventListener(e,"touchend",t=>this._onTouchEnd(t),{passive:!0}),this._addEventListener(e,"touchmove",t=>this._onTouchMove(t),{passive:!0}),this._addEventListener(window,"keydown",t=>this._onKeyDown(t),{passive:!1}),this._addEventListener(window,"keypress",t=>this._onKeyPress(t),{passive:!1}),this._addEventListener(window,"keyup",t=>this._onKeyUp(t),{passive:!1})}removeAllListeners(){for(let{target:e,type:t,callback:i}of this._listeners)e.removeEventListener?e.removeEventListener(t,i):e.off&&e.off(t,i,e);this._listeners=[]}connect(e,t){switch(t){case mt.CLICK:case mt.POINTER_DOWN:case mt.POINTER_UP:case mt.POINTER_OVER:case mt.POINTER_OUT:this._pressability.connect(e);break}}disconnect(e){this._pressability.disconnect(e)}_addEventListener(e,t,i,r){e.addEventListener?e.addEventListener(t,i,r):e.on&&e.on(t,i,e),this._listeners.push({target:e,type:t,callback:i})}_remapPointer(e){const t=this.viewer.width;return this.viewer.rootRotated?{button:e.button,buttons:e.buttons,clientX:e.clientY,clientY:t-e.clientX,offsetX:e.offsetY,offsetY:t-e.offsetX,pageX:e.pageY,pageY:t-e.pageX,screenX:e.screenY,screenY:t-e.screenX,movementX:e.movementY,movementY:e.movementX}:e}_remapTouch(e){const t=this.viewer.width;return this.viewer.rootRotated?{touches:Array.from(e.touches).map(i=>({identifier:i.identifier,clientX:i.clientY,clientY:t-i.clientX,pageX:i.pageY,pageY:t-i.pageX,screenX:i.screenY,screenY:t-i.screenX}))}:e}_computePointer(e){this._pointer.x=e.offsetX/this.viewer.width*2-1,this._pointer.y=1-e.offsetY/this.viewer.height*2,this._pointerPosition.set(e.offsetX,e.offsetY)}_onPointerDown(e){e.preventDefault(),e=this._remapPointer(e),this._pointerButton=e.button,this._computePointer(e),this._pressability.pointerDown(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_DOWN,e)}_onPointerUp(e){e.preventDefault(),e=this._remapPointer(e),this._pointerButton=-1,this._computePointer(e),this._pressability.pointerUp(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_UP,e)}_onPointerMove(e){e=this._remapPointer(e),this._computePointer(e),this._pressability.pointerMove(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_MOVE,e)}_onMouseWheel(e){e.preventDefault(),this._mouseWheel=e.deltaY||e.wheelDelta,this.viewer.emit(mt.MOUSE_WHEEL,e)}_onTouchStart(e){e=this._remapTouch(e),this.viewer.emit(mt.TOUCH_START,e)}_onTouchEnd(e){e=this._remapTouch(e),this.viewer.emit(mt.TOUCH_END,e)}_onTouchMove(e){e=this._remapTouch(e);let t=e.touches,i=this._touches;for(let r=t.length;r--;){i[r]==null&&(i[r]={id:-1,position:new et});const s=t[r];i[r].id=s.identifier,i[r].position.set(s.pageX,s.pageY)}this._touchCount=t.length,this.viewer.emit(mt.TOUCH_MOVE,e)}_onKeyDown(e){this._keys[e.key]=!0,this.viewer.emit(mt.KEYDOWN,e)}_onKeyPress(e){this._keys[e.key]=!0,this.viewer.emit(mt.KEYPRESS,e)}_onKeyUp(e){this._keys[e.key]=!1,this.viewer.emit(mt.KEYUP,e)}constructor(e){this.viewer=e,this._listeners=[],this._mouseWheel=0,this._touches=[],this._touchCount=0,this._pointerButton=-1,this._pointerPosition=new et,this._pointer=new et,this._keys={},this._pressability=new v4}}mt.CLICK="click";mt.MOUSE_WHEEL="mousewheel";mt.TOUCH_START="touchstart";mt.TOUCH_END="touchend";mt.TOUCH_MOVE="touchmove";mt.POINTER_DOWN="pointerdown";mt.POINTER_UP="pointerup";mt.POINTER_MOVE="pointermove";mt.POINTER_OVER="pointerover";mt.POINTER_OUT="pointerout";mt.KEYDOWN="keydown";mt.KEYPRESS="keypress";mt.KEYUP="keyup";mt.RESIZE="resize";const CS=typeof window>"u";class y4{match(e,t){const i=this.userAgent.match(t);return i&&i.length>1&&i[e]||""}get isMobile(){return!this.isTablet&&(/[^-]mobi/i.test(this.userAgent)||this.iOSDevice==="iphone"||this.iOSDevice==="ipod"||this.isAndroidDevice||/nexus\s*[0-6]\s*/i.test(this.userAgent))}get isTablet(){return/tablet/i.test(this.userAgent)&&!/tablet pc/i.test(this.userAgent)||this.iOSDevice==="ipad"||this.isAndroidDevice&&!/[^-]mobi/i.test(this.userAgent)||!/nexus\s*[0-6]\s*/i.test(this.userAgent)&&/nexus\s*[0-9]+/i.test(this.userAgent)}get isDesktop(){return!this.isMobile&&!this.isTablet}get isMacOS(){return/macintosh/i.test(this.userAgent)&&{version:this.match(1,/mac os x (\d+(\.?_?\d+)+)/i).replace(/[_\s]/g,".").split(".").map(e=>e)[1]}}get isWindows(){return/windows /i.test(this.userAgent)&&{version:this.match(1,/Windows ((NT|XP)( \d\d?.\d)?)/i)}}get isiOS(){return!!this.iOSDevice&&{version:this.match(1,/os (\d+([_\s]\d+)*) like mac os x/i).replace(/[_\s]/g,".")||this.match(1,/version\/(\d+(\.\d+)?)/i)}}get isAndroid(){return this.isAndroidDevice&&{version:this.match(1,/android[ \/-](\d+(\.\d+)*)/i)}}get browser(){const e=this.match(1,/version\/(\d+(\.\d+)?)/i);return/opera/i.test(this.userAgent)?{name:"Opera",version:e||this.match(1,/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(this.userAgent)?{name:"Opera",version:this.match(1,/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||e}:/SamsungBrowser/i.test(this.userAgent)?{name:"Samsung Internet for Android",version:e||this.match(1,/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(this.userAgent)?{name:"Yandex Browser",version:e||this.match(1,/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(this.userAgent)?{name:"UC Browser",version:this.match(1,/(?:ucbrowser)[\s\/](\d+(\.\d+)?)/i)}:/msie|trident/i.test(this.userAgent)?{name:"Internet Explorer",version:this.match(1,/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/(edge|edgios|edga|edg)/i.test(this.userAgent)?{name:"Microsoft Edge",version:this.match(2,/(edge|edgios|edga|edg)\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(this.userAgent)?{name:"Firefox",version:this.match(1,/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)}:/chromium/i.test(this.userAgent)?{name:"Chromium",version:this.match(1,/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||e}:/chrome|crios|crmo/i.test(this.userAgent)?{name:"Chrome",version:this.match(1,/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/safari|applewebkit/i.test(this.userAgent)?{name:"Safari",version:e}:{name:this.match(1,/^(.*)\/(.*) /),version:this.match(2,/^(.*)\/(.*) /)}}constructor(e){this.userAgent=e||(!CS&&window.navigator?window.navigator.userAgent:""),this.isAndroidDevice=!/like android/i.test(this.userAgent)&&/android/i.test(this.userAgent),this.iOSDevice=this.match(1,/(iphone|ipod|ipad)/i).toLowerCase(),!CS&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>2&&!window.MSStream&&(this.iOSDevice="ipad")}}const ur=new y4,j_=(navigator.userAgent||navigator.vendor).toLowerCase(),ml=typeof ur.browser=="boolean"?"":ur.browser.name,b4=document.createElement("audio");class Mt{}Mt.isTablet=ur.isTablet;Mt.isMobile=ur.isMobile||ur.isTablet;Mt.isDesktop=ur.isDesktop;Mt.device=Mt.isMobile?"mobile":"desktop";Mt.isAndroid=!!ur.isAndroid;Mt.isIOS=!!ur.isiOS;Mt.isMacOS=!!ur.isMacOS;Mt.isWindows=typeof ur.isWindows=="boolean"?ur.isWindows:ur.isWindows.version!==null;Mt.isLinux=j_.indexOf("linux")!=-1;Mt.ua=j_;Mt.isEdge=ml==="Microsoft Edge";Mt.isIE=ml==="Internet Explorer";Mt.isFirefox=ml==="Firefox";Mt.isChrome=ml==="Chrome";Mt.isOpera=ml==="Opera";Mt.isSafari=ml==="Safari";Mt.isSupportMSAA=!j_.match("version/15.4 ");Mt.isSupportOgg=!!b4.canPlayType("audio/ogg");Mt.isRetina=window.devicePixelRatio&&window.devicePixelRatio>=1.5;Mt.devicePixelRatio=window.devicePixelRatio||1;Mt.cpuCoreCount=navigator.hardwareConcurrency||1;Mt.baseUrl=document.location.origin;Mt.isIFrame=window.self!==window.top;Object.freeze(new j(1,0,0));Object.freeze(new j(0,1,0));Object.freeze(new j(0,0,1));Object.freeze(new j(1,0,0));Object.freeze(new j(0,1,0));Object.freeze(new j(0,0,0));Object.freeze(new j(1,1,1));Object.freeze(new j(-1,-1,-1));const{clamp:hT}=bn,{max:u8,abs:x4,acos:d8}=Math,fT=1e-6,w4=new j;function pT(n,e,t,i,r=n){if(i<=0)return r.copy(e);let s=w4.copy(e).sub(n);return s.lengthSq()0?this._targetSpringLength*=this._calculateDistanceScale(1/.85):e.deltaY<0&&(this._targetSpringLength*=this._calculateDistanceScale(.85)),this._calculateTargetSpringArm()}_onTouchStart(e){if(!Mt.isMobile)return;let t=e.touches;t.length>1?(this._preLoc0.set(t[0].pageX,t[0].pageY),this._preLoc1.set(t[1].pageX,t[1].pageY)):t.length>0&&(this._touchID=t[0].identifier,this._preLoc0.set(t[0].pageX,t[0].pageY))}_onTouchMove(e){if(!Mt.isMobile)return;const{__loc0:t,__loc1:i,__panDelta:r,__rotateDelta:s,__preCenter:a,__center:l}=Ft;let d=e.touches;d.length>1?(t.set(d[0].pageX,d[0].pageY),i.set(d[1].pageX,d[1].pageY),this.lookAt&&(this._targetSpringLength*=this._calculateDistanceScale(this._preLoc0.distanceTo(this._preLoc1)/t.distanceTo(i))),a.copy(this._preLoc0).add(this._preLoc1).multiplyScalar(.5),l.copy(t).add(i).multiplyScalar(.5),this._calculatePanDelta(r,a,l),this._calculateTargetLookAt(r),this._calculateTargetSpringArm(),this._preLoc0.copy(t),this._preLoc1.copy(i)):d.length>0&&this._touchID===d[0].identifier&&(t.set(d[0].pageX,d[0].pageY),this._calculateRotatelDelta(s,this._preLoc0,t),this._calculateTargetSpringArm(s),this._preLoc0.copy(t))}_calculateDistanceScale(e){return this._tempRotateSmoothing=this.rotateSmoothing,this.forbidZ&&(e=1),e}_calculateRotatelDelta(e,t,i){this._tempRotateSmoothing=this.rotateSmoothing;const r=this.viewer.canvas;return e.copy(i).sub(t).multiplyScalar(this.rotateSpeed*2*Math.PI/r.clientHeight),e.y=-e.y,this.forbidX&&(e.x=0),this.forbidY&&(e.y=0),e}_calculatePanDelta(e,t,i){this._tempRotateSmoothing=this.rotateSmoothing;const r=this.viewer.canvas;return e.copy(i).sub(t).multiplyScalar(this.panSpeed/r.clientHeight),this.forbidPanX&&(e.x=0),this.forbidPanY&&(e.y=0),e}_calculateTargetLookAt(e){const{__xAxis:t,__yAxis:i,__posDelta:r}=Ft;t.setFromMatrixColumn(this.node.matrix,0),i.setFromMatrixColumn(this.node.matrix,1),this.forbitPanOffsetY&&(i.y=0,i.normalize()),r.copy(this.node.position).sub(this.lookAt);const s=r.length()*2*E4(S4(this.fov*.5));this._targetLookAt.sub(t.multiplyScalar(e.x*s)).add(i.multiplyScalar(e.y*s))}_calculateTargetSpringArm(e,t){e&&(this._targetTheta-=e.x,this._targetPhi+=e.y),t&&(this._targetSpringLength=t),this._targetTheta=Ip(this._targetTheta,this.thetaMin,this.thetaMax),this._targetPhi=Ip(this._targetPhi,this.phiMin,this.phiMax),this._targetSpringLength=Ip(this._targetSpringLength,this.distanceMin,this.distanceMax)}gotoPOI({duration:e=-1,easing:t=Br.Cubic.InOut,springLength:i=this._targetSpringLength,theta:r=this._targetTheta,phi:s=this._targetPhi,lookAt:a=this._lookAt,fov:l=this.lens.fov,smoothing:d=this.smoothing,rotateSmoothing:h=d}){this._targetFov=l,this._tempSmoothing=d,this._tempRotateSmoothing=h,this._targetLookAt.copy(a);const m=r%dd,u=this._spherical.theta=this._spherical.theta%dd,g=[m,m-dd,m+dd],v=g.map(T=>M4(u-T)),w=Math.min(...v);this._targetTheta=g[v.findIndex(T=>T===w)],this._targetSpringLength=i,this._targetPhi=s,this._calculateTargetSpringArm(),e>0&&(this.locked=!0,this.enabled=!1,this.viewer.killTweensOf(this),this.viewer.timeline(this).to({springLength:i,theta:r,phi:s,lookAt:a,fov:l},e,{easing:t,onUpdate:()=>{this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}}).call(()=>{this.locked=!1,this.enabled=!0}).start())}update(e){const t=this._tempSmoothing,i=this._tempRotateSmoothing;this._spherical.theta=ud(this._spherical.theta,this._targetTheta,e,i),this._spherical.phi=ud(this._spherical.phi,this._targetPhi,e,i),this._spherical.radius=ud(this._spherical.radius,this._targetSpringLength,e,t),this.lens.fov=ud(this.lens.fov,this._targetFov,e,t),pT(this._lookAt,this._targetLookAt,e,t),this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}constructor(...e){super(...e),this._button=-1,this._touchID=-1,this._preLoc0=new et,this._preLoc1=new et,this._spherical=new N_(4,Math.PI/2),this._lookAt=new j,this._tempSmoothing=6,this._tempRotateSmoothing=8,this._targetTheta=0,this._targetPhi=0,this._targetSpringLength=4,this._targetFov=this.fov,this._targetLookAt=new j,this.forbidX=!1,this.forbidY=!1,this.forbidZ=!1,this.forbidPanX=!1,this.forbidPanY=!1,this.forbitPanOffsetY=!1,this.panSpeed=1,this.rotateSpeed=1,this.smoothing=5,this.rotateSmoothing=8,this.phiMin=Dp,this.phiMax=Math.PI-Dp,this.thetaMin=-1/0,this.thetaMax=1/0,this.distanceMin=Dp,this.distanceMax=1/0}}Ft.__loc0=new et;Ft.__loc1=new et;Ft.__center=new et;Ft.__preCenter=new et;Ft.__panDelta=new et;Ft.__panTarget=new et;Ft.__rotateDelta=new et;Ft.__posDelta=new j;Ft.__xAxis=new j;Ft.__yAxis=new j;Ft.__quat=new Gn;Et([rt({dir:"set"})],Ft.prototype,"forbidX",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidY",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidZ",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidPanX",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidPanY",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbitPanOffsetY",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"panSpeed",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"rotateSpeed",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"smoothing",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"rotateSmoothing",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"phiMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"phiMax",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"thetaMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"thetaMax",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"distanceMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"distanceMax",void 0);Et([rt({step:.01})],Ft.prototype,"lookAt",null);Et([rt({step:.01})],Ft.prototype,"springLength",null);Et([rt({step:.01})],Ft.prototype,"theta",null);Et([rt({step:.01})],Ft.prototype,"phi",null);Et([rt],Ft.prototype,"fov",null);class RS extends wn{constructor(...e){super(new Yc(...e))}}const A4=` +varying vec2 vUv; +void main() { + vUv = position.xy * 0.5 + 0.5; + gl_Position = vec4(position.xy, 1.0, 1.0); +} +`,C4=` +uniform mat4 textureMatrix; +varying vec4 vUv4; +varying vec2 vUv; +varying vec3 vPositionWS; + +#ifdef USE_UV1 + varying vec2 vUv1; +#endif + +#ifdef USE_UV2 + varying vec2 vUv2; +#endif + +#ifdef USE_UV3 + varying vec2 vUv3; +#endif + +varying vec3 vViewPosition; + +#include +#include +#include + +void main() { + #include + #include + + vec4 transformed = vec4(position, 1.); + +#ifdef USE_INSTANCING + transformed = instanceMatrix * transformed; +#endif + + vUv = uv; + +#ifdef USE_UV1 + vUv1 = uv1; +#endif + +#ifdef USE_UV2 + vUv2 = uv2; +#endif + +#ifdef USE_UV3 + vUv3 = uv2; +#endif + + vec4 positionWS = modelMatrix * transformed; + vec4 mvPosition = viewMatrix * positionWS; + + vUv4 = textureMatrix * positionWS; + vPositionWS = positionWS.xyz; + vViewPosition = -mvPosition.xyz; + vNormal = normalize(transformedNormal); + + gl_Position = projectionMatrix * mvPosition; + + #include +} +`,R4=` +uniform vec3 color; +uniform float alpha; +uniform float roughness; +uniform float metalness; +uniform sampler2D map; +uniform sampler2D normalMap; +uniform sampler2D roughnessMap; +uniform sampler2D aoMap; +uniform float aoMapIntensity; +uniform sampler2D lightMap; +uniform float lightMapIntensity; +uniform sampler2D reflectMap; +uniform float reflectIntensity; +varying vec3 vPositionWS; + +varying vec2 vUv; + +#ifdef USE_UV1 + varying vec2 vUv1; +#endif + +#ifdef USE_UV2 + varying vec2 vUv2; +#endif + +#ifdef USE_UV3 + varying vec2 vUv3; +#endif + +varying vec4 vUv4; +varying vec3 vViewPosition; +varying vec3 vNormal; + +#include +#include +#include + +void main() { + #include + + vec3 coord = vUv4.xyz / vUv4.w; + vec2 reflectUv = coord.xy; + +#ifdef USE_NORMALMAP + vec4 texelNormal = texture2D(normalMap, UV_NORMAL); + vec3 normal = normalize(vec3(texelNormal.r * 2.0 - 1.0, texelNormal.b, texelNormal.g * 2.0 - 1.0)); + reflectUv += coord.z * normal.xz * 0.05; +#endif + + vec3 geometryNormal = normalize(vNormal); + vec3 geometryViewDir = normalize(vViewPosition); + + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + + float metalnessFactor = metalness; + + vec4 diffuseColor = vec4(color, alpha); + +#ifdef USE_MAP + diffuseColor *= texture2D(map, vUv); +#endif + + diffuseColor.rgb = diffuseColor.rgb * ( 1.0 - metalnessFactor ); + + vec3 specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + float specularF90 = 1.0; + + float roughnessFactor = roughness; + +#ifdef USE_ROUGHNESSMAP + roughnessFactor *= texture2D(roughnessMap, UV_ROUGHNESS).g * roughness; +#endif + + computeMultiscattering( geometryNormal, geometryViewDir, specularColor, specularF90, roughnessFactor, singleScattering, multiScattering ); + + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = diffuseColor.rgb * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + + vec3 irradiance = vec3(0.); + +#ifdef USE_LIGHTMAP + irradiance += texture2D(lightMap, UV_LIGHTMAP).rgb * lightMapIntensity; +#endif + + float lod = roughnessFactor * (1.7 - 0.7 * roughnessFactor) * 6.; + vec4 reflectColor = textureLod(reflectMap, reflectUv, lod) * reflectIntensity; + + vec3 f_specular = vec3(0.); + vec3 f_diffuse = vec3(0.); + + f_specular += reflectColor.rgb * (1.0 - roughnessFactor * roughnessFactor) + multiScattering * irradiance; + f_diffuse += diffuse * irradiance; + +#ifdef USE_AOMAP + float ambientOcclusion = mix(1., texture2D(aoMap, UV_AO).r, aoMapIntensity); + + float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); + f_specular *= computeSpecularOcclusion(dotNV, ambientOcclusion, roughnessFactor); + f_diffuse *= ambientOcclusion; +#endif + + gl_FragColor = vec4(f_specular + f_diffuse, diffuseColor.a); + + #include + #include +} +`;class Kh extends zi{onBeforeCompile(e){const t=[];this.aoMap&&this.aoMap.channel&&t.push(["UV_AO",this.aoMap.channel]),this.lightMap&&this.lightMap.channel&&t.push(["UV_LIGHTMAP",this.lightMap.channel]),this.roughnessMap&&this.roughnessMap.channel&&t.push(["UV_ROUGHNESS",this.roughnessMap.channel]),this.normalMap&&this.normalMap.channel&&t.push(["UV_NORMAL",this.normalMap.channel]),t.forEach(([i,r])=>{e.defines[i]="vUv"+r})}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=e}get alpha(){return this.uniforms.alpha.value}set alpha(e){this.uniforms.alpha.value=e}get metalness(){return this.uniforms.metalness.value}set metalness(e){this.uniforms.metalness.value=e}get roughness(){return this.uniforms.roughness.value}set roughness(e){this.uniforms.roughness.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get roughnessMap(){return this.uniforms.roughnessMap.value}set roughnessMap(e){this.uniforms.roughnessMap.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get aoMap(){return this.uniforms.aoMap.value}set aoMap(e){this.uniforms.aoMap.value=e}get lightMap(){return this.uniforms.lightMap.value}set lightMap(e){this.uniforms.lightMap.value=e}get lightMapIntensity(){return this.uniforms.lightMapIntensity.value}set lightMapIntensity(e){this.uniforms.lightMapIntensity.value=e}get reflectIntensity(){return this.uniforms.reflectIntensity.value}set reflectIntensity(e){this.uniforms.reflectIntensity.value=e}constructor(...e){super(...e),this.vertexShader=C4,this.fragmentShader=R4,this.defines={UV_AO:"vUv",UV_LIGHTMAP:"vUv",UV_ROUGHNESS:"vUv",UV_NORMAL:"vUv"},this.uniforms={color:{value:new Je},alpha:{value:1},map:{value:null},reflectMap:{value:null},reflectIntensity:{value:1},textureMatrix:{value:new ot},metalness:{value:0},roughness:{value:1},roughnessMap:{value:null},normalMap:{value:null},aoMap:{value:null},aoMapIntensity:{value:1},lightMap:{value:null},lightMapIntensity:{value:1}}}}Et([rt],Kh.prototype,"color",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"alpha",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"metalness",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"roughness",null);class X_ extends Zc{constructor(...e){super(...e),this.type="Plugin"}}class Nc extends X_{static Instance(e){return e.getPlugin(Nc,!0)}add(e){return this.scene.add(e),e}remove(e){return this.scene.remove(e),e}onRender(e){const{renderer:t,camera:i}=this.viewer,r=t.autoClear;t.autoClear=!1,t.render(this.scene,i),t.autoClear=r}constructor(...e){super(...e),this.scene=new kc}}const xh=4,_g=new dl,va=(1+Math.sqrt(5))/2,uo=1/va,PS=[new j(1,1,1),new j(-1,1,1),new j(1,1,-1),new j(-1,1,-1),new j(0,va,uo),new j(0,va,-uo),new j(uo,0,va),new j(-uo,0,va),new j(va,uo,0),new j(-va,uo,0)],us={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3};function Vo(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Y_(){return` + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + direction = direction.zyx; // ( 1, v, u ) pos x + } else if ( face == 1.0 ) { + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + } else if ( face == 2.0 ) { + direction.x *= -1.0; // ( -u, v, 1 ) pos z + } else if ( face == 3.0 ) { + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + } else if ( face == 4.0 ) { + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + } else if ( face == 5.0 ) { + direction.z *= -1.0; // ( u, v, -1 ) neg z + } + + return direction; + + } + + void main() { + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + } + `}function P4(){return new zi({name:"Clear",uniforms:{map:{value:null},intensity:{value:1}},vertexShader:A4,fragmentShader:` + uniform sampler2D map; + uniform float intensity; + varying vec2 vUv; + void main() { + vec4 col = texture2D(map, vUv); + gl_FragColor = vec4(col.rgb * intensity, col.a); + } + `,blending:Gr,depthWrite:!1,depthTest:!1})}function L4(){return new zi({name:"CubeMapToCubeUV",uniforms:{envMap:{value:null},lod:{value:0},exposure:{value:1}},vertexShader:Y_(),fragmentShader:` + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + uniform samplerCube envMap; + uniform float lod; + uniform float exposure; + + void main() { + gl_FragColor = textureCubeLodEXT(envMap, vOutputDirection, lod); + gl_FragColor.rgb *= exposure; + } + `,blending:ch,depthWrite:!1,depthTest:!1})}function I4(n,e,t){return new zi({name:"MipBlurToCubeUV",defines:{CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{cubeUVMap:{value:null},lod:{value:0}},vertexShader:Y_(),fragmentShader:` + precision mediump float; + precision mediump int; + + #define ENVMAP_TYPE_CUBE_UV + #include + + varying vec3 vOutputDirection; + + uniform sampler2D cubeUVMap; + uniform float lod; + + void main() { + vec3 col = bilinearCubeUV(cubeUVMap, vOutputDirection, CUBEUV_MAX_MIP - lod); + gl_FragColor = vec4(col, 1.); + } + `,blending:ch,depthWrite:!1,depthTest:!1})}function D4(n,e,t){return new zi({name:"MipBlurToCubeUV",defines:{CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},cubeUVMap:{value:null},weight:{value:1},lod:{value:0},exposure:{value:1}},vertexShader:Y_(),fragmentShader:` + precision mediump float; + precision mediump int; + + #define ENVMAP_TYPE_CUBE_UV + #include + + varying vec3 vOutputDirection; + + uniform sampler2D cubeUVMap; + uniform samplerCube envMap; + uniform float weight; + uniform float lod; + uniform float exposure; + + void main() { + vec3 col0 = bilinearCubeUV(cubeUVMap, vOutputDirection, CUBEUV_MAX_MIP - (lod + 1.)); + vec3 col1 = textureCubeLodEXT(envMap, vOutputDirection, lod).rgb * exposure; + gl_FragColor = vec4(mix(col0, col1, weight), 1.); + } + `,blending:Gr,depthWrite:!1,depthTest:!1})}class k4{get pause(){return this._pause}set pause(e){this._pause=e}get target(){return this._target}get callback(){return this._callback}get lived(){return this._repeat>0||this._repeatForever}update(e){this._pause||(this._repeat>0||this._repeatForever)&&(this._elapsed+=e,this._elapsed>=this._interval&&(this.trigger(this._elapsed-this._lastTime),this._elapsed-=this._interval,this._lastTime=this._elapsed,this._repeat--))}trigger(e){this._target&&this._callback&&this._callback.call(this._target,e,this._elapsed)}constructor(e,t,i,r){this._target=null,this._callback=null,this._interval=0,this._repeat=0,this._elapsed=0,this._lastTime=0,this._repeatForever=!1,this._pause=!1,this._target=e,this._callback=t,this._interval=i,this._repeat=r,this._repeatForever=r===-1}}class F4{get target(){return this._target}get callers(){return this._callers}constructor(e,t){this._target=e,this._callers=t}}class U4{pause(e){let t=this._callers[e.uuid];t&&t.forEach(i=>i.pause=!0)}resume(e){let t=this._callers[e.uuid];t&&t.forEach(i=>i.pause=!1)}schedule(e,t,i,r){let s=this._callers[e.uuid];s===void 0&&(s=this._callers[e.uuid]=[],this._callersArray.push(new F4(e,s))),s.push(new k4(e,t,i,r))}unshedule(e,t){let i=this._callers[e.uuid];if(i){let r=i.findIndex(s=>s.callback===t);r!==-1&&i.splice(r,1)}}unscheduleAll(e){delete this._callers[e.uuid];let t=this._callersArray.findIndex(i=>i.target===e);t!==-1&&this._callersArray.splice(t,1)}update(e){let t,i=this._callersArray;for(let r=i.length;r--;){t=i[r].callers;for(let s=t.length;s--;)t[s].lived?t[s].update(e):t.splice(s,1)}}constructor(){this._callers={},this._callersArray=[]}}class vg{add(e){this._targets.push(e)}remove(e){let t=this._targets.indexOf(e);t!==-1&&this._targets.splice(t,1)}invoke(e){let t=this._callback;for(let i of this._targets)t(i,e)}constructor(e){this._targets=[],this._callback=e}}class O4 extends vg{invoke(e){if(this._targets.length>0){let t=this._callback;for(let i of this._targets)t(i,e);this._targets.length=0}}}class N4{start(){this.startInvoker.invoke(0)}update(e){this.updateInvoker.invoke(e)}lastUpdate(e){this.lastUpdateInvoker.invoke(e)}enableComponent(e,t){t?e.flags.OnEnableCalled||(e.flags.OnEnableCalled=!0,e.onEnable&&e.onEnable(),typeof e.start=="function"&&!e.flags.IsStartCalled&&(e.flags.IsStartCalled=!0,this.startInvoker.add(e)),typeof e.update=="function"&&this.updateInvoker.add(e),typeof e.lastUpdate=="function"&&this.lastUpdateInvoker.add(e)):e.flags.OnEnableCalled&&(e.flags.OnEnableCalled=!1,e.onDisable&&e.onDisable(),typeof e.start=="function"&&!e.flags.IsStartCalled&&this.startInvoker.remove(e),typeof e.update=="function"&&this.updateInvoker.remove(e),typeof e.lastUpdate=="function"&&this.lastUpdateInvoker.remove(e))}constructor(){this.startInvoker=new O4(e=>e.start()),this.updateInvoker=new vg((e,t)=>e.update(t)),this.lastUpdateInvoker=new vg((e,t)=>e.lastUpdate(t))}}var LS;(function(n){n[n.CheckOnly=0]="CheckOnly",n[n.AutoAdd=1]="AutoAdd"})(LS||(LS={}));class Zh{get viewer(){return this._viewer}get scheduler(){return this._scheduler}get componentScheduler(){return this._componentScheduler}destroy(){this._componentsMap.forEach(e=>e.forEach(t=>t.destroy())),this._componentsMap.clear()}update(e){this._scheduler.update(e),this._componentScheduler.start(),this._componentScheduler.update(e),this._componentScheduler.lastUpdate(e)}destroyComponents(e){let t=this._componentsMap.get(e);t&&(t.forEach(i=>i.destroy()),this._componentsMap.delete(e));for(let i of e.children)this.destroyComponents(i)}activeComponents(e){let t=this._componentsMap.get(e);t&&t.forEach(i=>this._activeComponent(i,e.visible));for(let i of e.children)this.activeComponents(i)}addComponent(e,t){let i=e instanceof sl?e.node:e,r=typeof t=="function",s=this._findComponent(i,r?t:t.constructor);if(s===void 0){s=r?new t:t,s.node=i,s.manager=this,s.viewer=this._viewer,this._addDendencies(i,s.constructor),s.flags.OnLoadCalled||(s.flags.OnLoadCalled=!0,s.onLoad&&s.onLoad());let a=this._componentsMap.get(i);a===void 0?this._componentsMap.set(i,[s]):a.push(s),this._activeComponent(s,s.enabled)}return s}removeComponent(e,t){let i=this._componentsMap.get(e);return i&&i.splice(i.indexOf(t),1),this}getComponent(e,t,i=!1){let r=this._findComponent(e,t);return r===void 0&&i&&(r=this.addComponent(e,t)),r}getComponentsInChidren(e,t,i=[]){let r=this._componentsMap.get(e);if(r){for(let s=r.length;s--;)r[s]instanceof t&&i.push(r[s]);for(let s of e.children)this.getComponentsInChidren(s,t,i)}return i}traverseComponents(e){this._componentsMap.forEach(t=>t.forEach(e))}_addDendencies(e,t){for(;t!==sl;){let i=Zh._dependenciesMap.get(t);if(i){const{components:r,mode:s}=i;for(const a of r)if(!this.getComponent(e,a))if(s===1)this.addComponent(e,a);else throw`Should add ${a.name} before adding ${t.name}`}t=Object.getPrototypeOf(t)}}_findComponent(e,t){let i=this._componentsMap.get(e);if(i)for(let r=i.length;r--;){let s=i[r];if(s instanceof t)return s}}_activeComponent(e,t){this._componentScheduler.enableComponent(e,t)}constructor(e){this._scheduler=new U4,this._componentScheduler=new N4,this._componentsMap=new Map,this._viewer=e}}Zh._dependenciesMap=new Map;class B4 extends G_{get percent(){return this._percent}destroy(){this._tasks.length=0,this._taskIndex=0,this._percent=0}add(e){this._tasks.push(e)}update(){let e=this._tasks[this._taskIndex];if(e){try{e.excute()}catch(t){console.error(t),this.onError&&this.onError(e)}this._percent=++this._taskIndex/this._tasks.length,this.onProgress&&this.onProgress(e,this._taskIndex,this._tasks.length),this._taskIndex===this._tasks.length&&(this._percent=1,this.onComplete&&this.onComplete())}}constructor(e,t,i){super(),this.onComplete=e,this.onProgress=t,this.onError=i,this._tasks=[],this._taskIndex=0,this._percent=0}}function z4(n,e){if(!((Mt.isChrome||Mt.isSafari||Mt.isEdge||Mt.isFirefox||Mt.isOpera)&&!Mt.isIE)||!(n instanceof HTMLCanvasElement))return null;let i=Object.assign({alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e);if(window.WebGL2RenderingContext)try{return{gl:n.getContext("webgl2",i),RENDER_TARGET_FLOAT_TYPE:gi,DATA_FLOAT_TYPE:Un}}catch{return null}else if(window.WebGLRenderingContext){const r=n.getContext("webgl",i)||n.getContext("webgl2",i)||n.getContext("experimental-webgl",i);return(r.getExtension("OES_texture_float")||r.getExtension("OES_texture_half_float"))&&r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?{gl:r,RENDER_TARGET_FLOAT_TYPE:Mt.isIOS||r.getExtension("OES_texture_half_float")?gi:Un,DATA_FLOAT_TYPE:Un}:this._floatPacking?{gl:r,RENDER_TARGET_FLOAT_TYPE:Bi,DATA_FLOAT_TYPE:Bi}:null}return null}var Lo;(function(n){n[n.AUTO=0]="AUTO",n[n.LANDSCAPE=1]="LANDSCAPE",n[n.PORTRAIT=2]="PORTRAIT"})(Lo||(Lo={}));class Wo{static extension(e){let t=e.split(".");return t.length>1?t.pop().toLowerCase():""}static dirname(e){let t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}static basename(e,t){let i=e.split("/").pop();return t?i.replace("."+t,""):i}static _splitTextureSettings(e){let t={};for(let i of Wo._texSettingKeys)e[i]!==void 0&&(i==="dataType"?t.type=e[i]:t[i]=e[i]);return t}destroy(){this._loaders.clear()}getLoader(e){return this._loaders.get(e)}addLoader(e){let t=new e(this);for(let i of t.extension)this._loaders.set(i,t)}loadAsset({url:e,buffer:t,ext:i,path:r,resourcePath:s,dracoPath:a,manager:l,onProgress:d,...h}){return new Promise((m,u)=>{const g=i||e&&Wo.extension(e)||"",v=Wo._splitTextureSettings(h);this._loaders.has(g)?this._loaders.get(g).load({url:e,buffer:t,texSettings:v,path:r,resourcePath:s,dracoPath:a,manager:l,onProgress:d,onLoad:m,onError:w=>{console.error(`${e} not exist`,w),u(w)}}):u("ResourceManager.loadAsset: missing loader for "+g)})}constructor(){this._loaders=new Map}}Wo._texSettingKeys=["flipY","mapping","wrapS","wrapT","dataType","magFilter","minFilter","format","anisotropy","repeat","colorSpace","channel"];function hd(n,e){for(let t in e){let i=e[t];if(i!==void 0&&n[t]!==void 0){let r=Object.getOwnPropertyDescriptor(n,t);if(!r||r.writable||r.set)n[t]=i;else{let s=n[t];s&&s.copy&&s.copy(i)}}}return n}class H4{get viewer(){return this._viewer}destroy(){this._plugins.forEach(e=>e.uninstall&&e.uninstall()),this._plugins.length=0,this._pluginsMap.clear()}update(e){this._plugins.forEach(t=>t.onUpdate&&t.onUpdate(e))}render(e){this._plugins.forEach(t=>t.onRender&&t.onRender(e))}traversePlugins(e){this._plugins.forEach(e)}getPlugin(e,t=!1){let i=this._pluginsMap.get(e);return i===void 0&&t&&(i=this.addPlugin(e)),i}addPlugin(e){const t=lT(e);return this._pluginsMap.has(t.constructor)||(t.viewer=this._viewer,t.install&&t.install(),this._plugins.push(t),this._pluginsMap.set(t.constructor,t),Ii._applyClassProperties(t.type,t.constructor)),t}removePlugin(e){const t=typeof e=="function"?e:e.constructor,i=this._pluginsMap.get(t);i&&(i.uninstall&&i.uninstall(),this._plugins.splice(this._plugins.indexOf(i),1),this._pluginsMap.delete(t))}constructor(e){this._plugins=[],this._pluginsMap=new Map,this._viewer=e}}class kt extends G_{static _setDirectLightShadow(e,t){const i=e.camera;for(let r=0;r6&&(e.bias=t[6]),t.length>8&&e.mapSize.set(t[7],t[8]),e}static compileMaterial(e,t,i,r){kt.fullscreenMesh.material=r,e.compile(kt.fullscreenMesh,i,t)}static compileObject3D(e,t,i,r){e.compile(r,i,t)}static compileTexture(e,t){if(Array.isArray(t))for(let i of t)e.initTexture(i);else e.initTexture(t)}static Blit(e,t,i,r,s){kt.fullscreenMesh.material=i;const a=e.getRenderTarget();e.setRenderTarget(t,s,r),e.render(kt.fullscreenMesh,kt.fullscreenCamera),e.setRenderTarget(a)}static createFullscreenTriangle(){let e=new On;return e.setAttribute("position",new nn([-1,3,0,-1,-1,0,3,-1,0],3)),e.setAttribute("uv",new nn([0,2,0,0,2,0],2)),e}static findChild(e,t){let i=null,r=t.split("/"),s=e.children;for(let a of r)if(i=s.find(l=>l.name===a),i)s=i.children;else return null;return i}static getChildByName(e,t){return kt.getObject(e,i=>i.name===t&&i)}static getObject(e,t,i=!1){const r=[e],s=[];for(;r.length!==0;){let a=r.shift();if(t(a)&&(s.push(a),!i))break;a.children.forEach(d=>r.push(d))}return i?s:s[0]}static _getObjectValue(e,t,i=!1){return t?i?Object.values(e||kt.__emtpyObject).filter(r=>r.name===t):Object.values(e||kt.__emtpyObject).find(r=>r.name===t):Object.values(e)}static getMaterial(e,t,i=!1){return kt._getObjectValue(e.userData.materials,t,i)}static getTexture(e,t,i=!1){return kt._getObjectValue(e.userData.textures,t,i)}static getMesh(e,t,i=!1){return kt._getObjectValue(e.userData.meshes,t,i)}get root(){return this._root}get time(){return this._time}get scene(){return this._scene}get camera(){return this._camera}get renderer(){return this._renderer}get canvas(){return this._canvas}get gl(){return this._gl}get RENDER_TARGET_FLOAT_TYPE(){return this._RENDER_TARGET_FLOAT_TYPE}get DATA_FLOAT_TYPE(){return this._DATA_FLOAT_TYPE}get dpr(){return this._dpr}get width(){return this._width}get height(){return this._height}get viewport(){return this._viewport}get rootRotated(){return this._rootRotated}get input(){return this._input}get targetFrameRate(){return this._targetFrameRate}set targetFrameRate(e){this._targetFrameRate=Math.max(.001,e)}get instanceId(){return this._instanceId}get loadingManager(){return this._loadingManager}get resourceManager(){return this._resourceManager}get taskManager(){return this._taskManager}destroy(){this.stop(),this._renderer.dispose(),this._taskManager.destroy(),this._resourceManager.destroy(),this._componentManager.destroy(),this._pluginManager.destroy(),this._tweenManager.destroy(),this._input.removeAllListeners()}_addDefaultLoaders(){this.addLoader(d4),this.addLoader(h4),this.addLoader(p4),this.addLoader(f4)}_frame(e){if(this._time=e,this._targetFrameRate>-1){const t=1/this._targetFrameRate,i=this._time-this._lastFrameTime;i>=t&&(this.loop(this._fixedFrameTime?t:this._time-this._lastTime),this._lastTime=this._time,this._lastFrameTime=this._time-i%t)}else this.loop(this._time-this._lastTime),this._lastTime=this._time}loop(e){this._autoResize&&this.resize(),e=Math.min(e,.067),this.update(e),this.render(e)}update(e){this._taskManager.update(),this._tweenManager.update(this._time),this._componentManager.update(e),this._pluginManager.update(e)}render(e){this._renderer.info.reset(),this._onRender(e),this._pluginManager.render(e)}_onRender(e){this._renderer.render(this._scene,this._camera)}_onResize(e,t){this._renderer.setSize(e,t)}start(){if(this._running==!1){this._running=!0;const e=t=>{this._running&&this._frame(t*.001)};this._renderer.setAnimationLoop(e)}return this}stop(){return this._running=!1,this._time=this._lastTime=0,this}resize(e=window.innerWidth,t=window.innerHeight){if(this._rootRotated=this._orientation===Lo.LANDSCAPE?et:!1,this._rootRotated){let i=e;e=t,t=i}if(this._width!==e||this._height!==t){this._width=e,this._height=t;let i=this._root;this._rootRotated?(i.style["-webkit-transform"]="rotate(90deg)",i.style.transform="rotate(90deg)",i.style["-webkit-transform-origin"]="0px 0px 0px",i.style.transformOrigin="0px 0px 0px",i.style.margin=`0 0 0 ${t}px`,i.style.width=`${e}px`,i.style.height=`${t}px`):(i.style["-webkit-transform"]="rotate(0deg)",i.style.transform="rotate(0deg)",i.style.margin="0px auto",i.style.width=`${e}px`,i.style.height=`${t}px`);let r=this._camera;if(r.isOrthographicCamera)this._viewport={width:e/r.zoom,height:t/r.zoom,factor:1};else if(r.isPerspectiveCamera){r.manual||(r.aspect=e/t,r.updateProjectionMatrix());let s=r.getWorldPosition(kt.__worldPos).distanceTo(kt.__target),a=2*Math.tan(bn.degToRad(r.fov*.5))*s,l=a*e/t;this._viewport={width:l,height:a,factor:e/l}}this._onResize(e,t),this.emit(mt.RESIZE,e,t)}}loadAsset(e){return this._resourceManager.loadAsset(Object.assign(Object.assign({},this._defaultProps),e))}getLoader(e){return this._resourceManager.getLoader(e)}addLoader(e){this._resourceManager.addLoader(e)}timeline(e){return this._tweenManager.timeline(e)}killTweensOf(e){this._tweenManager.killTweensOf(e)}traverseMaterials(e){kt.getObject(this._scene,t=>{t.material&&(Array.isArray(t.material)?t.material.forEach(e):e(t.material))},!0)}traversePlugins(e){return this._pluginManager.traversePlugins(e)}getPlugin(e,t){return this._pluginManager.getPlugin(e,t)}addPlugin(e,t){const i=this._pluginManager.addPlugin(e);return hd(i,t),i}removePlugin(e){this._pluginManager.removePlugin(e)}getComponent(e,t,i){return this._componentManager.getComponent(e,t,i)}traverseComponents(e){return this._componentManager.traverseComponents(e)}addComponent(e,t){return this._componentManager.addComponent(e,t)}removeComponent(e,t){return this._componentManager.removeComponent(e,t)}addTask(e){this._taskManager.add(e)}addNode(e,{args:t,debug:i,scale:r,position:s,rotation:a,layer:l,shadowArgs:d,makeDefault:h,component:m,parent:u=this._scene,...g}={}){let v=null,w=lT(e,t);if(w.isObject3D)v=w,u.add(w);else if(w instanceof sl)v=w.node||new sn,u.add(v),this._componentManager.addComponent(v,w);else throw Error("Viewer.addNode: unsuport object");if(m){const T=Array.isArray(m)?m:[m];for(let M of T)this._componentManager.addComponent(v,M)}return l&&(v.layers.mask=l),(r||s||a)&&hd(v,{scale:r,position:s,rotation:a}),g&&hd(w,g),w.isCamera&&h&&(w.manual=w.aspect!==this._camera.aspect,this._camera=w),d&&v.isDirectionalLight&&kt._setDirectLightShadow(v.shadow,d),w}removeNode(e){this._componentManager.destroyComponents(e),e.removeFromParent()}activeNode(e,t){return this._componentManager.activeComponents(e),e.visible=t,e}createRenderTarget(e,t,i=!1,r=!1,s=0,a=!1,l=!1){return new Zs(e,t,{wrapS:ti,wrapT:ti,magFilter:i?Fn:ln,minFilter:i?Fn:a?nw:ln,type:typeof r=="boolean"?r?this.DATA_FLOAT_TYPE:Bi:r,anisotropy:0,colorSpace:Sn,depthBuffer:l,stencilBuffer:!1,samples:Mt.isSupportMSAA?s:0,generateMipmaps:a})}createCubeRenderTarget(e,t=!1,i=!1,r=0,s=!1,a=!1){return new LE(e,{wrapS:ti,wrapT:ti,magFilter:t?Fn:ln,minFilter:t?Fn:s?nw:ln,type:typeof i=="boolean"?i?this.DATA_FLOAT_TYPE:Bi:i,anisotropy:0,colorSpace:Sn,depthBuffer:a,stencilBuffer:!1,samples:Mt.isSupportMSAA?r:0,generateMipmaps:s})}createDataTexture(e,t,i,r=!1,s=!0){return new $c(e,t,i,Vn,r?Un:Bi,__,ti,ti,s?Fn:ln,s?Fn:ln,0)}portal(e){const t=this._scene,i=this._camera;this._scene=new kc;const r=e();return this._scene=t,this._camera=i,r}blit(e,t,i,r){kt.Blit(this._renderer,e,t,i,r)}compile(e){if(Array.isArray(e))if(e.every(t=>t.isMaterial))kt.compileMaterial(this._renderer,this._scene,this._camera,e);else throw Error("Viewer.compile: unsuport material");else typeof e=="object"?e.isMaterial?kt.compileMaterial(this._renderer,this._scene,this._camera,e):e.isObject3D?(e.meshData.materials&&kt.compileMaterial(this._renderer,this._scene,this._camera,Object.values(e.meshData.materials)),e.meshData.textures&&kt.compileTexture(this._renderer,Object.values(e.meshData.textures)),e.meshData.meshes||kt.compileObject3D(this._renderer,this._scene,this._camera,e)):e.isTexture&&kt.compileTexture(this._renderer,e):kt.compileObject3D(this._renderer,this._scene,this._camera,this._scene)}constructor({root:e,canvas:t,autoStart:i=!0,autoResize:r=!0,shadows:s=!1,camera:a={fov:45,near:.1,far:1e3,position:new j(0,0,4)},targetFrameRate:l=-1,fixedFrameTime:d=!1,colorSpace:h=on,toneMapping:m=lE,toneMappingExposure:u=1,maxDPR:g=1.5,path:v="",resourcePath:w="",dracoPath:T="https://www.gstatic.com/draco/v1/decoders/",orientation:M=Lo.AUTO,loader:b={},tasker:A={},...E}={}){super(),this._instanceId=kt._instanceCount++,this._dpr=1,this._width=1,this._height=1,this._viewport={width:1,height:1,factor:1},this._orientation=Lo.AUTO,this._defaultProps={},this._running=!1,this._rootRotated=!1,this._time=0,this._lastTime=0,this._lastFrameTime=0,this._targetFrameRate=-1,this._fixedFrameTime=!1,this._autoResize=!0;const P=t||document.getElementById("canvas"),G=z4(P,E);if(!G)throw Error("Unsupport WebGL in current platform");this._root=e||P,this._canvas=P,this._gl=G.gl,this._RENDER_TARGET_FLOAT_TYPE=G.RENDER_TARGET_FLOAT_TYPE,this._DATA_FLOAT_TYPE=G.DATA_FLOAT_TYPE,this._dpr=Math.min(g,window.devicePixelRatio),this._orientation=M,this._scene=new kc,this._camera=hd(new mi,a),this._renderer=new WO({canvas:P,context:G.gl}),this._renderer.setPixelRatio(this._dpr),this._renderer.outputColorSpace=h,this._renderer.toneMapping=m,this._renderer.toneMappingExposure=u,this._renderer.shadowMap.enabled=!!s,this._renderer.shadowMap.type=typeof s=="boolean"?oE:s,this._renderer.info.autoReset=!1,this._resourceManager=new Wo,this._loadingManager=new jE(b.onLoad,b.onProgress,b.onError),this._taskManager=new B4(A.onComplete,A.onProgress,A.onError),this._componentManager=new Zh(this),this._pluginManager=new H4(this),this._tweenManager=new l4,this._defaultProps={path:v,resourcePath:w,dracoPath:T,manager:this._loadingManager},this._autoResize=r,this._targetFrameRate=l,this._input=new mt(this),this._input.addEventListeners(),this._addDefaultLoaders(),i&&this.start(),this.resize()}}kt.__target=new j;kt.__worldPos=new j;kt._shadowCameraKeys=["top","bottom","left","right","near","far"];kt.__emtpyObject={};kt.fullscreenMesh=new wn(kt.createFullscreenTriangle());kt.fullscreenCamera=new dl(-1,1,1,-1,0,1);kt._instanceCount=0;class G4{get envMapTarget(){return this._envMapTarget}dispose(){this._sourceTarget.dispose(),this._envMapTarget.dispose(),this._pmremGenerator.dispose()}mergeReflect(e){this._pmremGenerator._copyTexture(this._envMapTarget,this._sourceTarget.texture,e.envMapIntensity),this._pmremGenerator._mergeReflect(this._envMapTarget,this._reflectMap,e.quality),e.envMapTarget=this._envMapTarget,e.lodMax=this._pmremGenerator._lodMeshes.length-1}_getPMREMExtension(e){const t=new gh(e);return t._fromTextureExtension=function(i,r){const s=r?this._fromTexture(r):this._fromCubeTexture(i);return this._cubeMapMaterial=L4(),this._copyTexMaterial=P4(),this._copyMesh=new wn(kt.fullscreenMesh.geometry,this._copyTexMaterial),this._lodMeshes=this._lodPlanes.map(a=>new wn(a,this._cubeMapMaterial)),this._sourceInit=!1,s},t._fromCubeTexture=function(i){return this._setSize(i.image.length===0?16:i.image[0].width||i.image[0].image.width),this._allocateTargets()},t._copyTexture=function(i,r,s=1){const a=this._copyTexMaterial.uniforms;a.map.value=r,a.intensity.value=s,i.scissorTest=!1,Vo(i,0,0,i.width,i.height);const l=this._renderer;l.autoClear=!0,l.setRenderTarget(i),l.render(this._copyMesh,_g),l.setRenderTarget(null)},t._clearTexture=function(i,r){this._copyTexture(i,this._sourceTarget.texture,r)},t._mergeReflect=function(i,r,s){const a=this._renderer,l=a.autoClear,d=this._cubeMapMaterial,h=this._cubeMapMaterial.uniforms;if(h.envMap.value=r,a.autoClear=!1,s===us.HIGH)for(let m=0;ml-xh?r-l+xh:0),m=4*(this._cubeSize-d);Vo(i,h,m,3*d,2*d);const u=this._lodMeshes[r];u.material=s,a.autoClear=!1,a.setRenderTarget(i),a.render(u,_g)},t}constructor({envMap:e,reflectMap:t,viewer:i}){this._reflectMap=t,this._pmremGenerator=this._getPMREMExtension(i.renderer),this._envMapTarget=this._pmremGenerator._fromTextureExtension(t,e),this._sourceTarget=this._envMapTarget.clone(),this._pmremGenerator._copyTexture(this._sourceTarget,this._envMapTarget.texture),i.scene.environment=this._envMapTarget.texture}}function IS(n,e){let t=n*n,i=2*Math.PI*t,r=Math.pow(16,e)*1.386294361,s=i*(Math.pow(4,e)+i);return bn.clamp(r/s,0,1)}const DS=10;class V4{get envMapTarget(){return this._envMapTarget}dispose(){this._envMapTarget.dispose(),this._pmremGenerator.dispose()}mergeMipBlur(e){this._setBlurIntensity(e.blurIntensity);const t=this._pmremGenerator._applyMipBlur(this._envMapTarget,this._reflectMap,this._blurMinLod,this._blurMaxLod,this._sigma,e.exposure);this._pmremGenerator._mipCopy(e.envMapTarget,t,e.lodMax,this._blurMinLod)}_setBlurIntensity(e){if(this._blurIntensity!==e){this._blurIntensity=e,this._sigma=bn.lerp(1,40,this._blurIntensity/10);for(let t=0;t<=DS;t++){let i=IS(this._sigma,t);if(i<.002&&(this._blurMinLod=t),i>=1){this._blurMaxLod=t;break}}}}_getPMREMExtension(e){const t=new gh(e);return t._fromTextureExtension=function(i){this._setSize(i.image.length===0?16:i.image[0].width||i.image[0].image.width);const r=this._allocateTargets();return this._mipBlurMaterial=D4(this._lodMax,r.width,r.height),this._mipCopyMaterial=I4(this._lodMax,r.width,r.height),this._lodMeshes=this._lodPlanes.map(s=>new wn(s,this._mipBlurMaterial)),r},t._applyMipBlur=function(i,r,s,a,l,d=1){const h=this._pingPongRenderTarget,m=this._mipBlurMaterial.uniforms;m.envMap.value=r,m.exposure.value=d;let u=a,g=i,v=h;this._mipBlur(i,h,u,1);for(let w=0;u-- >s;w++)g=w&1?i:h,v=(w&1)===1?h:i,this._mipBlur(g,v,u,IS(l,u));return i.scissorTest=!1,Vo(i,0,0,i.width,i.height),g},t._mipBlur=function(i,r,s,a){const l=this._mipBlurMaterial.uniforms;l.cubeUVMap.value=r.texture,l.weight.value=a,l.lod.value=s,this._blit(i,s,this._mipBlurMaterial)},t._mipCopy=function(i,r,s,a=s){const l=this._mipCopyMaterial.uniforms;l.cubeUVMap.value=r.texture,l.lod.value=a,this._blit(i,s,this._mipCopyMaterial),i.scissorTest=!1,Vo(i,0,0,i.width,i.height)},t._blit=function(i,r,s){const a=this._renderer,l=this._lodMax,d=this._sizeLods[r],h=3*d*(r>l-xh?r-l+xh:0),m=4*(this._cubeSize-d);Vo(i,h,m,3*d,2*d);const u=this._lodMeshes[r];u.material=s,a.autoClear=!1,a.setRenderTarget(i),a.render(u,_g)},t}constructor({viewer:e,reflectMap:t}){this._sigma=2,this._blurMinLod=0,this._blurMaxLod=DS,this._blurIntensity=-1,this._reflectMap=t,this._pmremGenerator=this._getPMREMExtension(e.renderer),this._envMapTarget=this._pmremGenerator._fromTextureExtension(t)}}class ia extends X_{get debug(){return this._debug}set debug(e){if(this._debug!==e){if(this._debug=e,e&&this._debugNode===null){const t=this.viewer,i=Nc.Instance(t).scene;this._debugNode=t.addNode(sn,{parent:i}),t.addNode(RS,{parent:this._debugNode,material:new Or({map:this._reflectPass.envMapTarget.texture}),position:new j(1.1,3,0)}),this._mipBlurPass&&t.addNode(RS,{parent:this._debugNode,material:new Or({map:this._mipBlurPass.envMapTarget.texture}),position:new j(0,3,0)})}this._debugNode&&(this._debugNode.visible=e)}}onRender(e){this.manual||((this._elapsed>=this.interval||this._elapsed===0)&&(this._elapsed=0,this._renderFrame()),this._elapsed+=e)}manualFrame(){this.manual&&this._renderFrame()}_renderFrame(){const{renderer:e}=this.viewer,t=e.autoClear,i=e.getRenderTarget(),r=e.getActiveCubeFace(),s=e.getActiveMipmapLevel();e.autoClear=!0,this._mergeInfo.quality=this.quality,this._mergeInfo.exposure=this.reflectExposure,this._mergeInfo.envMapIntensity=this.envMapIntensity,this._mergeInfo.blurIntensity=this.reflectBlurIntensity,this.quality!==us.LOW&&this._cubeCamera.update(e,this._scene),this._reflectPass.mergeReflect(this._mergeInfo),this.quality===us.HIGH&&(this._mipBlurPass===void 0&&(this._mipBlurPass=new V4({viewer:this.viewer,reflectMap:this._cubeCamera.renderTarget.texture})),this._mipBlurPass.mergeMipBlur(this._mergeInfo)),e.autoClear=t,e.setRenderTarget(i,r,s)}constructor({envMap:e,scene:t,near:i,far:r,layer:s=0,resolution:a=256,floatType:l=gi,position:d=new j(0,1,0)}={}){super(),this._mergeInfo={quality:us.HIGH,envMapTarget:null,envMapIntensity:1,blurIntensity:1,lodMax:0,exposure:1},this._debug=!1,this._debugNode=null,this._elapsed=0,this.quality=us.HIGH,this.envMapIntensity=1,this.reflectExposure=1,this.reflectBlurIntensity=5,this.interval=0,this.manual=!1,this.install=()=>{const h=this.viewer;this._scene=t||h.scene;const m=h.createCubeRenderTarget(a,!1,l,0,!0,!0);this._cubeCamera=new RE(i||h.camera.near,r||h.camera.far,m),this._cubeCamera.position.copy(d),this._cubeCamera.layers.mask=s;const u=m.texture;this._reflectPass=new G4({viewer:h,reflectMap:u,envMap:e})},this.uninstall=()=>{this._reflectPass.dispose(),this._mipBlurPass&&this._mipBlurPass.dispose()}}}ia.Quality=us;Et([rt],ia.prototype,"debug",null);Et([rt({value:us})],ia.prototype,"quality",void 0);Et([rt({min:0,max:1,step:.01})],ia.prototype,"envMapIntensity",void 0);Et([rt({min:0,max:10,step:.01})],ia.prototype,"reflectExposure",void 0);Et([rt({min:0,max:10,step:.1})],ia.prototype,"reflectBlurIntensity",void 0);Et([rt],ia.prototype,"interval",void 0);Et([rt],ia.prototype,"manual",void 0);class Qh extends X_{get debug(){return this._debug}set debug(e){this._debug!==e&&(this._debug=e,e&&this._helper===null&&(this._helper=new VN(new Pr(this._boxMin,this._boxMax)),Nc.Instance(this.viewer).add(this._helper)),this._helper&&(this._helper.visible=e))}get center(){return this._center}set center(e){this._center.copy(e)}get boxMin(){return this._boxMin}set boxMin(e){this._boxMin.copy(e)}get boxMax(){return this._boxMax}set boxMax(e){this._boxMax.copy(e)}onUpdate(e){this._debug&&this._helper.updateMatrixWorld()}useBoxProjection(e){e.defines.USE_BOX_PROJECTION=!0,e.uniforms.probePos={value:this._center},e.uniforms.probeBoxMin={value:this._boxMin},e.uniforms.probeBoxMax={value:this._boxMax}}constructor(){super(),this._center=new $t(0,.5,0,1),this._boxMin=new j(0,0,0),this._boxMax=new j(1,1,1),this._helper=null,this._debug=!1,this.install=()=>{ki.physical.vertexShader=ki.physical.vertexShader.replace(/#ifdef USE_TRANSMISSION/g,` + #if defined(USE_TRANSMISSION) || defined(USE_BOX_PROJECTION) + `),ki.physical.fragmentShader=ki.physical.fragmentShader.replace("varying vec3 vViewPosition;",` + varying vec3 vViewPosition; + #if defined(USE_BOX_PROJECTION) + varying vec3 vWorldPosition; + #endif + `),xt.worldpos_vertex=xt.worldpos_vertex.replace("#if defined( USE_ENVMAP )","#if defined( USE_ENVMAP ) || defined( USE_BOX_PROJECTION )"),xt.envmap_physical_pars_fragment=xt.envmap_physical_pars_fragment.replace("#ifdef USE_ENVMAP",` + #ifdef USE_ENVMAP + + #if defined(USE_BOX_PROJECTION) + uniform vec4 probePos; + uniform vec3 probeBoxMin; + uniform vec3 probeBoxMax; + + vec3 boxProjection(vec3 nrdir, vec3 worldPos, vec3 probePos, vec3 boxMin, vec3 boxMax) { + vec3 tbot = boxMin - worldPos; + vec3 ttop = boxMax - worldPos; + vec3 tmax = mix(tbot, ttop, step(vec3(0), nrdir)); + tmax /= nrdir; + float t = min(min(tmax.x, tmax.y), tmax.z); + return worldPos + nrdir * t - probePos; + } + #endif + + `).replace("reflectVec = inverseTransformDirection( reflectVec, viewMatrix );",` + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + + #if defined(USE_BOX_PROJECTION) + if (probePos.w > 0.001) { + reflectVec = boxProjection(reflectVec, vWorldPosition, probePos.xyz, probeBoxMin.xyz, probeBoxMax.xyz); + } + #endif + + `).replace("vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );",` + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + #if defined(USE_BOX_PROJECTION) + if (probePos.w > 0.001) { + worldNormal = boxProjection(worldNormal, vWorldPosition, probePos.xyz, probeBoxMin.xyz, probeBoxMax.xyz); + } + #endif + + `)},this.uninstall=()=>{Nc.Instance(this.viewer).remove(this._helper)}}}Et([rt],Qh.prototype,"debug",null);Et([rt],Qh.prototype,"center",null);Et([rt],Qh.prototype,"boxMin",null);Et([rt],Qh.prototype,"boxMax",null);class W4 extends Nn{constructor(){super(...arguments);Ve(this,"extension",["bin"]);Ve(this,"_loader");Ve(this,"_dracoLoader")}load({url:t,buffer:i,path:r,resourcePath:s,dracoPath:a,manager:l,onLoad:d,onProgress:h,onError:m}){let u=this._dracoLoader;u===void 0&&(u=this._dracoLoader=new z_),u.manager=l,u.setDecoderPath(a);let g=this._loader;g===void 0&&(g=this._loader=new $4,g.setDRACOLoader(u),g.setMeshoptDecoder(H_)),g.manager=l,g.setPath(r),g.setResourcePath(s);const v=w=>{const T=w.scene;T.animations.push(...w.animations),d(Nn._setUserData(T))};i?g.parse(i,s,v,m):g.load(t,v,h,m)}}const j4=255,X4="glTF",fd=12;function kS(n,e){for(let t=0,i=n.length;t(xa.resource.set(i,s),s))}static getRes(e){const t=e.split("?")[0];return xa.resource.get(t)}static clear(){xa.resource.clear()}static setRes(e,t){xa.resource.set(e,t)}};Ve(xa,"resource",new Map);let wh=xa;const Z4=wh.clear,ho=wh.loadAsset;class Q4{constructor(e){Ve(this,"flags",{});this.viewer=e}}var J4=Object.defineProperty,ez=Object.getOwnPropertyDescriptor,Mn=(n,e,t,i)=>{for(var r=i>1?void 0:i?ez(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&J4(e,t,r),r};const{clamp:hc,degToRad:tz}=bn,{abs:nz,tan:iz,PI:rz}=Math,pd=rz*2,kp=.001;function Vl(n,e,t,i,r=.001){if(i<=0)return e;let s=e-n;if(s>0){const a=(s+r)*hc(i*t,0,1);return a>s?e:n+a}else if(s<0){const a=(s-r)*hc(i*t,0,1);return a0&&this._dollyOut(this._getZoomScale(t.deltaY))}_customWheelEvent(t){const i=t.deltaMode,r={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(i){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return t.ctrlKey&&(r.deltaY*=10),r}_onTouchStart(t){if(!Mt.isMobile)return;let i=t.touches;i.length>1?(this._preLoc0.set(i[0].pageX,i[0].pageY),this._preLoc1.set(i[1].pageX,i[1].pageY)):i.length>0&&(this._touchID=i[0].identifier,this._preLoc0.set(i[0].pageX,i[0].pageY))}_onTouchMove(t){if(!Mt.isMobile)return;const{__loc0:i,__loc1:r,__panDelta:s,__rotateDelta:a,__preCenter:l,__center:d}=Hn;let h=t.touches;h.length>1?(i.set(h[0].pageX,h[0].pageY),r.set(h[1].pageX,h[1].pageY),this.lookAt&&(this._targetSpringLength*=this._calculateDistanceScale(this._preLoc0.distanceTo(this._preLoc1)/i.distanceTo(r))),l.copy(this._preLoc0).add(this._preLoc1).multiplyScalar(.5),d.copy(i).add(r).multiplyScalar(.5),this._calculatePanDelta(s,l,d),this._calculateTargetLookAt(s),this._calculateTargetSpringArm(),this._preLoc0.copy(i),this._preLoc1.copy(r)):h.length>0&&this._touchID===h[0].identifier&&(i.set(h[0].pageX,h[0].pageY),this._calculateRotatelDelta(a,this._preLoc0,i),this._calculateTargetSpringArm(a),this._preLoc0.copy(i))}_calculateDistanceScale(t){return this._tempRotateSmoothing=this.rotateSmoothing,this.forbidZ&&(t=1),t}_calculateAutoRotate(){const{__rotateDelta:t}=Hn;t.y=0,t.x=this._autoRotate,this._calculateTargetSpringArm(t),this._handlerId=requestAnimationFrame(this._calculateAutoRotate.bind(this))}_calculateRotatelDelta(t,i,r){this._tempRotateSmoothing=this.rotateSmoothing;const s=this.viewer.canvas;return t.copy(r).sub(i).multiplyScalar(this.rotateSpeed*2*Math.PI/s.clientHeight),t.y=-t.y,this.forbidX&&(t.x=0),this.forbidY&&(t.y=0),t}_calculatePanDelta(t,i,r){this._tempRotateSmoothing=this.rotateSmoothing;const s=this.viewer.canvas;return t.copy(r).sub(i).multiplyScalar(this.panSpeed/s.clientHeight),this.forbidPanX&&(t.x=0),this.forbidPanY&&(t.y=0),t}_calculateTargetLookAt(t){const{__xAxis:i,__yAxis:r,__posDelta:s}=Hn;i.setFromMatrixColumn(this.node.matrix,0),r.setFromMatrixColumn(this.node.matrix,1),this.forbitPanOffsetY&&(r.y=0,r.normalize()),s.copy(this.node.position).sub(this.lookAt);const a=s.length()*2*iz(tz(this.fov*.5));this._targetLookAt.sub(i.multiplyScalar(t.x*a)).add(r.multiplyScalar(t.y*a))}_calculateTargetSpringArm(t,i){t&&(this._targetTheta-=t.x,this._targetPhi+=t.y),i&&(this._targetSpringLength=i),this._targetTheta=hc(this._targetTheta,this.thetaMin,this.thetaMax),this._targetPhi=hc(this._targetPhi,this.phiMin,this.phiMax),this._targetSpringLength=hc(this._targetSpringLength,this.distanceMin,this.distanceMax)}gotoPOI({springLength:t=this._targetSpringLength,theta:i=this._targetTheta,phi:r=this._targetPhi,lookAt:s=this._lookAt,fov:a=this.lens.fov,smoothing:l=this.smoothing,rotateSmoothing:d=l}){this._targetFov=a,this._tempSmoothing=l,this._tempRotateSmoothing=d,this._targetLookAt.copy(s);const h=i%pd,m=this._spherical.theta=this._spherical.theta%pd,u=[h,h-pd,h+pd],g=u.map(w=>nz(m-w)),v=Math.min(...g);this._targetTheta=u[g.findIndex(w=>w===v)],this._targetSpringLength=t,this._targetPhi=r,this._calculateTargetSpringArm()}update(t){const i=this._tempSmoothing,r=this._tempRotateSmoothing;if(this._autoRotate&&this._spherical.theta===this._targetTheta){this._targetTheta-=this._autoRotate,this._targetTheta<-Math.PI?this._targetTheta+=2*Math.PI:this._targetTheta>Math.PI&&(this._targetTheta-=2*Math.PI),this._spherical.theta=Vl(this._spherical.theta,this._targetTheta,t,0),this.node.position.setFromSpherical(this._spherical).add(this._lookAt);return}this._spherical.theta=Vl(this._spherical.theta,this._targetTheta,t,r),this._spherical.phi=Vl(this._spherical.phi,this._targetPhi,t,r),this._spherical.radius=Vl(this._spherical.radius,this._targetSpringLength,t,i,.01),this.lens.fov=Vl(this.lens.fov,this._targetFov,t,i),pT(this._lookAt,this._targetLookAt,t,i),this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}},Ve(Hn,"__loc0",new et),Ve(Hn,"__loc1",new et),Ve(Hn,"__center",new et),Ve(Hn,"__preCenter",new et),Ve(Hn,"__panDelta",new et),Ve(Hn,"__panTarget",new et),Ve(Hn,"__rotateDelta",new et),Ve(Hn,"__posDelta",new j),Ve(Hn,"__xAxis",new j),Ve(Hn,"__yAxis",new j),Ve(Hn,"__quat",new Gn),Hn);Mn([rt()],vn.prototype,"autoRotate",1);Mn([rt({dir:"set"})],vn.prototype,"forbidX",2);Mn([rt({dir:"set"})],vn.prototype,"forbidY",2);Mn([rt({dir:"set"})],vn.prototype,"forbidZ",2);Mn([rt({dir:"set"})],vn.prototype,"forbidPanX",2);Mn([rt({dir:"set"})],vn.prototype,"forbidPanY",2);Mn([rt({dir:"set"})],vn.prototype,"forbitPanOffsetY",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"panSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"rotateSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"scaleSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"smoothing",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"rotateSmoothing",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"phiMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"phiMax",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"thetaMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"thetaMax",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"distanceMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"distanceMax",2);Mn([rt({dir:"set"})],vn.prototype,"dom",2);Mn([rt({step:.01})],vn.prototype,"lookAt",1);Mn([rt({step:.01})],vn.prototype,"springLength",1);Mn([rt({step:.01})],vn.prototype,"theta",1);Mn([rt({step:.01})],vn.prototype,"phi",1);Mn([rt],vn.prototype,"fov",1);let sz=vn;function mT(n,e){n.uniforms.uEdge=e,n.vertexShader=n.vertexShader.replace("void main() {",` + attribute vec3 center; + attribute vec2 edgeUv; + varying vec2 vEdgeUv; + + void main() { + vEdgeUv = edgeUv; + `),n.fragmentShader=n.fragmentShader.replace("void main() {",` + uniform float uEdge; + varying vec3 vCenter; + varying vec2 vEdgeUv; + + float smoothedge(float v) { + float th = 0.03; + float w = fwidth(v) * 0.5; + return (1. - smoothstep(th - w, th + w, v)) + smoothstep(1. - th - w, 1. - th + w, v); + } + + void main() { + `).replace("#include ",` + + float edge = smoothedge(vEdgeUv.x) + smoothedge(vEdgeUv.y); + outgoingLight = mix(outgoingLight, outgoingLight * vec3(0.3), edge * uEdge); + + #include + `)}function FS(n,e){xt.normal_fragment_begin.indexOf("USE_FLAT")===-1&&(xt.normal_fragment_begin=xt.normal_fragment_begin.replace("vec3 normal = normalize( vNormal );",` +#ifdef USE_FLAT + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 flatNormal = normalize( cross( fdx, fdy ) ); + vec3 normal = mix(normalize( vNormal ), flatNormal, uFlat); +#else + vec3 normal = normalize( vNormal ); +#endif + `)),n.uniforms.uFlat=e,n.fragmentShader=n.fragmentShader.replace("void main() {",` + #define USE_FLAT + uniform float uFlat; + + void main() { + `)}const Fp={renderMode:"Geometry",loaded:!1,ModelAssets:{model:"",texture_diffuse:"",texture_normal:"",texture_pbr:"",shaded:""}};class az{constructor(){Ve(this,"_changed",0);Ve(this,"_events",new G_);Ve(this,"states",new Proxy(Fp,{get:(e,t)=>e[t],set:(e,t,i)=>(e[t]!==i&&(e[t]=i,this._changed++,this._events.emit("CHANGED",this._changed,t,i)),!0)}))}onChanged(e){this._events.on("CHANGED",(t,i,r)=>{e(i,r)})}addModel(e){this._events.emit("addModel",e)}onAddModel(e){this._events.on("addModel",e)}offAddModel(e){this._events.off("addModel",e)}syncCameraPosition(e){this._events.emit("syncCameraPosition",e)}onSyncCameraPosition(e){this._events.on("syncCameraPosition",e)}offSyncCameraPosition(e){this._events.off("syncCameraPosition",e)}tracerToWebGLCameraPosition(e){this._events.emit("tracerToWebGLCameraPosition",e)}onTracerToWebGLCameraPosition(e){this._events.on("tracerToWebGLCameraPosition",e)}offTracerToWebGLCameraPosition(e){this._events.off("tracerToWebGLCameraPosition",e)}loading(e){this._events.emit("loading",e)}onLoading(e){this._events.on("loading",e)}offLoading(e){this._events.off("loading",e)}init(){this._changed++;for(let e in Fp)this._events.emit("CHANGED",this._changed,e,Fp[e])}destroy(){this._events.clear()}}const oz=function(){const[n,e]=Xn.useState(0);return Xn.useEffect(()=>(Nd._events.on("CHANGED",e),()=>{Nd._events.off("CHANGED",e)}),[]),Nd},Nd=new az,rr=[Nd],lz=[oz];class cz{constructor(e,t={}){this.enabled=!0;const i=t.defaultThickness!==void 0?t.defaultThickness:.003,r=new Je().fromArray(t.defaultColor!==void 0?t.defaultColor:[0,0,0]),s=t.defaultAlpha!==void 0?t.defaultAlpha:1,a=t.defaultKeepAlive!==void 0?t.defaultKeepAlive:!1,l={},d=60,h={},m={},u={outlineThickness:{value:i},outlineColor:{value:r},outlineAlpha:{value:s}},g=["#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include ","uniform float outlineThickness;","vec4 calculateOutline( vec4 pos, vec3 normal, vec4 skinned ) {"," float thickness = outlineThickness;"," const float ratio = 1.0;"," vec4 pos2 = projectionMatrix * modelViewMatrix * vec4( skinned.xyz + normal, 1.0 );"," vec4 norm = normalize( pos - pos2 );"," return pos + norm * thickness * pos.w * ratio;","}","void main() {"," #include "," #include "," #include "," #include "," #include "," #include "," #include "," #include "," #include "," #include "," vec3 outlineNormal = - objectNormal;"," gl_Position = calculateOutline( gl_Position, outlineNormal, vec4( transformed, 1.0 ) );"," #include "," #include "," #include ","}"].join(` +`),v=["#include ","#include ","#include ","#include ","uniform vec3 outlineColor;","uniform float outlineAlpha;","void main() {"," #include "," #include "," gl_FragColor = vec4( outlineColor, outlineAlpha );"," #include "," #include "," #include "," #include ","}"].join(` +`);function w(){return new zi({type:"OutlineEffect",uniforms:AE.merge([Ze.fog,Ze.displacementmap,u]),vertexShader:g,fragmentShader:v,side:Ei})}function T(F){let D=l[F.uuid];return D===void 0&&(D={material:w(),used:!0,keepAlive:a,count:0},l[F.uuid]=D),D.used=!0,D.material}function M(F){const D=T(F);return h[D.uuid]=F,O(D,F),D}function b(F){const D=F.geometry,L=D!==void 0&&D.attributes.normal!==void 0;return F.isMesh===!0&&F.material!==void 0&&L===!0}function A(F){if(b(F)!==!1){if(Array.isArray(F.material))for(let D=0,L=F.material.length;Dd&&delete l[V]):(l[V].used=!1,l[V].count=0)}}this.render=function(F,D){if(this.enabled===!1){e.render(F,D);return}const L=e.autoClear;e.autoClear=this.autoClear,e.render(F,D),e.autoClear=L,this.renderOutline(F,D)},this.renderOutline=function(F,D){const L=e.autoClear,V=F.matrixWorldAutoUpdate,ie=F.background,re=e.shadowMap.enabled;F.matrixWorldAutoUpdate=!1,F.background=null,e.autoClear=!1,e.shadowMap.enabled=!1,F.traverse(A),e.render(F,D),F.traverse(E),B(),F.matrixWorldAutoUpdate=V,F.background=ie,e.autoClear=L,e.shadowMap.enabled=re},this.autoClear=e.autoClear,this.domElement=e.domElement,this.shadowMap=e.shadowMap,this.clear=function(F,D,L){e.clear(F,D,L)},this.getPixelRatio=function(){return e.getPixelRatio()},this.setPixelRatio=function(F){e.setPixelRatio(F)},this.getSize=function(F){return e.getSize(F)},this.setSize=function(F,D,L){e.setSize(F,D,L)},this.setViewport=function(F,D,L,V){e.setViewport(F,D,L,V)},this.setScissor=function(F,D,L,V){e.setScissor(F,D,L,V)},this.setScissorTest=function(F){e.setScissorTest(F)},this.setRenderTarget=function(F){e.setRenderTarget(F)}}}class uz extends D_{constructor(e){super(e)}parse(e){function t($){switch($.image_type){case g:case T:if($.colormap_length>256||$.colormap_size!==24||$.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case v:case w:case M:case b:if($.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case u:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+$.image_type)}if($.width<=0||$.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if($.pixel_size!==8&&$.pixel_size!==16&&$.pixel_size!==24&&$.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+$.pixel_size)}function i($,ue,Y,pe,_e){let Ae,Pe;const Ue=Y.pixel_size>>3,ae=Y.width*Y.height*Ue;if(ue&&(Pe=_e.subarray(pe,pe+=Y.colormap_length*(Y.colormap_size>>3))),$){Ae=new Uint8Array(ae);let ge,ce,Me,Ye=0;const ht=new Uint8Array(Ue);for(;Ye>7,$[(ce+Ye*Me)*4+1]=(ae&992)>>2,$[(ce+Ye*Me)*4+2]=(ae&31)<<3,$[(ce+Ye*Me)*4+3]=ae&32768?0:255;return $}function a($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=3)$[(ge+Me*ce)*4+3]=255,$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+1],$[(ge+Me*ce)*4+0]=Ue[ae+2];return $}function l($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=4)$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+1],$[(ge+Me*ce)*4+0]=Ue[ae+2],$[(ge+Me*ce)*4+3]=Ue[ae+3];return $}function d($,ue,Y,pe,_e,Ae,Pe,Ue){let ae,ge=0,ce,Me;const Ye=L.width;for(Me=ue;Me!==pe;Me+=Y)for(ce=_e;ce!==Pe;ce+=Ae,ge++)ae=Ue[ge],$[(ce+Ye*Me)*4+0]=ae,$[(ce+Ye*Me)*4+1]=ae,$[(ce+Ye*Me)*4+2]=ae,$[(ce+Ye*Me)*4+3]=255;return $}function h($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=2)$[(ge+Me*ce)*4+0]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+0],$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+3]=Ue[ae+1];return $}function m($,ue,Y,pe,_e){let Ae,Pe,Ue,ae,ge,ce;switch((L.flags&A)>>E){default:case O:Ae=0,Ue=1,ge=ue,Pe=0,ae=1,ce=Y;break;case P:Ae=0,Ue=1,ge=ue,Pe=Y-1,ae=-1,ce=-1;break;case B:Ae=ue-1,Ue=-1,ge=-1,Pe=0,ae=1,ce=Y;break;case G:Ae=ue-1,Ue=-1,ge=-1,Pe=Y-1,ae=-1,ce=-1;break}if(re)switch(L.pixel_size){case 8:d($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 16:h($,Pe,ae,ce,Ae,Ue,ge,pe);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(L.pixel_size){case 8:r($,Pe,ae,ce,Ae,Ue,ge,pe,_e);break;case 16:s($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 24:a($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 32:l($,Pe,ae,ce,Ae,Ue,ge,pe);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return $}const u=0,g=1,v=2,w=3,T=9,M=10,b=11,A=48,E=4,P=0,G=1,O=2,B=3;if(e.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let F=0;const D=new Uint8Array(e),L={id_length:D[F++],colormap_type:D[F++],image_type:D[F++],colormap_index:D[F++]|D[F++]<<8,colormap_length:D[F++]|D[F++]<<8,colormap_size:D[F++],origin:[D[F++]|D[F++]<<8,D[F++]|D[F++]<<8],width:D[F++]|D[F++]<<8,height:D[F++]|D[F++]<<8,pixel_size:D[F++],flags:D[F++]};if(t(L),L.id_length+F>e.length)throw new Error("THREE.TGALoader: No data.");F+=L.id_length;let V=!1,ie=!1,re=!1;switch(L.image_type){case T:V=!0,ie=!0;break;case g:ie=!0;break;case M:V=!0;break;case v:break;case b:V=!0,re=!0;break;case w:re=!0;break}const de=new Uint8Array(L.width*L.height*4),me=i(V,ie,L,F,D);return m(de,L.width,L.height,me.pixel_data,me.palettes),{data:de,width:L.width,height:L.height,flipY:!0,generateMipmaps:!0,minFilter:Er}}}const dz=/^[og]\s*(.+)?/,hz=/^mtllib /,fz=/^usemtl /,pz=/^usemap /,US=/\s+/,OS=new j,Up=new j,NS=new j,BS=new j,nr=new j,md=new Je;function mz(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const i=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const l={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){const h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return h.clone=this.clone.bind(h),h}};return this.materials.push(l),l},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},i&&i.name&&typeof i.clone=="function"){const r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/3)*3},parseNormalIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/3)*3},parseUVIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/2)*2},addVertex:function(e,t,i){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,i){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addFaceNormal:function(e,t,i){const r=this.vertices,s=this.object.geometry.normals;OS.fromArray(r,e),Up.fromArray(r,t),NS.fromArray(r,i),nr.subVectors(NS,Up),BS.subVectors(OS,Up),nr.cross(BS),nr.normalize(),s.push(nr.x,nr.y,nr.z),s.push(nr.x,nr.y,nr.z),s.push(nr.x,nr.y,nr.z)},addColor:function(e,t,i){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[i]!==void 0&&s.push(r[i+0],r[i+1],r[i+2])},addUV:function(e,t,i){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[i+0],r[i+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,i,r,s,a,l,d,h){const m=this.vertices.length;let u=this.parseVertexIndex(e,m),g=this.parseVertexIndex(t,m),v=this.parseVertexIndex(i,m);if(this.addVertex(u,g,v),this.addColor(u,g,v),l!==void 0&&l!==""){const w=this.normals.length;u=this.parseNormalIndex(l,w),g=this.parseNormalIndex(d,w),v=this.parseNormalIndex(h,w),this.addNormal(u,g,v)}else this.addFaceNormal(u,g,v);if(r!==void 0&&r!==""){const w=this.uvs.length;u=this.parseUVIndex(r,w),g=this.parseUVIndex(s,w),v=this.parseUVIndex(a,w),this.addUV(u,g,v),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let i=0,r=e.length;i=7?(md.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(md.r,md.g,md.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(m==="f"){const g=h.slice(1).trim().split(US),v=[];for(let T=0,M=g.length;T0){const A=b.split("/");v.push(A)}}const w=v[0];for(let T=1,M=v.length-1;T1){const g=r[1].trim().toLowerCase();t.object.smooth=g!=="0"&&g!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(h==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+h+'"')}}t.finalize();const s=new Nr;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,d=t.objects.length;l0&&T.setAttribute("normal",new nn(m.normals,3)),m.colors.length>0&&(w=!0,T.setAttribute("color",new nn(m.colors,3))),m.hasUVIndices===!0&&T.setAttribute("uv",new nn(m.uvs,2));const M=[];for(let A=0,E=u.length;A1){for(let A=0,E=u.length;A0){const l=new Ao({size:1,sizeAttenuation:!1}),d=new On;d.setAttribute("position",new nn(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(d.setAttribute("color",new nn(t.colors,3)),l.vertexColors=!0);const h=new Ud(d,l);s.add(h)}return s}}class _z extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new _s(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(l))}catch(d){r?r(d):console.error(d),s.manager.itemError(e)}},i,r)}parse(e){function t(h){const m=new DataView(h),u=32/8*3+32/8*3*3+16/8,g=m.getUint32(80,!0);if(80+32/8+g*u===m.byteLength)return!0;const w=[115,111,108,105,100];for(let T=0;T<5;T++)if(i(w,m,T))return!1;return!0}function i(h,m,u){for(let g=0,v=h.length;g>5&31)/31,w=($>>10&31)/31)}for(let $=1;$<=3;$++){const ue=ie+$*12,Y=V*3*3+($-1)*3;F[Y]=m.getFloat32(ue,!0),F[Y+1]=m.getFloat32(ue+4,!0),F[Y+2]=m.getFloat32(ue+8,!0),D[Y]=re,D[Y+1]=de,D[Y+2]=me,T&&(L.set(g,v,w).convertSRGBToLinear(),M[Y]=L.r,M[Y+1]=L.g,M[Y+2]=L.b)}}return B.setAttribute("position",new _n(F,3)),B.setAttribute("normal",new _n(D,3)),T&&(B.setAttribute("color",new _n(M,3)),B.hasColors=!0,B.alpha=P),B}function s(h){const m=new On,u=/solid([\s\S]*?)endsolid/g,g=/facet([\s\S]*?)endfacet/g,v=/solid\s(.+)/;let w=0;const T=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,M=new RegExp("vertex"+T+T+T,"g"),b=new RegExp("normal"+T+T+T,"g"),A=[],E=[],P=[],G=new j;let O,B=0,F=0,D=0;for(;(O=u.exec(h))!==null;){F=D;const L=O[0],V=(O=v.exec(L))!==null?O[1]:"";for(P.push(V);(O=g.exec(L))!==null;){let de=0,me=0;const $=O[0];for(;(O=b.exec($))!==null;)G.x=parseFloat(O[1]),G.y=parseFloat(O[2]),G.z=parseFloat(O[3]),me++;for(;(O=M.exec($))!==null;)A.push(parseFloat(O[1]),parseFloat(O[2]),parseFloat(O[3])),E.push(G.x,G.y,G.z),de++,D++;me!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+w),de!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+w),w++}const ie=F,re=D-F;m.userData.groupNames=P,m.addGroup(ie,re,B),B++}return m.setAttribute("position",new nn(A,3)),m.setAttribute("normal",new nn(E,3)),m}function a(h){return typeof h!="string"?new TextDecoder().decode(h):h}function l(h){if(typeof h=="string"){const m=new Uint8Array(h.length);for(let u=0;u{const r=this.viewer;t==="ModelAssets"&&(rr[this._index].loading(!0),Promise.allSettled([ho(r,{url:i.model}),ho(r,{url:i.texture_diffuse}),ho(r,{url:i.texture_normal,colorSpace:""}),ho(r,{url:i.texture_pbr,colorSpace:""}),ho(r,{url:i.shaded})]).then(s=>{rr[this._index].loading(!1);const[a,l,d,h,m]=s.map(u=>u.status==="fulfilled"?u.value:"");(a||this._model)&&(this._texture={diffuse:l,normal:d,pbr:h,shaded:m},this.viewer.scene.background=new Je().fromArray([.12941176470588237,.2,.2823529411764706].map(u=>u+.1)),this._addModel(a))}).catch(s=>{console.error(s)})),t==="renderMode"&&this._onRenderMode(i)});this._index=i}onExit(){this.originNormals=null,this.flatNormals=null,this._environment=null,this.viewer.scene.environment=null}onPre(){const t=this.viewer;return Promise.all([ho(t,{url:"/extensions/ComfyUI-Rodin/threeVisualizer/environments/interior.exr",mapping:el,flipY:!0})]).then(([i])=>{this._environment=i,t.scene.environment=i})}onInit(){const t=this.viewer;t.scene.environmentIntensity=2,this._freelookCamera=t.addNode(sz,{rotateSpeed:.8,scaleSpeed:.8}),this._directionalLight=t.addNode(F_,{position:new j(0,1,1),intensity:3}),this._ambientLight=t.addNode(YE,{color:new Je(16777215),intensity:.5});let i=this._directionalLight;i.castShadow=!0,i.shadow.mapSize.width=4096,i.shadow.mapSize.height=4096,i.shadow.camera.near=-1,i.shadow.camera.far=10,i.shadow.bias=-.005,i.shadow.normalBias=.01,t.renderer.shadowMap.enabled=!0,t.renderer.shadowMap.type=2,this._addMaterials(),this._addOutline(),rr[this._index].onTracerToWebGLCameraPosition(this._onSyncCameraPosition.bind(this)),rr[this._index].onChanged(this._onChanged),rr[this._index].init()}_onSyncCameraPosition(t){const i=this._freelookCamera,r=new N_().setFromVector3(t);i.gotoPOI({theta:r.theta,phi:r.phi,springLength:r.radius,smoothing:0})}_addMaterials(){const t=this._matcap=new _N;t.side=Si,t.onBeforeCompile=r=>{FS(r,this._uFlat)};const i=this._standard=new na;i.side=Si,i.onBeforeCompile=r=>{FS(r,this._uFlat)}}_addOutline(){const t=this.viewer;let i=new cz(t.renderer),r=!1;t.scene.onAfterRender=()=>{rr[this._index].states.renderMode==="Toon"&&(r||(r=!0,i.renderOutline(t.scene,t.camera),r=!1))}}_addModel(t){const i=t.userData.meshes,r=i.map(T=>gT(T.material,this._standard)),s=r.map(T=>Array.isArray(T)?T.map(M=>GS(M,this._texture)):GS(T,this._texture)),a=r.map(T=>Array.isArray(T)?T.map(M=>zS(M,this._texture)):zS(T,this._texture)),l=r.map(T=>Array.isArray(T)?T.map(M=>WS(M)):WS(T));t.userData.pbrMaterials=s,t.userData.unlitMaterials=a,t.userData.toonMaterials=l;const d=r.map(T=>Array.isArray(T)?T.map(()=>HS()):HS()),h=r.map(T=>Array.isArray(T)?T.map(()=>VS()):VS());t.userData.geometryMaterials=d,t.userData.wireframeMaterials=h;const u=new Pr().setFromObject(t).getSize(new j),g=Math.max(Math.max(u.x,u.y),u.z);i.forEach(T=>{T.geometry=this.setGeometryBaryCenter(T.geometry)});const v=this._freelookCamera;v.lens.near=g*.1,v.lens.far=g*8,v.distanceMin=g*1.2,v.distanceMax=g*4,v.forbidPanX=!0,v.forbidPanY=!0,v.gotoPOI({springLength:g*2,theta:0,phi:1.37,smoothing:0}),Object.values(t.userData.materials).forEach(T=>{T.onBeforeCompile=M=>{mT(M,this._uEdge)}});const w=this.viewer;t.traverse(T=>{T.isObject3D&&(T.castShadow=!0,T.receiveShadow=!0)}),this._model&&w.removeNode(this._model),this._model=w.addNode(t),this._onRenderMode(rr[this._index].states.renderMode),rr[this._index].states.renderMode==="Tracer"&&w.stop()}_onRenderMode(t){t==="Tracer"&&rr[this._index].syncCameraPosition(this._freelookCamera.node.position);let i=this._model;if(i){const r=this._matcap,s=this.viewer;i.userData.meshes.forEach((a,l)=>{t==="Preview"?(a.material=r,this._uFlat.value=1):t==="Wireframe"?(a.geometry.attributes.normal=this.flatNormals,a.material=i.userData.wireframeMaterials[l]):t==="Geometry"&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.geometryMaterials[l]),["PBR","Tracer"].includes(t)&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.pbrMaterials[l]),t==="Shaded"&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.unlitMaterials[l]),t==="Toon"?(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.toonMaterials[l],s.scene.environment=null):s.scene.environment||(s.scene.environment=this._environment),this._directionalLight.visible=this._ambientLight.visible=t==="Toon"})}}onUpdate(t){}setGeometryBaryCenter(t){t.index&&(t.copy(t.toNonIndexed()),t.setIndex(null));const i=[new et(0,0),new et(1,0),new j(1,1),new et(0,0),new j(1,1),new j(0,1)],r=t.attributes.position,s=new Float32Array(r.count*2);for(let a=0,l=r.count;agT(t,e));if(n.name===Hi.DEFAULT_MATERIAL_NAME)return e}else return e;return n}function zS(n,e){const t=new Or;return t.map=n.map||e.shaded||e.diffuse||n.emissiveMap,t.toneMapped=!1,t}function HS(){const n=new na({});return n.map=null,n.metalness=.8,n.roughness=.5,n.metalnessMap=null,n.roughnessMap=null,n.toneMapped=!1,n}function GS(n,e){const t=new na({});return e.pbr?(t.metalnessMap=e.pbr,t.roughnessMap=e.pbr):(t.metalness=0,t.roughness=.5),e.normal&&(t.normalMap=e.normal),t.map=n.map||e.diffuse||e.shaded||n.emissiveMap,t}function VS(){const n=new na({});return n.onBeforeCompile=e=>{mT(e,{value:1})},n.map=null,n.metalness=.8,n.roughness=.5,n.metalnessMap=null,n.roughnessMap=null,n.toneMapped=!1,n}const yz=bz();function WS(n){const e=new mN;return e.map=n.map,e.gradientMap=yz,e.toneMapped=!1,e.shadowSide=2,e}function bz(n=4){const e=new Uint8Array(n);for(let i=0;i<=e.length;i++)e[i]=i/e.length*256;const t=new $c(e,e.length,1,Wc);return t.needsUpdate=!0,t}class xz{constructor(){Ve(this,"_scenesMap",new Map);Ve(this,"_activeScene",null);Ve(this,"_activeSceneName","")}get activeSceneName(){return this._activeSceneName}clear(){var e;(e=this._activeScene)==null||e.onExit(),this._scenesMap.clear(),this._activeScene=null}getScene(e){return this._scenesMap.get(e)}registerScene(e,t){return this._scenesMap.set(e,t),t}prepareScene(e){const t=e||this._scenesMap.keys(),i=[];for(let r of t){let s=this._scenesMap.get(r);s&&!s.flags.OnPreCalled&&(s.flags.OnPreCalled=!0,s.onPre&&i.push(s.onPre()))}return Promise.all(i)}runScene(e,t={}){let i=this._scenesMap.get(e);if(i){let r=this._activeScene;r&&r.onExit&&r.onExit(t),i.onInit&&i.onInit(),i.onEnter&&i.onEnter(t),this._activeScene=i,this._activeSceneName=e}}updateScene(e){this._activeScene&&this._activeScene.onUpdate&&this._activeScene.onUpdate(e)}}class wz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["gltf","glb"]);Ve(this,"_loader");Ve(this,"_dracoLoader")}load({url:t,buffer:i,path:r,resourcePath:s,dracoPath:a,manager:l,onLoad:d,onProgress:h,onError:m}){let u=this._dracoLoader;u===void 0&&(u=this._dracoLoader=new z_),u.manager=l,u.setDecoderPath(a);let g=this._loader;g===void 0&&(g=this._loader=new B_,g.setDRACOLoader(u),g.setMeshoptDecoder(H_)),g.manager=l,g.setPath(r),g.setResourcePath(s);const v=w=>{const T=w.scene;T.animations.push(...w.animations),T.userData=Object.assign(w.userData,T.userData),d(Nn._setUserData(T))};i?g.parse(i,s,v,m):g.load(t,v,h,m)}}class Sz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["obj"]);Ve(this,"_loader")}load({url:t,buffer:i,path:r,resourcePath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._loader;m===void 0&&(m=this._loader=new gz),m.manager=a,m.setPath(r),m.setResourcePath(s);const u=g=>{const v=new kc;v.add(g),v.animations.push(...g.animations),v.userData=Object.assign(g.userData,v.userData),l(Nn._setUserData(v))};i?m.parse(i):m.load(t,u,d,h)}}class Mz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["stl"]);Ve(this,"_loader")}load({url:t,buffer:i,path:r,resourcePath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._loader;m===void 0&&(m=this._loader=new _z),m.manager=a,m.setPath(r),m.setResourcePath(s);const u=g=>{const v=g.getAttribute("position");if(v)for(let M=0,b=v.count;M0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(t.map(d=>{if(d=Tz(d),d in jS)return;jS[d]=!0;const h=d.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const u=document.createElement("link");if(u.rel=h?"stylesheet":Ez,h||(u.as="script"),u.crossOrigin="",u.href=d,l&&u.setAttribute("nonce",l),document.head.appendChild(u),h)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};var yg=(n=>{var e=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(e=e||__filename),function(t={locateFile:(i,r)=>(!r&&e&&(r=e.substr(0,e.lastIndexOf("/")+1)),r+i),...n}){function i(){return ue.buffer!=Pe.buffer&&ft(),Pe}function r(){return ue.buffer!=Pe.buffer&&ft(),Ue}function s(){return ue.buffer!=Pe.buffer&&ft(),ae}function a(){return ue.buffer!=Pe.buffer&&ft(),ge}function l(){return ue.buffer!=Pe.buffer&&ft(),ce}function d(){return ue.buffer!=Pe.buffer&&ft(),Me}function h(){return ue.buffer!=Pe.buffer&&ft(),Ye}function m(){return ue.buffer!=Pe.buffer&&ft(),ht}var u=t,g,v;if(u.ready=new Promise((o,c)=>{g=o,v=c}),u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,function(){if(!(u.ENVIRONMENT_IS_PTHREAD||u.$ww)){var o=function(c){typeof window=="object"?window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):typeof process>"u"&&typeof location<"u"&&encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");var f="emHdBindings.data",p="emHdBindings.data";typeof u.locateFilePackage=="function"&&!u.locateFile&&(u.locateFile=u.locateFilePackage,me("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var _=u.locateFile?u.locateFile(p,""):p,y=c.remote_package_size;function x(se,he,ye,ze){if(typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"){require("fs").readFile(se,function(at,dt){at?ze(at):ye(dt.buffer)});return}var Ke=new XMLHttpRequest;Ke.open("GET",se,!0),Ke.responseType="arraybuffer",Ke.onprogress=function(at){var dt=se,Re=he;if(at.total&&(Re=at.total),at.loaded){Ke.addedTotal?u.dataFileDownloads[dt].loaded=at.loaded:(Ke.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[dt]={loaded:at.loaded,total:Re});var je=0,dn=0,zt=0;for(var ci in u.dataFileDownloads){var hn=u.dataFileDownloads[ci];je+=hn.total,dn+=hn.loaded,zt++}je=Math.ceil(je*u.expectedDataFileDownloads/zt),u.setStatus&&u.setStatus(`Downloading data... (${dn}/${je})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},Ke.onerror=function(at){throw new Error("NetworkError for: "+se)},Ke.onload=function(at){if(Ke.status==200||Ke.status==304||Ke.status==206||Ke.status==0&&Ke.response){var dt=Ke.response;ye(dt)}else throw new Error(Ke.statusText+" : "+Ke.responseURL)},Ke.send(null)}function C(se){console.error("package error:",se)}var U=null,H=u.getPreloadedPackage?u.getPreloadedPackage(_,y):null;H||x(_,y,function(se){U?(U(se),U=null):H=se},C);function K(){function se(at,dt){if(!at)throw dt+new Error().stack}u.FS_createPath("/","usd",!0,!0),u.FS_createPath("/usd","ar",!0,!0),u.FS_createPath("/usd/ar","resources",!0,!0),u.FS_createPath("/usd","hd",!0,!0),u.FS_createPath("/usd/hd","resources",!0,!0),u.FS_createPath("/usd/hd/resources","codegenTemplates",!0,!0),u.FS_createPath("/usd","httpResolver",!0,!0),u.FS_createPath("/usd/httpResolver","resources",!0,!0),u.FS_createPath("/usd","ndr",!0,!0),u.FS_createPath("/usd/ndr","resources",!0,!0),u.FS_createPath("/usd","sdf",!0,!0),u.FS_createPath("/usd/sdf","resources",!0,!0),u.FS_createPath("/usd","usd",!0,!0),u.FS_createPath("/usd/usd","resources",!0,!0),u.FS_createPath("/usd/usd/resources","codegenTemplates",!0,!0),u.FS_createPath("/usd/usd/resources","usd",!0,!0),u.FS_createPath("/usd","usdGeom",!0,!0),u.FS_createPath("/usd/usdGeom","resources",!0,!0),u.FS_createPath("/usd/usdGeom/resources","usdGeom",!0,!0),u.FS_createPath("/usd","usdHydra",!0,!0),u.FS_createPath("/usd/usdHydra","resources",!0,!0),u.FS_createPath("/usd/usdHydra/resources","shaders",!0,!0),u.FS_createPath("/usd/usdHydra/resources","usdHydra",!0,!0),u.FS_createPath("/usd","usdImaging",!0,!0),u.FS_createPath("/usd/usdImaging","resources",!0,!0),u.FS_createPath("/usd","usdLux",!0,!0),u.FS_createPath("/usd/usdLux","resources",!0,!0),u.FS_createPath("/usd/usdLux/resources","usdLux",!0,!0),u.FS_createPath("/usd","usdRender",!0,!0),u.FS_createPath("/usd/usdRender","resources",!0,!0),u.FS_createPath("/usd/usdRender/resources","usdRender",!0,!0),u.FS_createPath("/usd","usdShade",!0,!0),u.FS_createPath("/usd/usdShade","resources",!0,!0),u.FS_createPath("/usd/usdShade/resources","usdShade",!0,!0),u.FS_createPath("/usd","usdShaders",!0,!0),u.FS_createPath("/usd/usdShaders","resources",!0,!0),u.FS_createPath("/usd/usdShaders/resources","shaders",!0,!0),u.FS_createPath("/usd","usdSkel",!0,!0),u.FS_createPath("/usd/usdSkel","resources",!0,!0),u.FS_createPath("/usd/usdSkel/resources","usdSkel",!0,!0),u.FS_createPath("/usd","usdVol",!0,!0),u.FS_createPath("/usd/usdVol","resources",!0,!0),u.FS_createPath("/usd/usdVol/resources","usdVol",!0,!0);function he(at,dt,Re){this.start=at,this.end=dt,this.audio=Re}he.prototype={requests:{},open:function(at,dt){this.name=dt,this.requests[dt]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var at=this.byteArray.subarray(this.start,this.end);this.finish(at)},finish:function(at){var dt=this;u.FS_createDataFile(this.name,null,at,!0,!0,!0),u.removeRunDependency(`fp ${dt.name}`),this.requests[this.name]=null}};for(var ye=c.files,ze=0;ze{throw c},b=typeof window=="object",A=typeof importScripts=="function",E=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",P=u.ENVIRONMENT_IS_PTHREAD||!1,G="";function O(o){return u.locateFile?u.locateFile(o,G):G+o}var B,F,D;if(E){var L=require("fs"),V=require("path");A?G=V.dirname(G)+"/":G=__dirname+"/",B=(c,f)=>(c=vt(c)?new URL(c):V.normalize(c),L.readFileSync(c,f?void 0:"utf8")),D=c=>{var f=B(c,!0);return f.buffer||(f=new Uint8Array(f)),f},F=(c,f,p,_=!0)=>{c=vt(c)?new URL(c):V.normalize(c),L.readFile(c,_?void 0:"utf8",(y,x)=>{y?p(y):f(_?x.buffer:x)})},!u.thisProgram&&process.argv.length>1&&(T=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),M=(c,f)=>{throw process.exitCode=c,f},u.inspect=()=>"[Emscripten Module object]";let o;try{o=require("worker_threads")}catch(c){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),c}global.Worker=o.Worker}else(b||A)&&(A?G=self.location.href:typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),e&&(G=e),G.indexOf("blob:")!==0?G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1):G="",E||(B=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.send(null),c.responseText},A&&(D=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}),F=(o,c,f)=>{var p=new XMLHttpRequest;p.open("GET",o,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){c(p.response);return}f()},p.onerror=f,p.send(null)}));E&&typeof performance>"u"&&(global.performance=require("perf_hooks").performance);var ie=console.log.bind(console),re=console.error.bind(console);E&&(ie=(...o)=>L.writeSync(1,o.join(" ")+` +`),re=(...o)=>L.writeSync(2,o.join(" ")+` +`));var de=u.print||ie,me=u.printErr||re;Object.assign(u,w),w=null,u.arguments&&u.arguments,u.thisProgram&&(T=u.thisProgram),u.quit&&(M=u.quit);var $;u.wasmBinary&&($=u.wasmBinary),typeof WebAssembly!="object"&<("no native wasm support detected");var ue,Y,pe=!1,_e;function Ae(o,c){o||lt(c)}var Pe,Ue,ae,ge,ce,Me,Ye,ht;function ft(){var o=ue.buffer;u.HEAP8=Pe=new Int8Array(o),u.HEAP16=ae=new Int16Array(o),u.HEAPU8=Ue=new Uint8Array(o),u.HEAPU16=ge=new Uint16Array(o),u.HEAP32=ce=new Int32Array(o),u.HEAPU32=Me=new Uint32Array(o),u.HEAPF32=Ye=new Float32Array(o),u.HEAPF64=ht=new Float64Array(o)}var Wt=u.INITIAL_MEMORY||16777216;if(Ae(Wt>=5242880,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+Wt+"! (STACK_SIZE=5242880)"),P)ue=u.wasmMemory;else if(u.wasmMemory)ue=u.wasmMemory;else if(ue=new WebAssembly.Memory({initial:Wt/65536,maximum:4294967296/65536,shared:!0}),!(ue.buffer instanceof SharedArrayBuffer))throw me("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),E&&me("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");ft(),Wt=ue.buffer.byteLength;var Z=[],Jt=[],Ut=[];function jt(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)yt(u.preRun.shift());Te(Z)}function ut(){P||(!u.noFSInit&&!R.init.initialized&&R.init(),R.ignorePermissions=!1,Te(Jt))}function yn(){if(!P){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)X(u.postRun.shift());Te(Ut)}}function yt(o){Z.unshift(o)}function wt(o){Jt.unshift(o)}function X(o){Ut.unshift(o)}var N=0,ve=null;function De(o){return o}function ke(o){N++,u.monitorRunDependencies&&u.monitorRunDependencies(N)}function Le(o){if(N--,u.monitorRunDependencies&&u.monitorRunDependencies(N),N==0&&ve){var c=ve;ve=null,c()}}function lt(o){u.onAbort&&u.onAbort(o),o="Aborted("+o+")",me(o),_e=1,o+=". Build with -sASSERTIONS for more info.";var c=new WebAssembly.RuntimeError(o);throw v(c),c}var Qe="data:application/octet-stream;base64,",tt=o=>o.startsWith(Qe),vt=o=>o.startsWith("file://"),Ne;Ne="emHdBindings.wasm",tt(Ne)||(Ne=O(Ne));function nt(o){if(o==Ne&&$)return new Uint8Array($);if(D)return D(o);throw"both async and sync fetching of the wasm failed"}function Rt(o){if(!$&&(b||A)){if(typeof fetch=="function"&&!vt(o))return fetch(o,{credentials:"same-origin"}).then(c=>{if(!c.ok)throw"failed to load wasm binary file at '"+o+"'";return c.arrayBuffer()}).catch(()=>nt(o));if(F)return new Promise((c,f)=>{F(o,p=>c(new Uint8Array(p)),f)})}return Promise.resolve().then(()=>nt(o))}function ct(o,c,f){return Rt(o).then(p=>WebAssembly.instantiate(p,c)).then(p=>p).then(f,p=>{me(`failed to asynchronously prepare wasm: ${p}`),lt(p)})}function $e(o,c,f,p){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!tt(c)&&!vt(c)&&!E&&typeof fetch=="function"?fetch(c,{credentials:"same-origin"}).then(_=>{var y=WebAssembly.instantiateStreaming(_,f);return y.then(p,function(x){return me(`wasm streaming compile failed: ${x}`),me("falling back to ArrayBuffer instantiation"),ct(c,f,p)})}):ct(c,f,p)}function bt(){var o={a:vC};function c(p,_){return ne=p.exports,ne=_t.instrumentWasmExports(ne),ne=qP(ne),en(ne.Hd),ne.Dd,wt(ne.Bd),Y=_,Le(),ne}ke();function f(p){c(p.instance,p.module)}if(u.instantiateWasm)try{return u.instantiateWasm(o,c)}catch(p){me(`Module.instantiateWasm callback failed with error: ${p}`),v(p)}return $e($,Ne,o,f).catch(v),{}}var Ie,it;function ee(o,c){return _t.handleAsync(async()=>{const f=fe(o),p=new URL(f);try{const _=await fetch(p);if(!_.ok)throw new Error("Fetch failed: "+_.statusText);const y=await _.arrayBuffer(),x=y.byteLength,C=Ml(x);r().set(new Uint8Array(y),C>>>0),u.HEAP32[c>>2]=C,u.HEAP32[(c>>2)+1]=x}catch(_){console.error("Error in fetch_asset: ",_),u.HEAP32[c>>2]=0,u.HEAP32[(c>>2)+1]=0}})}function He(o){typeof self<"u"?typeof self.loadedFiles>"u"&&(self.loadedFiles=[]):console.log("Neither window nor self is defined"),self.loadedFiles.push(fe(o))}function oe(o,c){const f=fe(o),p=fe(c);let _=document.createElement("a");_.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(f)),_.setAttribute("download",p),_.style.display="none",document.body.appendChild(_),_.click(),document.body.removeChild(_)}function Ce(o){this.name="ExitStatus",this.message=`Program terminated with exit(${o})`,this.status=o}var Ge=o=>{o.terminate(),o.onmessage=c=>{}},gt=o=>{var c=Ee.pthreads[o];delete Ee.pthreads[o],Ge(c),gf(o),Ee.runningWorkers.splice(Ee.runningWorkers.indexOf(c),1),c.pthread_ptr=0},Pt=o=>{var c=Ee.pthreads[o];c.postMessage({cmd:"cancel"})},un=o=>{var c=Ee.pthreads[o];Ae(c),Ee.returnWorkerToPool(c)},Ln=(o,c)=>(r().fill(0,o,o+c),o),Ot=o=>{var c=Ee.getNewWorker();if(!c)return 6;Ee.runningWorkers.push(c),Ee.pthreads[o.pthread_ptr]=c,c.pthread_ptr=o.pthread_ptr;var f={cmd:"run",start_routine:o.startRoutine,arg:o.arg,pthread_ptr:o.pthread_ptr};return E&&c.unref(),c.postMessage(f,o.transferList),0},oi=0,ii=()=>Ht||oi>0,Nt={isAbs:o=>o.charAt(0)==="/",splitPath:o=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return c.exec(o).slice(1)},normalizeArray:(o,c)=>{for(var f=0,p=o.length-1;p>=0;p--){var _=o[p];_==="."?o.splice(p,1):_===".."?(o.splice(p,1),f++):f&&(o.splice(p,1),f--)}if(c)for(;f;f--)o.unshift("..");return o},normalize:o=>{var c=Nt.isAbs(o),f=o.substr(-1)==="/";return o=Nt.normalizeArray(o.split("/").filter(p=>!!p),!c).join("/"),!o&&!c&&(o="."),o&&f&&(o+="/"),(c?"/":"")+o},dirname:o=>{var c=Nt.splitPath(o),f=c[0],p=c[1];return!f&&!p?".":(p&&(p=p.substr(0,p.length-1)),f+p)},basename:o=>{if(o==="/")return"/";o=Nt.normalize(o),o=o.replace(/\/$/,"");var c=o.lastIndexOf("/");return c===-1?o:o.substr(c+1)},join:function(){var o=Array.prototype.slice.call(arguments);return Nt.normalize(o.join("/"))},join2:(o,c)=>Nt.normalize(o+"/"+c)},fr=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return p=>(p.set(crypto.getRandomValues(new Uint8Array(p.byteLength))),p);if(E)try{var o=require("crypto"),c=o.randomFillSync;if(c)return p=>o.randomFillSync(p);var f=o.randomBytes;return p=>(p.set(f(p.byteLength)),p)}catch{}lt("initRandomDevice")},ys=o=>(ys=fr())(o),Ci={resolve:function(){for(var o="",c=!1,f=arguments.length-1;f>=-1&&!c;f--){var p=f>=0?arguments[f]:R.cwd();if(typeof p!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!p)return"";o=p+"/"+o,c=Nt.isAbs(p)}return o=Nt.normalizeArray(o.split("/").filter(_=>!!_),!c).join("/"),(c?"/":"")+o||"."},relative:(o,c)=>{o=Ci.resolve(o).substr(1),c=Ci.resolve(c).substr(1);function f(H){for(var K=0;K=0&&H[se]==="";se--);return K>se?[]:H.slice(K,se-K+1)}for(var p=f(o.split("/")),_=f(c.split("/")),y=Math.min(p.length,_.length),x=y,C=0;C{c>>>=0;for(var p=c+f,_=c;o[_]&&!(_>=p);)++_;if(_-c>16&&o.buffer&&ra)return ra.decode(o.slice(c,_));for(var y="";c<_;){var x=o[c++];if(!(x&128)){y+=String.fromCharCode(x);continue}var C=o[c++]&63;if((x&224)==192){y+=String.fromCharCode((x&31)<<6|C);continue}var U=o[c++]&63;if((x&240)==224?x=(x&15)<<12|C<<6|U:x=(x&7)<<18|C<<12|U<<6|o[c++]&63,x<65536)y+=String.fromCharCode(x);else{var H=x-65536;y+=String.fromCharCode(55296|H>>10,56320|H&1023)}}return y},bs=[],Qi=o=>{for(var c=0,f=0;f=55296&&p<=57343?(c+=4,++f):c+=3}return c},xs=(o,c,f,p)=>{if(f>>>=0,!(p>0))return 0;for(var _=f,y=f+p-1,x=0;x=55296&&C<=57343){var U=o.charCodeAt(++x);C=65536+((C&1023)<<10)|U&1023}if(C<=127){if(f>=y)break;c[f++>>>0]=C}else if(C<=2047){if(f+1>=y)break;c[f++>>>0]=192|C>>6,c[f++>>>0]=128|C&63}else if(C<=65535){if(f+2>=y)break;c[f++>>>0]=224|C>>12,c[f++>>>0]=128|C>>6&63,c[f++>>>0]=128|C&63}else{if(f+3>=y)break;c[f++>>>0]=240|C>>18,c[f++>>>0]=128|C>>12&63,c[f++>>>0]=128|C>>6&63,c[f++>>>0]=128|C&63}}return c[f>>>0]=0,f-_};function Xr(o,c,f){var p=Qi(o)+1,_=new Array(p),y=xs(o,_,0,_.length);return c&&(_.length=y),_}var Ba=()=>{if(!bs.length){var o=null;if(E){var c=256,f=Buffer.alloc(c),p=0,_=process.stdin.fd;try{p=L.readSync(_,f)}catch(y){if(y.toString().includes("EOF"))p=0;else throw y}p>0?o=f.slice(0,p).toString("utf-8"):o=null}else typeof window<"u"&&typeof window.prompt=="function"?(o=window.prompt("Input: "),o!==null&&(o+=` +`)):typeof readline=="function"&&(o=readline(),o!==null&&(o+=` +`));if(!o)return null;bs=Xr(o,!0)}return bs.shift()},Ji={ttys:[],init(){},shutdown(){},register(o,c){Ji.ttys[o]={input:[],output:[],ops:c},R.registerDevice(o,Ji.stream_ops)},stream_ops:{open(o){var c=Ji.ttys[o.node.rdev];if(!c)throw new R.ErrnoError(43);o.tty=c,o.seekable=!1},close(o){o.tty.ops.fsync(o.tty)},fsync(o){o.tty.ops.fsync(o.tty)},read(o,c,f,p,_){if(!o.tty||!o.tty.ops.get_char)throw new R.ErrnoError(60);for(var y=0,x=0;x0&&(de(Ri(o.output,0)),o.output=[])},ioctl_tcgets(o){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(o,c,f){return 0},ioctl_tiocgwinsz(o){return[24,80]}},default_tty1_ops:{put_char(o,c){c===null||c===10?(me(Ri(o.output,0)),o.output=[]):c!=0&&o.output.push(c)},fsync(o){o.output&&o.output.length>0&&(me(Ri(o.output,0)),o.output=[])}}},gl=(o,c)=>Math.ceil(o/c)*c,z=o=>{o=gl(o,65536);var c=Qv(65536,o);return c?Ln(c,o):0},q={ops_table:null,mount(o){return q.createNode(null,"/",16895,0)},createNode(o,c,f,p){if(R.isBlkdev(f)||R.isFIFO(f))throw new R.ErrnoError(63);q.ops_table||(q.ops_table={dir:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr,lookup:q.node_ops.lookup,mknod:q.node_ops.mknod,rename:q.node_ops.rename,unlink:q.node_ops.unlink,rmdir:q.node_ops.rmdir,readdir:q.node_ops.readdir,symlink:q.node_ops.symlink},stream:{llseek:q.stream_ops.llseek}},file:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr},stream:{llseek:q.stream_ops.llseek,read:q.stream_ops.read,write:q.stream_ops.write,allocate:q.stream_ops.allocate,mmap:q.stream_ops.mmap,msync:q.stream_ops.msync}},link:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr,readlink:q.node_ops.readlink},stream:{}},chrdev:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr},stream:R.chrdev_stream_ops}});var _=R.createNode(o,c,f,p);return R.isDir(_.mode)?(_.node_ops=q.ops_table.dir.node,_.stream_ops=q.ops_table.dir.stream,_.contents={}):R.isFile(_.mode)?(_.node_ops=q.ops_table.file.node,_.stream_ops=q.ops_table.file.stream,_.usedBytes=0,_.contents=null):R.isLink(_.mode)?(_.node_ops=q.ops_table.link.node,_.stream_ops=q.ops_table.link.stream):R.isChrdev(_.mode)&&(_.node_ops=q.ops_table.chrdev.node,_.stream_ops=q.ops_table.chrdev.stream),_.timestamp=Date.now(),o&&(o.contents[c]=_,o.timestamp=_.timestamp),_},getFileDataAsTypedArray(o){return o.contents?o.contents.subarray?o.contents.subarray(0,o.usedBytes):new Uint8Array(o.contents):new Uint8Array(0)},expandFileStorage(o,c){var f=o.contents?o.contents.length:0;if(!(f>=c)){var p=1024*1024;c=Math.max(c,f*(f>>0),f!=0&&(c=Math.max(c,256));var _=o.contents;o.contents=new Uint8Array(c),o.usedBytes>0&&o.contents.set(_.subarray(0,o.usedBytes),0)}},resizeFileStorage(o,c){if(o.usedBytes!=c)if(c==0)o.contents=null,o.usedBytes=0;else{var f=o.contents;o.contents=new Uint8Array(c),f&&o.contents.set(f.subarray(0,Math.min(c,o.usedBytes))),o.usedBytes=c}},node_ops:{getattr(o){var c={};return c.dev=R.isChrdev(o.mode)?o.id:1,c.ino=o.id,c.mode=o.mode,c.nlink=1,c.uid=0,c.gid=0,c.rdev=o.rdev,R.isDir(o.mode)?c.size=4096:R.isFile(o.mode)?c.size=o.usedBytes:R.isLink(o.mode)?c.size=o.link.length:c.size=0,c.atime=new Date(o.timestamp),c.mtime=new Date(o.timestamp),c.ctime=new Date(o.timestamp),c.blksize=4096,c.blocks=Math.ceil(c.size/c.blksize),c},setattr(o,c){c.mode!==void 0&&(o.mode=c.mode),c.timestamp!==void 0&&(o.timestamp=c.timestamp),c.size!==void 0&&q.resizeFileStorage(o,c.size)},lookup(o,c){throw R.genericErrors[44]},mknod(o,c,f,p){return q.createNode(o,c,f,p)},rename(o,c,f){if(R.isDir(o.mode)){var p;try{p=R.lookupNode(c,f)}catch{}if(p)for(var _ in p.contents)throw new R.ErrnoError(55)}delete o.parent.contents[o.name],o.parent.timestamp=Date.now(),o.name=f,c.contents[f]=o,c.timestamp=o.parent.timestamp,o.parent=c},unlink(o,c){delete o.contents[c],o.timestamp=Date.now()},rmdir(o,c){var f=R.lookupNode(o,c);for(var p in f.contents)throw new R.ErrnoError(55);delete o.contents[c],o.timestamp=Date.now()},readdir(o){var c=[".",".."];for(var f in o.contents)o.contents.hasOwnProperty(f)&&c.push(f);return c},symlink(o,c,f){var p=q.createNode(o,c,41471,0);return p.link=f,p},readlink(o){if(!R.isLink(o.mode))throw new R.ErrnoError(28);return o.link}},stream_ops:{read(o,c,f,p,_){var y=o.node.contents;if(_>=o.node.usedBytes)return 0;var x=Math.min(o.node.usedBytes-_,p);if(x>8&&y.subarray)c.set(y.subarray(_,_+x),f);else for(var C=0;C0||f+c>>0)}return{ptr:y,allocated:x}},msync(o,c,f,p,_){return q.stream_ops.write(o,c,0,p,f,!1),0}}},S=(o,c,f,p)=>{var _=`al ${o}`;F(o,y=>{Ae(y,`Loading data file "${o}" failed (no arrayBuffer).`),c(new Uint8Array(y)),_&&Le()},y=>{if(f)f();else throw`Loading data file "${o}" failed.`}),_&&ke()},I=(o,c,f,p,_,y)=>R.createDataFile(o,c,f,p,_,y),k=u.preloadPlugins||[],W=(o,c,f,p)=>{typeof Browser<"u"&&Browser.init();var _=!1;return k.forEach(y=>{_||y.canHandle(c)&&(y.handle(o,c,f,p),_=!0)}),_},te=(o,c,f,p,_,y,x,C,U,H)=>{var K=c?Ci.resolve(Nt.join2(o,c)):o;function se(he){function ye(ze){H&&H(),C||I(o,c,ze,p,_,U),y&&y(),Le()}W(he,K,ye,()=>{x&&x(),Le()})||ye(he)}ke(),typeof f=="string"?S(f,he=>se(he),x):se(f)},Q=o=>{var c={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},f=c[o];if(typeof f>"u")throw new Error(`Unknown file open mode: ${o}`);return f},le=(o,c)=>{var f=0;return o&&(f|=365),c&&(f|=146),f},R={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(o,c={}){if(o=Ci.resolve(o),!o)return{path:"",node:null};var f={follow_mount:!0,recurse_count:0};if(c=Object.assign(f,c),c.recurse_count>8)throw new R.ErrnoError(32);for(var p=o.split("/").filter(se=>!!se),_=R.root,y="/",x=0;x40)throw new R.ErrnoError(32)}}return{path:y,node:_}},getPath(o){for(var c;;){if(R.isRoot(o)){var f=o.mount.mountpoint;return c?f[f.length-1]!=="/"?`${f}/${c}`:f+c:f}c=c?`${o.name}/${c}`:o.name,o=o.parent}},hashName(o,c){for(var f=0,p=0;p>>0)%R.nameTable.length},hashAddNode(o){var c=R.hashName(o.parent.id,o.name);o.name_next=R.nameTable[c],R.nameTable[c]=o},hashRemoveNode(o){var c=R.hashName(o.parent.id,o.name);if(R.nameTable[c]===o)R.nameTable[c]=o.name_next;else for(var f=R.nameTable[c];f;){if(f.name_next===o){f.name_next=o.name_next;break}f=f.name_next}},lookupNode(o,c){var f=R.mayLookup(o);if(f)throw new R.ErrnoError(f,o);for(var p=R.hashName(o.id,c),_=R.nameTable[p];_;_=_.name_next){var y=_.name;if(_.parent.id===o.id&&y===c)return _}return R.lookup(o,c)},createNode(o,c,f,p){var _=new R.FSNode(o,c,f,p);return R.hashAddNode(_),_},destroyNode(o){R.hashRemoveNode(o)},isRoot(o){return o===o.parent},isMountpoint(o){return!!o.mounted},isFile(o){return(o&61440)===32768},isDir(o){return(o&61440)===16384},isLink(o){return(o&61440)===40960},isChrdev(o){return(o&61440)===8192},isBlkdev(o){return(o&61440)===24576},isFIFO(o){return(o&61440)===4096},isSocket(o){return(o&49152)===49152},flagsToPermissionString(o){var c=["r","w","rw"][o&3];return o&512&&(c+="w"),c},nodePermissions(o,c){return R.ignorePermissions?0:c.includes("r")&&!(o.mode&292)||c.includes("w")&&!(o.mode&146)||c.includes("x")&&!(o.mode&73)?2:0},mayLookup(o){var c=R.nodePermissions(o,"x");return c||(o.node_ops.lookup?0:2)},mayCreate(o,c){try{var f=R.lookupNode(o,c);return 20}catch{}return R.nodePermissions(o,"wx")},mayDelete(o,c,f){var p;try{p=R.lookupNode(o,c)}catch(y){return y.errno}var _=R.nodePermissions(o,"wx");if(_)return _;if(f){if(!R.isDir(p.mode))return 54;if(R.isRoot(p)||R.getPath(p)===R.cwd())return 10}else if(R.isDir(p.mode))return 31;return 0},mayOpen(o,c){return o?R.isLink(o.mode)?32:R.isDir(o.mode)&&(R.flagsToPermissionString(c)!=="r"||c&512)?31:R.nodePermissions(o,R.flagsToPermissionString(c)):44},MAX_OPEN_FDS:4096,nextfd(){for(var o=0;o<=R.MAX_OPEN_FDS;o++)if(!R.streams[o])return o;throw new R.ErrnoError(33)},getStreamChecked(o){var c=R.getStream(o);if(!c)throw new R.ErrnoError(8);return c},getStream:o=>R.streams[o],createStream(o,c=-1){return R.FSStream||(R.FSStream=function(){this.shared={}},R.FSStream.prototype={},Object.defineProperties(R.FSStream.prototype,{object:{get(){return this.node},set(f){this.node=f}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(f){this.shared.flags=f}},position:{get(){return this.shared.position},set(f){this.shared.position=f}}})),o=Object.assign(new R.FSStream,o),c==-1&&(c=R.nextfd()),o.fd=c,R.streams[c]=o,o},closeStream(o){R.streams[o]=null},chrdev_stream_ops:{open(o){var c=R.getDevice(o.node.rdev);o.stream_ops=c.stream_ops,o.stream_ops.open&&o.stream_ops.open(o)},llseek(){throw new R.ErrnoError(70)}},major:o=>o>>8,minor:o=>o&255,makedev:(o,c)=>o<<8|c,registerDevice(o,c){R.devices[o]={stream_ops:c}},getDevice:o=>R.devices[o],getMounts(o){for(var c=[],f=[o];f.length;){var p=f.pop();c.push(p),f.push.apply(f,p.mounts)}return c},syncfs(o,c){typeof o=="function"&&(c=o,o=!1),R.syncFSRequests++,R.syncFSRequests>1&&me(`warning: ${R.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var f=R.getMounts(R.root.mount),p=0;function _(x){return R.syncFSRequests--,c(x)}function y(x){if(x)return y.errored?void 0:(y.errored=!0,_(x));++p>=f.length&&_(null)}f.forEach(x=>{if(!x.type.syncfs)return y(null);x.type.syncfs(x,o,y)})},mount(o,c,f){var p=f==="/",_=!f,y;if(p&&R.root)throw new R.ErrnoError(10);if(!p&&!_){var x=R.lookupPath(f,{follow_mount:!1});if(f=x.path,y=x.node,R.isMountpoint(y))throw new R.ErrnoError(10);if(!R.isDir(y.mode))throw new R.ErrnoError(54)}var C={type:o,opts:c,mountpoint:f,mounts:[]},U=o.mount(C);return U.mount=C,C.root=U,p?R.root=U:y&&(y.mounted=C,y.mount&&y.mount.mounts.push(C)),U},unmount(o){var c=R.lookupPath(o,{follow_mount:!1});if(!R.isMountpoint(c.node))throw new R.ErrnoError(28);var f=c.node,p=f.mounted,_=R.getMounts(p);Object.keys(R.nameTable).forEach(x=>{for(var C=R.nameTable[x];C;){var U=C.name_next;_.includes(C.mount)&&R.destroyNode(C),C=U}}),f.mounted=null;var y=f.mount.mounts.indexOf(p);f.mount.mounts.splice(y,1)},lookup(o,c){return o.node_ops.lookup(o,c)},mknod(o,c,f){var p=R.lookupPath(o,{parent:!0}),_=p.node,y=Nt.basename(o);if(!y||y==="."||y==="..")throw new R.ErrnoError(28);var x=R.mayCreate(_,y);if(x)throw new R.ErrnoError(x);if(!_.node_ops.mknod)throw new R.ErrnoError(63);return _.node_ops.mknod(_,y,c,f)},create(o,c){return c=c!==void 0?c:438,c&=4095,c|=32768,R.mknod(o,c,0)},mkdir(o,c){return c=c!==void 0?c:511,c&=1023,c|=16384,R.mknod(o,c,0)},mkdirTree(o,c){for(var f=o.split("/"),p="",_=0;_"u"&&(f=c,c=438),c|=8192,R.mknod(o,c,f)},symlink(o,c){if(!Ci.resolve(o))throw new R.ErrnoError(44);var f=R.lookupPath(c,{parent:!0}),p=f.node;if(!p)throw new R.ErrnoError(44);var _=Nt.basename(c),y=R.mayCreate(p,_);if(y)throw new R.ErrnoError(y);if(!p.node_ops.symlink)throw new R.ErrnoError(63);return p.node_ops.symlink(p,_,o)},rename(o,c){var f=Nt.dirname(o),p=Nt.dirname(c),_=Nt.basename(o),y=Nt.basename(c),x,C,U;if(x=R.lookupPath(o,{parent:!0}),C=x.node,x=R.lookupPath(c,{parent:!0}),U=x.node,!C||!U)throw new R.ErrnoError(44);if(C.mount!==U.mount)throw new R.ErrnoError(75);var H=R.lookupNode(C,_),K=Ci.relative(o,p);if(K.charAt(0)!==".")throw new R.ErrnoError(28);if(K=Ci.relative(c,f),K.charAt(0)!==".")throw new R.ErrnoError(55);var se;try{se=R.lookupNode(U,y)}catch{}if(H!==se){var he=R.isDir(H.mode),ye=R.mayDelete(C,_,he);if(ye)throw new R.ErrnoError(ye);if(ye=se?R.mayDelete(U,y,he):R.mayCreate(U,y),ye)throw new R.ErrnoError(ye);if(!C.node_ops.rename)throw new R.ErrnoError(63);if(R.isMountpoint(H)||se&&R.isMountpoint(se))throw new R.ErrnoError(10);if(U!==C&&(ye=R.nodePermissions(C,"w"),ye))throw new R.ErrnoError(ye);R.hashRemoveNode(H);try{C.node_ops.rename(H,U,y)}catch(ze){throw ze}finally{R.hashAddNode(H)}}},rmdir(o){var c=R.lookupPath(o,{parent:!0}),f=c.node,p=Nt.basename(o),_=R.lookupNode(f,p),y=R.mayDelete(f,p,!0);if(y)throw new R.ErrnoError(y);if(!f.node_ops.rmdir)throw new R.ErrnoError(63);if(R.isMountpoint(_))throw new R.ErrnoError(10);f.node_ops.rmdir(f,p),R.destroyNode(_)},readdir(o){var c=R.lookupPath(o,{follow:!0}),f=c.node;if(!f.node_ops.readdir)throw new R.ErrnoError(54);return f.node_ops.readdir(f)},unlink(o){var c=R.lookupPath(o,{parent:!0}),f=c.node;if(!f)throw new R.ErrnoError(44);var p=Nt.basename(o),_=R.lookupNode(f,p),y=R.mayDelete(f,p,!1);if(y)throw new R.ErrnoError(y);if(!f.node_ops.unlink)throw new R.ErrnoError(63);if(R.isMountpoint(_))throw new R.ErrnoError(10);f.node_ops.unlink(f,p),R.destroyNode(_)},readlink(o){var c=R.lookupPath(o),f=c.node;if(!f)throw new R.ErrnoError(44);if(!f.node_ops.readlink)throw new R.ErrnoError(28);return Ci.resolve(R.getPath(f.parent),f.node_ops.readlink(f))},stat(o,c){var f=R.lookupPath(o,{follow:!c}),p=f.node;if(!p)throw new R.ErrnoError(44);if(!p.node_ops.getattr)throw new R.ErrnoError(63);return p.node_ops.getattr(p)},lstat(o){return R.stat(o,!0)},chmod(o,c,f){var p;if(typeof o=="string"){var _=R.lookupPath(o,{follow:!f});p=_.node}else p=o;if(!p.node_ops.setattr)throw new R.ErrnoError(63);p.node_ops.setattr(p,{mode:c&4095|p.mode&-4096,timestamp:Date.now()})},lchmod(o,c){R.chmod(o,c,!0)},fchmod(o,c){var f=R.getStreamChecked(o);R.chmod(f.node,c)},chown(o,c,f,p){var _;if(typeof o=="string"){var y=R.lookupPath(o,{follow:!p});_=y.node}else _=o;if(!_.node_ops.setattr)throw new R.ErrnoError(63);_.node_ops.setattr(_,{timestamp:Date.now()})},lchown(o,c,f){R.chown(o,c,f,!0)},fchown(o,c,f){var p=R.getStreamChecked(o);R.chown(p.node,c,f)},truncate(o,c){if(c<0)throw new R.ErrnoError(28);var f;if(typeof o=="string"){var p=R.lookupPath(o,{follow:!0});f=p.node}else f=o;if(!f.node_ops.setattr)throw new R.ErrnoError(63);if(R.isDir(f.mode))throw new R.ErrnoError(31);if(!R.isFile(f.mode))throw new R.ErrnoError(28);var _=R.nodePermissions(f,"w");if(_)throw new R.ErrnoError(_);f.node_ops.setattr(f,{size:c,timestamp:Date.now()})},ftruncate(o,c){var f=R.getStreamChecked(o);if(!(f.flags&2097155))throw new R.ErrnoError(28);R.truncate(f.node,c)},utime(o,c,f){var p=R.lookupPath(o,{follow:!0}),_=p.node;_.node_ops.setattr(_,{timestamp:Math.max(c,f)})},open(o,c,f){if(o==="")throw new R.ErrnoError(44);c=typeof c=="string"?Q(c):c,f=typeof f>"u"?438:f,c&64?f=f&4095|32768:f=0;var p;if(typeof o=="object")p=o;else{o=Nt.normalize(o);try{var _=R.lookupPath(o,{follow:!(c&131072)});p=_.node}catch{}}var y=!1;if(c&64)if(p){if(c&128)throw new R.ErrnoError(20)}else p=R.mknod(o,f,0),y=!0;if(!p)throw new R.ErrnoError(44);if(R.isChrdev(p.mode)&&(c&=-513),c&65536&&!R.isDir(p.mode))throw new R.ErrnoError(54);if(!y){var x=R.mayOpen(p,c);if(x)throw new R.ErrnoError(x)}c&512&&!y&&R.truncate(p,0),c&=-131713;var C=R.createStream({node:p,path:R.getPath(p),flags:c,seekable:!0,position:0,stream_ops:p.stream_ops,ungotten:[],error:!1});return C.stream_ops.open&&C.stream_ops.open(C),u.logReadFiles&&!(c&1)&&(R.readFiles||(R.readFiles={}),o in R.readFiles||(R.readFiles[o]=1)),C},close(o){if(R.isClosed(o))throw new R.ErrnoError(8);o.getdents&&(o.getdents=null);try{o.stream_ops.close&&o.stream_ops.close(o)}catch(c){throw c}finally{R.closeStream(o.fd)}o.fd=null},isClosed(o){return o.fd===null},llseek(o,c,f){if(R.isClosed(o))throw new R.ErrnoError(8);if(!o.seekable||!o.stream_ops.llseek)throw new R.ErrnoError(70);if(f!=0&&f!=1&&f!=2)throw new R.ErrnoError(28);return o.position=o.stream_ops.llseek(o,c,f),o.ungotten=[],o.position},read(o,c,f,p,_){if(p<0||_<0)throw new R.ErrnoError(28);if(R.isClosed(o))throw new R.ErrnoError(8);if((o.flags&2097155)===1)throw new R.ErrnoError(8);if(R.isDir(o.node.mode))throw new R.ErrnoError(31);if(!o.stream_ops.read)throw new R.ErrnoError(28);var y=typeof _<"u";if(!y)_=o.position;else if(!o.seekable)throw new R.ErrnoError(70);var x=o.stream_ops.read(o,c,f,p,_);return y||(o.position+=x),x},write(o,c,f,p,_,y){if(p<0||_<0)throw new R.ErrnoError(28);if(R.isClosed(o))throw new R.ErrnoError(8);if(!(o.flags&2097155))throw new R.ErrnoError(8);if(R.isDir(o.node.mode))throw new R.ErrnoError(31);if(!o.stream_ops.write)throw new R.ErrnoError(28);o.seekable&&o.flags&1024&&R.llseek(o,0,2);var x=typeof _<"u";if(!x)_=o.position;else if(!o.seekable)throw new R.ErrnoError(70);var C=o.stream_ops.write(o,c,f,p,_,y);return x||(o.position+=C),C},allocate(o,c,f){if(R.isClosed(o))throw new R.ErrnoError(8);if(c<0||f<=0)throw new R.ErrnoError(28);if(!(o.flags&2097155))throw new R.ErrnoError(8);if(!R.isFile(o.node.mode)&&!R.isDir(o.node.mode))throw new R.ErrnoError(43);if(!o.stream_ops.allocate)throw new R.ErrnoError(138);o.stream_ops.allocate(o,c,f)},mmap(o,c,f,p,_){if(p&2&&!(_&2)&&(o.flags&2097155)!==2)throw new R.ErrnoError(2);if((o.flags&2097155)===1)throw new R.ErrnoError(2);if(!o.stream_ops.mmap)throw new R.ErrnoError(43);return o.stream_ops.mmap(o,c,f,p,_)},msync(o,c,f,p,_){return o.stream_ops.msync?o.stream_ops.msync(o,c,f,p,_):0},munmap:o=>0,ioctl(o,c,f){if(!o.stream_ops.ioctl)throw new R.ErrnoError(59);return o.stream_ops.ioctl(o,c,f)},readFile(o,c={}){if(c.flags=c.flags||0,c.encoding=c.encoding||"binary",c.encoding!=="utf8"&&c.encoding!=="binary")throw new Error(`Invalid encoding type "${c.encoding}"`);var f,p=R.open(o,c.flags),_=R.stat(o),y=_.size,x=new Uint8Array(y);return R.read(p,x,0,y,0),c.encoding==="utf8"?f=Ri(x,0):c.encoding==="binary"&&(f=x),R.close(p),f},writeFile(o,c,f={}){f.flags=f.flags||577;var p=R.open(o,f.flags,f.mode);if(typeof c=="string"){var _=new Uint8Array(Qi(c)+1),y=xs(c,_,0,_.length);R.write(p,_,0,y,void 0,f.canOwn)}else if(ArrayBuffer.isView(c))R.write(p,c,0,c.byteLength,void 0,f.canOwn);else throw new Error("Unsupported data type");R.close(p)},cwd:()=>R.currentPath,chdir(o){var c=R.lookupPath(o,{follow:!0});if(c.node===null)throw new R.ErrnoError(44);if(!R.isDir(c.node.mode))throw new R.ErrnoError(54);var f=R.nodePermissions(c.node,"x");if(f)throw new R.ErrnoError(f);R.currentPath=c.path},createDefaultDirectories(){R.mkdir("/tmp"),R.mkdir("/home"),R.mkdir("/home/web_user")},createDefaultDevices(){R.mkdir("/dev"),R.registerDevice(R.makedev(1,3),{read:()=>0,write:(p,_,y,x,C)=>x}),R.mkdev("/dev/null",R.makedev(1,3)),Ji.register(R.makedev(5,0),Ji.default_tty_ops),Ji.register(R.makedev(6,0),Ji.default_tty1_ops),R.mkdev("/dev/tty",R.makedev(5,0)),R.mkdev("/dev/tty1",R.makedev(6,0));var o=new Uint8Array(1024),c=0,f=()=>(c===0&&(c=ys(o).byteLength),o[--c]);R.createDevice("/dev","random",f),R.createDevice("/dev","urandom",f),R.mkdir("/dev/shm"),R.mkdir("/dev/shm/tmp")},createSpecialDirectories(){R.mkdir("/proc");var o=R.mkdir("/proc/self");R.mkdir("/proc/self/fd"),R.mount({mount(){var c=R.createNode(o,"fd",16895,73);return c.node_ops={lookup(f,p){var _=+p,y=R.getStreamChecked(_),x={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>y.path}};return x.parent=x,x}},c}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?R.createDevice("/dev","stdin",u.stdin):R.symlink("/dev/tty","/dev/stdin"),u.stdout?R.createDevice("/dev","stdout",null,u.stdout):R.symlink("/dev/tty","/dev/stdout"),u.stderr?R.createDevice("/dev","stderr",null,u.stderr):R.symlink("/dev/tty1","/dev/stderr"),R.open("/dev/stdin",0),R.open("/dev/stdout",1),R.open("/dev/stderr",1)},ensureErrnoError(){R.ErrnoError||(R.ErrnoError=function(c,f){this.name="ErrnoError",this.node=f,this.setErrno=function(p){this.errno=p},this.setErrno(c),this.message="FS error"},R.ErrnoError.prototype=new Error,R.ErrnoError.prototype.constructor=R.ErrnoError,[44].forEach(o=>{R.genericErrors[o]=new R.ErrnoError(o),R.genericErrors[o].stack=""}))},staticInit(){R.ensureErrnoError(),R.nameTable=new Array(4096),R.mount(q,{},"/"),R.createDefaultDirectories(),R.createDefaultDevices(),R.createSpecialDirectories(),R.filesystems={MEMFS:q}},init(o,c,f){R.init.initialized=!0,R.ensureErrnoError(),u.stdin=o||u.stdin,u.stdout=c||u.stdout,u.stderr=f||u.stderr,R.createStandardStreams()},quit(){R.init.initialized=!1;for(var o=0;othis.length-1||ye<0)){var ze=ye%this.chunkSize,Ke=ye/this.chunkSize|0;return this.getter(Ke)[ze]}},y.prototype.setDataGetter=function(ye){this.getter=ye},y.prototype.cacheLength=function(){var ye=new XMLHttpRequest;if(ye.open("HEAD",f,!1),ye.send(null),!(ye.status>=200&&ye.status<300||ye.status===304))throw new Error("Couldn't load "+f+". Status: "+ye.status);var ze=Number(ye.getResponseHeader("Content-length")),Ke,at=(Ke=ye.getResponseHeader("Accept-Ranges"))&&Ke==="bytes",dt=(Ke=ye.getResponseHeader("Content-Encoding"))&&Ke==="gzip",Re=1024*1024;at||(Re=ze);var je=(zt,ci)=>{if(zt>ci)throw new Error("invalid range ("+zt+", "+ci+") or no bytes requested!");if(ci>ze-1)throw new Error("only "+ze+" bytes available! programmer error!");var hn=new XMLHttpRequest;if(hn.open("GET",f,!1),ze!==Re&&hn.setRequestHeader("Range","bytes="+zt+"-"+ci),hn.responseType="arraybuffer",hn.overrideMimeType&&hn.overrideMimeType("text/plain; charset=x-user-defined"),hn.send(null),!(hn.status>=200&&hn.status<300||hn.status===304))throw new Error("Couldn't load "+f+". Status: "+hn.status);return hn.response!==void 0?new Uint8Array(hn.response||[]):Xr(hn.responseText||"",!0)},dn=this;dn.setDataGetter(zt=>{var ci=zt*Re,hn=(zt+1)*Re-1;if(hn=Math.min(hn,ze-1),typeof dn.chunks[zt]>"u"&&(dn.chunks[zt]=je(ci,hn)),typeof dn.chunks[zt]>"u")throw new Error("doXHR failed!");return dn.chunks[zt]}),(dt||!ze)&&(Re=ze=1,ze=this.getter(0).length,Re=ze,de("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=ze,this._chunkSize=Re,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!A)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var x=new y;Object.defineProperties(x,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var C={isDevice:!1,contents:x}}else var C={isDevice:!1,url:f};var U=R.createFile(o,c,C,p,_);C.contents?U.contents=C.contents:C.url&&(U.contents=null,U.url=C.url),Object.defineProperties(U,{usedBytes:{get:function(){return this.contents.length}}});var H={},K=Object.keys(U.stream_ops);K.forEach(he=>{var ye=U.stream_ops[he];H[he]=function(){return R.forceLoadFile(U),ye.apply(null,arguments)}});function se(he,ye,ze,Ke,at){var dt=he.node.contents;if(at>=dt.length)return 0;var Re=Math.min(dt.length-at,Ke);if(dt.slice)for(var je=0;je(R.forceLoadFile(U),se(he,ye,ze,Ke,at)),H.mmap=(he,ye,ze,Ke,at)=>{R.forceLoadFile(U);var dt=z(ye);if(!dt)throw new R.ErrnoError(48);return se(he,i(),dt,ye,ze),{ptr:dt,allocated:!0}},U.stream_ops=H,U}},fe=(o,c)=>(o>>>=0,o?Ri(r(),o,c):""),J={DEFAULT_POLLMASK:5,calculateAt(o,c,f){if(Nt.isAbs(c))return c;var p;if(o===-100)p=R.cwd();else{var _=J.getStreamFromFD(o);p=_.path}if(c.length==0){if(!f)throw new R.ErrnoError(44);return p}return Nt.join2(p,c)},doStat(o,c,f){try{var p=o(c)}catch(C){if(C&&C.node&&Nt.normalize(c)!==Nt.normalize(R.getPath(C.node)))return-54;throw C}l()[f>>>2>>>0]=p.dev,l()[f+4>>>2>>>0]=p.mode,d()[f+8>>>2>>>0]=p.nlink,l()[f+12>>>2>>>0]=p.uid,l()[f+16>>>2>>>0]=p.gid,l()[f+20>>>2>>>0]=p.rdev,it=[p.size>>>0,(Ie=p.size,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+24>>>2>>>0]=it[0],l()[f+28>>>2>>>0]=it[1],l()[f+32>>>2>>>0]=4096,l()[f+36>>>2>>>0]=p.blocks;var _=p.atime.getTime(),y=p.mtime.getTime(),x=p.ctime.getTime();return it=[Math.floor(_/1e3)>>>0,(Ie=Math.floor(_/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+40>>>2>>>0]=it[0],l()[f+44>>>2>>>0]=it[1],d()[f+48>>>2>>>0]=_%1e3*1e3,it=[Math.floor(y/1e3)>>>0,(Ie=Math.floor(y/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+56>>>2>>>0]=it[0],l()[f+60>>>2>>>0]=it[1],d()[f+64>>>2>>>0]=y%1e3*1e3,it=[Math.floor(x/1e3)>>>0,(Ie=Math.floor(x/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+72>>>2>>>0]=it[0],l()[f+76>>>2>>>0]=it[1],d()[f+80>>>2>>>0]=x%1e3*1e3,it=[p.ino>>>0,(Ie=p.ino,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+88>>>2>>>0]=it[0],l()[f+92>>>2>>>0]=it[1],0},doMsync(o,c,f,p,_){if(!R.isFile(c.node.mode))throw new R.ErrnoError(43);if(p&2)return 0;var y=r().slice(o,o+f);R.msync(c,y,_,f,p)},varargs:void 0,get(){var o=l()[+J.varargs>>>2>>>0];return J.varargs+=4,o},getp(){return J.get()},getStr(o){var c=fe(o);return c},getStreamFromFD(o){var c=R.getStreamChecked(o);return c}};function be(o){if(P)return Vt(0,1,o);_e=o,ii()||(Ee.terminateAllThreads(),u.onExit&&u.onExit(o),pe=!0),M(o,new Ce(o))}var Fe=(o,c)=>{if(_e=o,P)throw qe(o),"unwind";be(o)},Oe=Fe,We=o=>{if(o instanceof Ce||o=="unwind")return _e;M(1,o)},Ee={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){P?Ee.initWorker():Ee.initMainThread()},initMainThread(){for(var o=10;o--;)Ee.allocateUnusedWorker();yt(()=>{ke(),Ee.loadWasmModuleToAllWorkers(()=>Le())})},initWorker(){Ht=!1},setExitStatus:o=>{_e=o},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var o of Ee.runningWorkers)Ge(o);for(var o of Ee.unusedWorkers)Ge(o);Ee.unusedWorkers=[],Ee.runningWorkers=[],Ee.pthreads=[]},returnWorkerToPool:o=>{var c=o.pthread_ptr;delete Ee.pthreads[c],Ee.unusedWorkers.push(o),Ee.runningWorkers.splice(Ee.runningWorkers.indexOf(o),1),o.pthread_ptr=0,gf(c)},receiveObjectTransfer(o){},threadInitTLS(){Ee.tlsInitFunctions.forEach(o=>o())},loadWasmModuleToWorker:o=>new Promise(c=>{o.onmessage=y=>{var x=y.data,C=x.cmd;if(x.targetThread&&x.targetThread!=pu()){var U=Ee.pthreads[x.targetThread];U?U.postMessage(x,x.transferList):me(`Internal error! Worker sent a message "${C}" to target pthread ${x.targetThread}, but that thread no longer exists!`);return}C==="checkMailbox"?uu():C==="spawnThread"?Ot(x):C==="cleanupThread"?un(x.thread):C==="killThread"?gt(x.thread):C==="cancelThread"?Pt(x.thread):C==="loaded"?(o.loaded=!0,E&&!o.pthread_ptr&&o.unref(),c(o)):C==="alert"?alert(`Thread ${x.threadId}: ${x.text}`):x.target==="setimmediate"?o.postMessage(x):C==="callHandler"?u[x.handler](...x.args):C&&me(`worker sent an unknown command ${C}`)},o.onerror=y=>{var x="worker sent an error!";throw me(`${x} ${y.filename}:${y.lineno}: ${y.message}`),y},E&&(o.on("message",y=>o.onmessage({data:y})),o.on("error",y=>o.onerror(y)));var f=[],p=["onExit","onAbort","print","printErr"];for(var _ of p)u.hasOwnProperty(_)&&f.push(_);o.postMessage({cmd:"load",handlers:f,urlOrBlob:u.mainScriptUrlOrBlob||e,wasmMemory:ue,wasmModule:Y})}),loadWasmModuleToAllWorkers(o){if(P)return o();Promise.all(Ee.unusedWorkers.map(Ee.loadWasmModuleToWorker)).then(o)},allocateUnusedWorker(){var o,c=O("emHdBindings.worker.js");o=new Worker(c),Ee.unusedWorkers.push(o)},getNewWorker(){return Ee.unusedWorkers.length==0&&(Ee.allocateUnusedWorker(),Ee.loadWasmModuleToWorker(Ee.unusedWorkers[0])),Ee.unusedWorkers.pop()}};u.PThread=Ee;var Te=o=>{for(;o.length>0;)o.shift()(u)},Xe=()=>{var o=pu(),c=d()[o+52>>>2>>>0],f=d()[o+56>>>2>>>0],p=c-f;r0(c,p),xe(c)};u.establishStackSpace=Xe;function qe(o){if(P)return Vt(1,0,o);Oe(o)}var Tt=(o,c)=>{var f=(_=>yf.apply(null,[o,_]))(c);function p(_){ii()?Ee.setExitStatus(_):_f(_)}p(f)};u.invokeEntryPoint=Tt;var Ht=u.noExitRuntime||!0,en=o=>{Ee.tlsInitFunctions.push(o)},Bt=(o,c)=>c+2097152>>>0<4194305-!!o?(o>>>0)+c*4294967296:NaN,pt=function(o,c){return o>>>=0,(f=>vf.apply(null,[o,f]))(c)},Gt=[],In=0;function Xt(o){o>>>=0;var c=new Qn(o);return c.get_caught()||(c.set_caught(!0),In--),c.set_rethrown(!1),Gt.push(c),o0(c.excPtr),c.get_exception_ptr()}var St=0,Zt=()=>{we(0,0);var o=Gt.pop();a0(o.excPtr),St=0};function Qn(o){this.excPtr=o,this.ptr=o-24,this.set_type=function(c){d()[this.ptr+4>>>2>>>0]=c},this.get_type=function(){return d()[this.ptr+4>>>2>>>0]},this.set_destructor=function(c){d()[this.ptr+8>>>2>>>0]=c},this.get_destructor=function(){return d()[this.ptr+8>>>2>>>0]},this.set_caught=function(c){c=c?1:0,i()[this.ptr+12>>>0>>>0]=c},this.get_caught=function(){return i()[this.ptr+12>>>0>>>0]!=0},this.set_rethrown=function(c){c=c?1:0,i()[this.ptr+13>>>0>>>0]=c},this.get_rethrown=function(){return i()[this.ptr+13>>>0>>>0]!=0},this.init=function(c,f){this.set_adjusted_ptr(0),this.set_type(c),this.set_destructor(f)},this.set_adjusted_ptr=function(c){d()[this.ptr+16>>>2>>>0]=c},this.get_adjusted_ptr=function(){return d()[this.ptr+16>>>2>>>0]},this.get_exception_ptr=function(){var c=c0(this.get_type());if(c)return d()[this.excPtr>>>2>>>0];var f=this.get_adjusted_ptr();return f!==0?f:this.excPtr}}function sa(o){throw o>>>=0,St||(St=o),St}var Pi=o=>{var c=St;if(!c)return El(0),0;var f=new Qn(c);f.set_adjusted_ptr(c);var p=f.get_type();if(!p)return El(0),c;for(var _ in o){var y=o[_];if(y===0||y===p)break;var x=f.ptr+16;if(l0(y,p,x))return El(y),c}return El(p),c};function za(){return Pi([])}function vT(o){return o>>>=0,Pi([o])}function yT(o,c){return o>>>=0,c>>>=0,Pi([o,c])}function bT(o){o>>>=0;var c=new Qn(o).get_exception_ptr();return c}var $_=()=>{var o=Gt.pop();o||lt("no exception to throw");var c=o.excPtr;throw o.get_rethrown()||(Gt.push(o),o.set_rethrown(!0),o.set_caught(!1),In++),St=c,St};function xT(o){if(o>>>=0,!!o){var c=new Qn(o);Gt.push(c),c.set_rethrown(!0),$_()}}function wT(o,c,f){o>>>=0,c>>>=0,f>>>=0;var p=new Qn(o);throw p.init(c,f),St=o,In++,St}var ST=()=>In;function MT(o){o>>>=0,e0(o,!A,1,!b,2097152,!1),Ee.threadInitTLS()}function ET(o){o>>>=0,P?postMessage({cmd:"cleanupThread",thread:o}):un(o)}function q_(o,c,f,p){return P?Vt(2,1,o,c,f,p):K_(o,c,f,p)}function K_(o,c,f,p){if(o>>>=0,c>>>=0,f>>>=0,p>>>=0,typeof SharedArrayBuffer>"u")return me("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],y=0;if(P&&(_.length===0||y))return q_(o,c,f,p);var x={startRoutine:f,pthread_ptr:o,arg:p,transferList:_};return P?(x.cmd="spawnThread",postMessage(x,_),0):Ot(x)}function Z_(o,c){if(P)return Vt(3,1,o,c);o>>>=0;try{return o=J.getStr(o),R.chmod(o,c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Q_(o,c,f,p){if(P)return Vt(4,1,o,c,f,p);c>>>=0;try{if(c=J.getStr(c),c=J.calculateAt(o,c),f&-8)return-28;var _=R.lookupPath(c,{follow:!0}),y=_.node;if(!y)return-44;var x="";return f&4&&(x+="r"),f&2&&(x+="w"),f&1&&(x+="x"),x&&R.nodePermissions(y,x)?-2:0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function J_(o,c,f,p){return P?Vt(5,0,o,c,f,p):0}function ev(o,c){if(P)return Vt(6,1,o,c);try{return R.fchmod(o,c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var TT=o=>(l()[Zv()>>>2>>>0]=o,o);function tv(o,c,f){if(P)return Vt(7,1,o,c,f);f>>>=0,J.varargs=f;try{var p=J.getStreamFromFD(o);switch(c){case 0:{var _=J.get();if(_<0)return-28;for(;R.streams[_];)_++;var y;return y=R.createStream(p,_),y.fd}case 1:case 2:return 0;case 3:return p.flags;case 4:{var _=J.get();return p.flags|=_,0}case 5:{var _=J.getp(),x=0;return s()[_+x>>>1>>>0]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return TT(28),-1;default:return-28}}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function nv(o,c){if(P)return Vt(8,1,o,c);c>>>=0;try{var f=J.getStreamFromFD(o);return J.doStat(R.stat,f.path,c)}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}var Qc=(o,c,f)=>xs(o,r(),c,f);function iv(o,c){if(P)return Vt(9,1,o,c);o>>>=0,c>>>=0;try{if(c===0)return-28;var f=R.cwd(),p=Qi(f)+1;return c"u"||_.name!=="ErrnoError")throw _;return-_.errno}}function rv(o,c,f){if(P)return Vt(10,1,o,c,f);c>>>=0,f>>>=0;try{var p=J.getStreamFromFD(o);p.getdents||(p.getdents=R.readdir(p.path));for(var _=280,y=0,x=R.llseek(p,0,1),C=Math.floor(x/_);C>>0,(Ie=U,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+y>>>2>>>0]=it[0],l()[c+y+4>>>2>>>0]=it[1],it=[(C+1)*_>>>0,(Ie=(C+1)*_,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+y+8>>>2>>>0]=it[0],l()[c+y+12>>>2>>>0]=it[1],s()[c+y+16>>>1>>>0]=280,i()[c+y+18>>>0>>>0]=H,Qc(K,c+y+19,256),y+=_,C+=1}return R.llseek(p,C*_,0),y}catch(ye){if(typeof R>"u"||ye.name!=="ErrnoError")throw ye;return-ye.errno}}function sv(o,c,f){if(P)return Vt(11,1,o,c,f);f>>>=0,J.varargs=f;try{var p=J.getStreamFromFD(o);switch(c){case 21509:return p.tty?0:-59;case 21505:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tcgets){var _=p.tty.ops.ioctl_tcgets(p),y=J.getp();l()[y>>>2>>>0]=_.c_iflag||0,l()[y+4>>>2>>>0]=_.c_oflag||0,l()[y+8>>>2>>>0]=_.c_cflag||0,l()[y+12>>>2>>>0]=_.c_lflag||0;for(var x=0;x<32;x++)i()[y+x+17>>>0>>>0]=_.c_cc[x]||0;return 0}return 0}case 21510:case 21511:case 21512:return p.tty?0:-59;case 21506:case 21507:case 21508:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tcsets){for(var y=J.getp(),C=l()[y>>>2>>>0],U=l()[y+4>>>2>>>0],H=l()[y+8>>>2>>>0],K=l()[y+12>>>2>>>0],se=[],x=0;x<32;x++)se.push(i()[y+x+17>>>0>>>0]);return p.tty.ops.ioctl_tcsets(p.tty,c,{c_iflag:C,c_oflag:U,c_cflag:H,c_lflag:K,c_cc:se})}return 0}case 21519:{if(!p.tty)return-59;var y=J.getp();return l()[y>>>2>>>0]=0,0}case 21520:return p.tty?-28:-59;case 21531:{var y=J.getp();return R.ioctl(p,c,y)}case 21523:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tiocgwinsz){var he=p.tty.ops.ioctl_tiocgwinsz(p.tty),y=J.getp();s()[y>>>1>>>0]=he[0],s()[y+2>>>1>>>0]=he[1]}return 0}case 21524:return p.tty?0:-59;case 21515:return p.tty?0:-59;default:return-28}}catch(ye){if(typeof R>"u"||ye.name!=="ErrnoError")throw ye;return-ye.errno}}function av(o,c){if(P)return Vt(12,1,o,c);o>>>=0,c>>>=0;try{return o=J.getStr(o),J.doStat(R.lstat,o,c)}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function ov(o,c,f){if(P)return Vt(13,1,o,c,f);c>>>=0;try{return c=J.getStr(c),c=J.calculateAt(o,c),c=Nt.normalize(c),c[c.length-1]==="/"&&(c=c.substr(0,c.length-1)),R.mkdir(c,f,0),0}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function lv(o,c,f,p){if(P)return Vt(14,1,o,c,f,p);c>>>=0,f>>>=0;try{c=J.getStr(c);var _=p&256,y=p&4096;return p=p&-6401,c=J.calculateAt(o,c,y),J.doStat(_?R.lstat:R.stat,c,f)}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return-x.errno}}function cv(o,c,f,p){if(P)return Vt(15,1,o,c,f,p);c>>>=0,p>>>=0,J.varargs=p;try{c=J.getStr(c),c=J.calculateAt(o,c);var _=p?J.get():0;return R.open(c,f,_).fd}catch(y){if(typeof R>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function uv(o,c,f,p){if(P)return Vt(16,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{if(c=J.getStr(c),c=J.calculateAt(o,c),p<=0)return-28;var _=R.readlink(c),y=Math.min(p,Qi(_)),x=i()[f+y>>>0];return Qc(_,f,p+1),i()[f+y>>>0]=x,y}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function dv(o,c,f,p){if(P)return Vt(17,1,o,c,f,p);c>>>=0,p>>>=0;try{return c=J.getStr(c),p=J.getStr(p),c=J.calculateAt(o,c),p=J.calculateAt(f,p),R.rename(c,p),0}catch(_){if(typeof R>"u"||_.name!=="ErrnoError")throw _;return-_.errno}}function hv(o,c){if(P)return Vt(18,1,o,c);o>>>=0,c>>>=0;try{return o=J.getStr(o),J.doStat(R.stat,o,c)}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function fv(o,c,f){if(P)return Vt(19,1,o,c,f);c>>>=0;try{return c=J.getStr(c),c=J.calculateAt(o,c),f===0?R.unlink(c):f===512?R.rmdir(c):lt("Invalid flags passed to unlinkat"),0}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function AT(o,c,f,p,_){}var CT=()=>{for(var o=new Array(256),c=0;c<256;++c)o[c]=String.fromCharCode(c);pv=o},pv,Bn=o=>{for(var c="",f=o;r()[f>>>0];)c+=pv[r()[f++>>>0]];return c},Ha={},aa={},Jc={},Ga,Lt=o=>{throw new Ga(o)},mv,eu=o=>{throw new mv(o)},Gi=(o,c,f)=>{o.forEach(function(C){Jc[C]=c});function p(C){var U=f(C);U.length!==o.length&&eu("Mismatched type converter count");for(var H=0;H{aa.hasOwnProperty(C)?_[U]=aa[C]:(y.push(C),Ha.hasOwnProperty(C)||(Ha[C]=[]),Ha[C].push(()=>{_[U]=aa[C],++x,x===y.length&&p(_)}))}),y.length===0&&p(_)};function RT(o,c,f={}){var p=c.name;if(o||Lt(`type "${p}" must have a positive integer typeid pointer`),aa.hasOwnProperty(o)){if(f.ignoreDuplicateRegistrations)return;Lt(`Cannot register type '${p}' twice`)}if(aa[o]=c,delete Jc[o],Ha.hasOwnProperty(o)){var _=Ha[o];delete Ha[o],_.forEach(y=>y())}}function Lr(o,c,f={}){if(!("argPackAdvance"in c))throw new TypeError("registerType registeredInstance requires argPackAdvance");return RT(o,c,f)}var Yr=8;function PT(o,c,f,p){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:function(_){return!!_},toWireType:function(_,y){return y?f:p},argPackAdvance:Yr,readValueFromPointer:function(_){return this.fromWireType(r()[_>>>0])},destructorFunction:null})}var LT=o=>({count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}),Jh=o=>{function c(f){return f.$$.ptrType.registeredClass.name}Lt(c(o)+" instance already deleted")},ef=!1,gv=o=>{},IT=o=>{o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)},_v=o=>{o.count.value-=1;var c=o.count.value===0;c&&IT(o)},vv=(o,c,f)=>{if(c===f)return o;if(f.baseClass===void 0)return null;var p=vv(o,c,f.baseClass);return p===null?null:f.downcast(p)},yv={},DT=()=>Object.keys(yl).length,kT=()=>{var o=[];for(var c in yl)yl.hasOwnProperty(c)&&o.push(yl[c]);return o},_l=[],tf=()=>{for(;_l.length;){var o=_l.pop();o.$$.deleteScheduled=!1,o.delete()}},vl,FT=o=>{vl=o,_l.length&&vl&&vl(tf)},UT=()=>{u.getInheritedInstanceCount=DT,u.getLiveInheritedInstances=kT,u.flushPendingDeletes=tf,u.setDelayFunction=FT},yl={},OT=(o,c)=>{for(c===void 0&&Lt("ptr should not be undefined");o.baseClass;)c=o.upcast(c),o=o.baseClass;return c},NT=(o,c)=>(c=OT(o,c),yl[c]),tu=(o,c)=>{(!c.ptrType||!c.ptr)&&eu("makeClassHandle requires ptr and ptrType");var f=!!c.smartPtrType,p=!!c.smartPtr;return f!==p&&eu("Both smartPtrType and smartPtr must be specified"),c.count={value:1},bl(Object.create(o,{$$:{value:c}}))};function BT(o){var c=this.getPointee(o);if(!c)return this.destructor(o),null;var f=NT(this.registeredClass,c);if(f!==void 0){if(f.$$.count.value===0)return f.$$.ptr=c,f.$$.smartPtr=o,f.clone();var p=f.clone();return this.destructor(o),p}function _(){return this.isSmartPointer?tu(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:c,smartPtrType:this,smartPtr:o}):tu(this.registeredClass.instancePrototype,{ptrType:this,ptr:o})}var y=this.registeredClass.getActualType(c),x=yv[y];if(!x)return _.call(this);var C;this.isConst?C=x.constPointerType:C=x.pointerType;var U=vv(c,this.registeredClass,C.registeredClass);return U===null?_.call(this):this.isSmartPointer?tu(C.registeredClass.instancePrototype,{ptrType:C,ptr:U,smartPtrType:this,smartPtr:o}):tu(C.registeredClass.instancePrototype,{ptrType:C,ptr:U})}var bl=o=>typeof FinalizationRegistry>"u"?(bl=c=>c,o):(ef=new FinalizationRegistry(c=>{_v(c.$$)}),bl=c=>{var f=c.$$,p=!!f.smartPtr;if(p){var _={$$:f};ef.register(c,_,c)}return c},gv=c=>ef.unregister(c),bl(o)),zT=()=>{Object.assign(nu.prototype,{isAliasOf(o){if(!(this instanceof nu)||!(o instanceof nu))return!1;var c=this.$$.ptrType.registeredClass,f=this.$$.ptr;o.$$=o.$$;for(var p=o.$$.ptrType.registeredClass,_=o.$$.ptr;c.baseClass;)f=c.upcast(f),c=c.baseClass;for(;p.baseClass;)_=p.upcast(_),p=p.baseClass;return c===p&&f===_},clone(){if(this.$$.ptr||Jh(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var o=bl(Object.create(Object.getPrototypeOf(this),{$$:{value:LT(this.$$)}}));return o.$$.count.value+=1,o.$$.deleteScheduled=!1,o},delete(){this.$$.ptr||Jh(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Lt("Object already scheduled for deletion"),gv(this),_v(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Jh(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Lt("Object already scheduled for deletion"),_l.push(this),_l.length===1&&vl&&vl(tf),this.$$.deleteScheduled=!0,this}})};function nu(){}var HT=48,GT=57,iu=o=>{if(o===void 0)return"_unknown";o=o.replace(/[^a-zA-Z0-9_]/g,"$");var c=o.charCodeAt(0);return c>=HT&&c<=GT?`_${o}`:o};function ru(o,c){return o=iu(o),{[o]:function(){return c.apply(this,arguments)}}[o]}var nf=(o,c,f)=>{if(o[c].overloadTable===void 0){var p=o[c];o[c]=function(){return o[c].overloadTable.hasOwnProperty(arguments.length)||Lt(`Function '${f}' called with an invalid number of arguments (${arguments.length}) - expects one of (${o[c].overloadTable})!`),o[c].overloadTable[arguments.length].apply(this,arguments)},o[c].overloadTable=[],o[c].overloadTable[p.argCount]=p}},rf=(o,c,f)=>{u.hasOwnProperty(o)?((f===void 0||u[o].overloadTable!==void 0&&u[o].overloadTable[f]!==void 0)&&Lt(`Cannot register public name '${o}' twice`),nf(u,o,o),u.hasOwnProperty(f)&&Lt(`Cannot register multiple overloads of a function with the same number of arguments (${f})!`),u[o].overloadTable[f]=c):(u[o]=c,f!==void 0&&(u[o].numArguments=f))};function VT(o,c,f,p,_,y,x,C){this.name=o,this.constructor=c,this.instancePrototype=f,this.rawDestructor=p,this.baseClass=_,this.getActualType=y,this.upcast=x,this.downcast=C,this.pureVirtualFunctions=[]}var su=(o,c,f)=>{for(;c!==f;)c.upcast||Lt(`Expected null or instance of ${f.name}, got an instance of ${c.name}`),o=c.upcast(o),c=c.baseClass;return o};function WT(o,c){if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`);var f=c.$$.ptrType.registeredClass,p=su(c.$$.ptr,f,this.registeredClass);return p}function jT(o,c){var f;if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),this.isSmartPointer?(f=this.rawConstructor(),o!==null&&o.push(this.rawDestructor,f),f):0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&c.$$.ptrType.isConst&&Lt(`Cannot convert argument of type ${c.$$.smartPtrType?c.$$.smartPtrType.name:c.$$.ptrType.name} to parameter type ${this.name}`);var p=c.$$.ptrType.registeredClass;if(f=su(c.$$.ptr,p,this.registeredClass),this.isSmartPointer)switch(c.$$.smartPtr===void 0&&Lt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:c.$$.smartPtrType===this?f=c.$$.smartPtr:Lt(`Cannot convert argument of type ${c.$$.smartPtrType?c.$$.smartPtrType.name:c.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:f=c.$$.smartPtr;break;case 2:if(c.$$.smartPtrType===this)f=c.$$.smartPtr;else{var _=c.clone();f=this.rawShare(f,Qt.toHandle(()=>_.delete())),o!==null&&o.push(this.rawDestructor,f)}break;default:Lt("Unsupporting sharing policy")}return f}function XT(o,c){if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`),c.$$.ptrType.isConst&&Lt(`Cannot convert argument of type ${c.$$.ptrType.name} to parameter type ${this.name}`);var f=c.$$.ptrType.registeredClass,p=su(c.$$.ptr,f,this.registeredClass);return p}function bv(o){return this.fromWireType(d()[o>>>2>>>0])}var YT=()=>{Object.assign(xl.prototype,{getPointee(o){return this.rawGetPointee&&(o=this.rawGetPointee(o)),o},destructor(o){this.rawDestructor&&this.rawDestructor(o)},argPackAdvance:Yr,readValueFromPointer:bv,deleteObject(o){o!==null&&o.delete()},fromWireType:BT})};function xl(o,c,f,p,_,y,x,C,U,H,K){this.name=o,this.registeredClass=c,this.isReference=f,this.isConst=p,this.isSmartPointer=_,this.pointeeType=y,this.sharingPolicy=x,this.rawGetPointee=C,this.rawConstructor=U,this.rawShare=H,this.rawDestructor=K,!_&&c.baseClass===void 0?p?(this.toWireType=WT,this.destructorFunction=null):(this.toWireType=XT,this.destructorFunction=null):this.toWireType=jT}var xv=(o,c,f)=>{u.hasOwnProperty(o)||eu("Replacing nonexistant public symbol"),u[o].overloadTable!==void 0&&f!==void 0?u[o].overloadTable[f]=c:(u[o]=c,u[o].argCount=f)},$T=(o,c,f)=>{var p=u["dynCall_"+o];return f&&f.length?p.apply(null,[c].concat(f)):p.call(null,c)},qT=(o,c,f)=>{var p=$T(o,c,f);return p},KT=(o,c)=>{var f=[];return function(){return f.length=0,Object.assign(f,arguments),qT(o,c,f)}},li=(o,c)=>{o=Bn(o);function f(){return KT(o,c)}var p=f();return typeof p!="function"&&Lt(`unknown function pointer with signature ${o}: ${c}`),p},ZT=(o,c)=>{var f=ru(c,function(p){this.name=c,this.message=p;var _=new Error(p).stack;_!==void 0&&(this.stack=this.toString()+` +`+_.replace(/^Error(:[^\n]*)?\n/,""))});return f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},f},wv,Sv=o=>{var c=Jv(o),f=Bn(c);return Ir(c),f},$r=(o,c)=>{var f=[],p={};function _(y){if(!p[y]&&!aa[y]){if(Jc[y]){Jc[y].forEach(_);return}f.push(y),p[y]=!0}}throw c.forEach(_),new wv(`${o}: `+f.map(Sv).join([", "]))};function QT(o,c,f,p,_,y,x,C,U,H,K,se,he){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,K>>>=0,se>>>=0,he>>>=0,K=Bn(K),y=li(_,y),C&&(C=li(x,C)),H&&(H=li(U,H)),he=li(se,he);var ye=iu(K);rf(ye,function(){$r(`Cannot construct ${K} due to unbound types`,[p])}),Gi([o,c,f],p?[p]:[],function(ze){ze=ze[0];var Ke,at;p?(Ke=ze.registeredClass,at=Ke.instancePrototype):at=nu.prototype;var dt=ru(ye,function(){if(Object.getPrototypeOf(this)!==Re)throw new Ga("Use 'new' to construct "+K);if(je.constructor_body===void 0)throw new Ga(K+" has no accessible constructor");var hn=je.constructor_body[arguments.length];if(hn===void 0)throw new Ga(`Tried to invoke ctor of ${K} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(je.constructor_body).toString()}) parameters instead!`);return hn.apply(this,arguments)}),Re=Object.create(at,{constructor:{value:dt}});dt.prototype=Re;var je=new VT(K,dt,Re,he,Ke,y,C,H);je.baseClass&&(je.baseClass.__derivedClasses===void 0&&(je.baseClass.__derivedClasses=[]),je.baseClass.__derivedClasses.push(je));var dn=new xl(K,je,!0,!1,!1),zt=new xl(K+"*",je,!1,!1,!1),ci=new xl(K+" const*",je,!1,!0,!1);return yv[o]={pointerType:zt,constPointerType:ci},xv(ye,dt),[dn,zt,ci]})}var au=o=>{for(;o.length;){var c=o.pop(),f=o.pop();f(c)}};function Mv(o,c){if(!(o instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof o} which is not a function`);var f=ru(o.name||"unknownFunctionName",function(){});f.prototype=o.prototype;var p=new f,_=o.apply(p,c);return _ instanceof Object?_:p}var ou=o=>{try{return o()}catch(c){lt(c)}},JT=()=>{if(!ii())try{P?_f(_e):Oe(_e)}catch(o){We(o)}},sf=o=>{if(!pe)try{o(),JT()}catch(c){We(c)}},Ev=()=>{oi+=1},eA=()=>{oi-=1},_t={instrumentWasmImports(o){var c=/^(invoke_.*|__asyncjs__.*)$/;for(var f in o)(function(p){var _=o[p];_.sig,typeof _=="function"&&(_.isAsync||c.test(p))})(f)},instrumentWasmExports(o){var c={};for(var f in o)(function(p){var _=o[p];typeof _=="function"?c[p]=function(){_t.exportCallStack.push(p);try{return _.apply(null,arguments)}finally{if(!pe){var y=_t.exportCallStack.pop();Ae(y===p),_t.maybeStopUnwind()}}}:c[p]=_})(f);return c},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId(o){var c=_t.callStackNameToId[o];return c===void 0&&(c=_t.callStackId++,_t.callStackNameToId[o]=c,_t.callStackIdToName[c]=o),c},maybeStopUnwind(){_t.currData&&_t.state===_t.State.Unwinding&&_t.exportCallStack.length===0&&(_t.state=_t.State.Normal,Ev(),ou(Bb),typeof Fibers<"u"&&Fibers.trampoline())},whenDone(){return new Promise((o,c)=>{_t.asyncPromiseHandlers={resolve:o,reject:c}})},allocateData(){var o=Ml(12+_t.StackSize);return _t.setDataHeader(o,o+12,_t.StackSize),_t.setDataRewindFunc(o),o},setDataHeader(o,c,f){d()[o>>>2>>>0]=c,d()[o+4>>>2>>>0]=c+f},setDataRewindFunc(o){var c=_t.exportCallStack[0],f=_t.getCallStackId(c);l()[o+8>>>2>>>0]=f},getDataRewindFunc(o){var c=l()[o+8>>>2>>>0],f=_t.callStackIdToName[c],p=ne[f];return p},doRewind(o){var c=_t.getDataRewindFunc(o);return eA(),c()},handleSleep(o){if(!pe){if(_t.state===_t.State.Normal){var c=!1,f=!1;o((p=0)=>{if(!pe&&(_t.handleSleepReturnValue=p,c=!0,!!f)){_t.state=_t.State.Rewinding,ou(()=>zb(_t.currData)),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.resume();var _,y=!1;try{_=_t.doRewind(_t.currData)}catch(U){_=U,y=!0}var x=!1;if(!_t.currData){var C=_t.asyncPromiseHandlers;C&&(_t.asyncPromiseHandlers=null,(y?C.reject:C.resolve)(_),x=!0)}if(y&&!x)throw _}}),f=!0,c||(_t.state=_t.State.Unwinding,_t.currData=_t.allocateData(),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.pause(),ou(()=>Nb(_t.currData)))}else _t.state===_t.State.Rewinding?(_t.state=_t.State.Normal,ou(Hb),Ir(_t.currData),_t.currData=null,_t.sleepCallbacks.forEach(p=>sf(p))):lt(`invalid state: ${_t.state}`);return _t.handleSleepReturnValue}},handleAsync(o){return _t.handleSleep(c=>{o().then(c)})}};function lu(o,c,f,p,_,y){var x=c.length;x<2&&Lt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var C=c[1]!==null&&f!==null,U=!1,H=1;H0?", ":"")+he),ye+=(K||y?"var rv = ":"")+"invoker(fn"+(he.length>0?", ":"")+he+`); +`,Ke.push("Asyncify"),at.push(_t),ye+="function onDone("+(K?"rv":"")+`) { +`,U)ye+=`runDestructors(destructors); +`;else for(var H=C?1:2;H{for(var f=[],p=0;p>>2>>>0]);return f},af=o=>{o=o.trim();const c=o.indexOf("(");return c!==-1?(Ae(o[o.length-1]==")","Parentheses for argument names should match."),o.substr(0,c)):o};function tA(o,c,f,p,_,y,x,C){o>>>=0,c>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0;var U=cu(f,p);c=Bn(c),c=af(c),y=li(_,y),Gi([],[o],function(H){H=H[0];var K=`${H.name}.${c}`;function se(){$r(`Cannot call ${K} due to unbound types`,U)}c.startsWith("@@")&&(c=Symbol[c.substring(2)]);var he=H.registeredClass.constructor;return he[c]===void 0?(se.argCount=f-1,he[c]=se):(nf(he,c,K),he[c].overloadTable[f-1]=se),Gi([],U,function(ye){var ze=[ye[0],null].concat(ye.slice(1)),Ke=lu(K,ze,null,y,x,C);if(he[c].overloadTable===void 0?(Ke.argCount=f-1,he[c]=Ke):he[c].overloadTable[f-1]=Ke,H.registeredClass.__derivedClasses)for(const at of H.registeredClass.__derivedClasses)at.constructor.hasOwnProperty(c)||(at.constructor[c]=Ke);return[]}),[]})}var Tv=(o,c,f)=>(o instanceof Object||Lt(`${f} with invalid "this": ${o}`),o instanceof c.registeredClass.constructor||Lt(`${f} incompatible with "this" of type ${o.constructor.name}`),o.$$.ptr||Lt(`cannot call emscripten binding method ${f} on deleted object`),su(o.$$.ptr,o.$$.ptrType.registeredClass,c.registeredClass));function nA(o,c,f,p,_,y,x,C){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,c=Bn(c),y=li(_,y),Gi([],[o],function(U){U=U[0];var H=`${U.name}.${c}`,K={get(){$r(`Cannot access ${H} due to unbound types`,[f])},enumerable:!0,configurable:!0};return C?K.set=()=>{$r(`Cannot access ${H} due to unbound types`,[f])}:K.set=se=>{Lt(`${H} is a read-only property`)},Object.defineProperty(U.registeredClass.constructor,c,K),Gi([],[f],function(se){se=se[0];var he={get(){return se.fromWireType(y(p))},enumerable:!0};return C&&(C=li(x,C),he.set=ye=>{var ze=[];C(p,se.toWireType(ze,ye)),au(ze)}),Object.defineProperty(U.registeredClass.constructor,c,he),[]}),[]})}function iA(o,c,f,p,_,y){o>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0;var x=cu(c,f);_=li(p,_),Gi([],[o],function(C){C=C[0];var U=`constructor ${C.name}`;if(C.registeredClass.constructor_body===void 0&&(C.registeredClass.constructor_body=[]),C.registeredClass.constructor_body[c-1]!==void 0)throw new Ga(`Cannot register multiple constructors with identical number of parameters (${c-1}) for class '${C.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return C.registeredClass.constructor_body[c-1]=()=>{$r(`Cannot construct ${C.name} due to unbound types`,x)},Gi([],x,H=>(H.splice(1,0,null),C.registeredClass.constructor_body[c-1]=lu(U,H,null,_,y),[])),[]})}function rA(o,c,f,p,_,y,x,C,U){o>>>=0,c>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0;var H=cu(f,p);c=Bn(c),c=af(c),y=li(_,y),Gi([],[o],function(K){K=K[0];var se=`${K.name}.${c}`;c.startsWith("@@")&&(c=Symbol[c.substring(2)]),C&&K.registeredClass.pureVirtualFunctions.push(c);function he(){$r(`Cannot call ${se} due to unbound types`,H)}var ye=K.registeredClass.instancePrototype,ze=ye[c];return ze===void 0||ze.overloadTable===void 0&&ze.className!==K.name&&ze.argCount===f-2?(he.argCount=f-2,he.className=K.name,ye[c]=he):(nf(ye,c,se),ye[c].overloadTable[f-2]=he),Gi([],H,function(Ke){var at=lu(se,Ke,K,y,x,U);return ye[c].overloadTable===void 0?(at.argCount=f-2,ye[c]=at):ye[c].overloadTable[f-2]=at,[]}),[]})}function sA(o,c,f,p,_,y,x,C,U,H){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,c=Bn(c),_=li(p,_),Gi([],[o],function(K){K=K[0];var se=`${K.name}.${c}`,he={get(){$r(`Cannot access ${se} due to unbound types`,[f,x])},enumerable:!0,configurable:!0};return U?he.set=()=>$r(`Cannot access ${se} due to unbound types`,[f,x]):he.set=ye=>Lt(se+" is a read-only property"),Object.defineProperty(K.registeredClass.instancePrototype,c,he),Gi([],U?[f,x]:[f],function(ye){var ze=ye[0],Ke={get(){var dt=Tv(this,K,se+" getter");return ze.fromWireType(_(y,dt))},enumerable:!0};if(U){U=li(C,U);var at=ye[1];Ke.set=function(dt){var Re=Tv(this,K,se+" setter"),je=[];U(H,Re,at.toWireType(je,dt)),au(je)}}return Object.defineProperty(K.registeredClass.instancePrototype,c,Ke),[]}),[]})}function aA(){Object.assign(Av.prototype,{get(o){return this.allocated[o]},has(o){return this.allocated[o]!==void 0},allocate(o){var c=this.freelist.pop()||this.allocated.length;return this.allocated[c]=o,c},free(o){this.allocated[o]=void 0,this.freelist.push(o)}})}function Av(){this.allocated=[void 0],this.freelist=[]}var er=new Av;function of(o){o>>>=0,o>=er.reserved&&--er.get(o).refcount===0&&er.free(o)}var oA=()=>{for(var o=0,c=er.reserved;c{er.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),er.reserved=er.allocated.length,u.count_emval_handles=oA},Qt={toValue:o=>(o||Lt("Cannot use deleted val. handle = "+o),er.get(o).value),toHandle:o=>{switch(o){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return er.allocate({refcount:1,value:o})}}};function Cv(o){return this.fromWireType(l()[o>>>2>>>0])}var cA=function(o,c){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:f=>{var p=Qt.toValue(f);return of(f),p},toWireType:(f,p)=>Qt.toHandle(p),argPackAdvance:Yr,readValueFromPointer:Cv,destructorFunction:null})},uA=(o,c,f)=>{switch(c){case 1:return f?function(p){return this.fromWireType(i()[p>>>0>>>0])}:function(p){return this.fromWireType(r()[p>>>0>>>0])};case 2:return f?function(p){return this.fromWireType(s()[p>>>1>>>0])}:function(p){return this.fromWireType(a()[p>>>1>>>0])};case 4:return f?function(p){return this.fromWireType(l()[p>>>2>>>0])}:function(p){return this.fromWireType(d()[p>>>2>>>0])};default:throw new TypeError(`invalid integer width (${c}): ${o}`)}};function dA(o,c,f,p){o>>>=0,c>>>=0,f>>>=0,c=Bn(c);function _(){}_.values={},Lr(o,{name:c,constructor:_,fromWireType:function(y){return this.constructor.values[y]},toWireType:(y,x)=>x.value,argPackAdvance:Yr,readValueFromPointer:uA(c,f,p),destructorFunction:null}),rf(c,_)}var Va=(o,c)=>{var f=aa[o];return f===void 0&&Lt(c+" has unknown type "+Sv(o)),f};function hA(o,c,f){o>>>=0,c>>>=0,f>>>=0;var p=Va(o,"enum");c=Bn(c);var _=p.constructor,y=Object.create(p.constructor.prototype,{value:{value:f},constructor:{value:ru(`${p.name}_${c}`,function(){})}});_.values[f]=y,_[c]=y}var lf=o=>{if(o===null)return"null";var c=typeof o;return c==="object"||c==="array"||c==="function"?o.toString():""+o},fA=(o,c)=>{switch(c){case 4:return function(f){return this.fromWireType(h()[f>>>2>>>0])};case 8:return function(f){return this.fromWireType(m()[f>>>3>>>0])};default:throw new TypeError(`invalid float width (${c}): ${o}`)}},pA=function(o,c,f){o>>>=0,c>>>=0,f>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:p=>p,toWireType:(p,_)=>_,argPackAdvance:Yr,readValueFromPointer:fA(c,f),destructorFunction:null})};function mA(o,c,f,p,_,y,x){o>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0;var C=cu(c,f);o=Bn(o),o=af(o),_=li(p,_),rf(o,function(){$r(`Cannot call ${o} due to unbound types`,C)},c-1),Gi([],C,function(U){var H=[U[0],null].concat(U.slice(1));return xv(o,lu(o,H,null,_,y,x),c-1),[]})}var gA=(o,c,f)=>{switch(c){case 1:return f?p=>i()[p>>>0>>>0]:p=>r()[p>>>0>>>0];case 2:return f?p=>s()[p>>>1>>>0]:p=>a()[p>>>1>>>0];case 4:return f?p=>l()[p>>>2>>>0]:p=>d()[p>>>2>>>0];default:throw new TypeError(`invalid integer width (${c}): ${o}`)}};function _A(o,c,f,p,_){o>>>=0,c>>>=0,f>>>=0,c=Bn(c);var y=K=>K;if(p===0){var x=32-8*f;y=K=>K<>>x}var C=c.includes("unsigned"),U=(K,se)=>{},H;C?H=function(K,se){return U(se,this.name),se>>>0}:H=function(K,se){return U(se,this.name),se},Lr(o,{name:c,fromWireType:y,toWireType:H,argPackAdvance:Yr,readValueFromPointer:gA(c,f,p!==0),destructorFunction:null})}function vA(o,c,f){o>>>=0,f>>>=0;var p=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_=p[c];function y(x){var C=d()[x>>>2>>>0],U=d()[x+4>>>2>>>0];return new _(i().buffer,U,C)}f=Bn(f),Lr(o,{name:f,fromWireType:y,argPackAdvance:Yr,readValueFromPointer:y},{ignoreDuplicateRegistrations:!0})}function yA(o,c,f,p,_,y,x,C,U,H,K,se){o>>>=0,c>>>=0,f>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,K>>>=0,se>>>=0,f=Bn(f),y=li(_,y),C=li(x,C),H=li(U,H),se=li(K,se),Gi([o],[c],function(he){he=he[0];var ye=new xl(f,he.registeredClass,!1,!1,!0,he,p,y,C,H,se);return[ye]})}function bA(o,c){o>>>=0,c>>>=0,c=Bn(c);var f=c==="std::string";Lr(o,{name:c,fromWireType(p){var _=d()[p>>>2>>>0],y=p+4,x;if(f)for(var C=y,U=0;U<=_;++U){var H=y+U;if(U==_||r()[H>>>0]==0){var K=H-C,se=fe(C,K);x===void 0?x=se:(x+="\0",x+=se),C=H+1}}else{for(var he=new Array(_),U=0;U<_;++U)he[U]=String.fromCharCode(r()[y+U>>>0]);x=he.join("")}return Ir(p),x},toWireType(p,_){_ instanceof ArrayBuffer&&(_=new Uint8Array(_));var y,x=typeof _=="string";x||_ instanceof Uint8Array||_ instanceof Uint8ClampedArray||_ instanceof Int8Array||Lt("Cannot pass non-string to std::string"),f&&x?y=Qi(_):y=_.length;var C=Ml(4+y+1),U=C+4;if(d()[C>>>2>>>0]=y,f&&x)Qc(_,U,y+1);else if(x)for(var H=0;H255&&(Ir(U),Lt("String has UTF-16 code units that do not fit in 8 bits")),r()[U+H>>>0]=K}else for(var H=0;H>>0]=_[H];return p!==null&&p.push(Ir,C),C},argPackAdvance:Yr,readValueFromPointer:bv,destructorFunction(p){Ir(p)}})}var Rv=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,xA=(o,c)=>{for(var f=o,p=f>>1,_=p+c/2;!(p>=_)&&a()[p>>>0];)++p;if(f=p<<1,f-o>32&&Rv)return Rv.decode(r().slice(o,f));for(var y="",x=0;!(x>=c/2);++x){var C=s()[o+x*2>>>1>>>0];if(C==0)break;y+=String.fromCharCode(C)}return y},wA=(o,c,f)=>{if(f===void 0&&(f=2147483647),f<2)return 0;f-=2;for(var p=c,_=f>>1>>>0]=x,c+=2}return s()[c>>>1>>>0]=0,c-p},SA=o=>o.length*2,MA=(o,c)=>{for(var f=0,p="";!(f>=c/4);){var _=l()[o+f*4>>>2>>>0];if(_==0)break;if(++f,_>=65536){var y=_-65536;p+=String.fromCharCode(55296|y>>10,56320|y&1023)}else p+=String.fromCharCode(_)}return p},EA=(o,c,f)=>{if(c>>>=0,f===void 0&&(f=2147483647),f<4)return 0;for(var p=c,_=p+f-4,y=0;y=55296&&x<=57343){var C=o.charCodeAt(++y);x=65536+((x&1023)<<10)|C&1023}if(l()[c>>>2>>>0]=x,c+=4,c+4>_)break}return l()[c>>>2>>>0]=0,c-p},TA=o=>{for(var c=0,f=0;f=55296&&p<=57343&&++f,c+=4}return c},AA=function(o,c,f){o>>>=0,c>>>=0,f>>>=0,f=Bn(f);var p,_,y,x,C;c===2?(p=xA,_=wA,x=SA,y=()=>a(),C=1):c===4&&(p=MA,_=EA,x=TA,y=()=>d(),C=2),Lr(o,{name:f,fromWireType:U=>{for(var H=d()[U>>>2>>>0],K=y(),se,he=U+4,ye=0;ye<=H;++ye){var ze=U+4+ye*c;if(ye==H||K[ze>>>C]==0){var Ke=ze-he,at=p(he,Ke);se===void 0?se=at:(se+="\0",se+=at),he=ze+c}}return Ir(U),se},toWireType:(U,H)=>{typeof H!="string"&&Lt(`Cannot pass non-string to C++ string type ${f}`);var K=x(H),se=Ml(4+K+c);return d()[se>>>2]=K>>C,_(H,se+4,K+c),U!==null&&U.push(Ir,se),se},argPackAdvance:Yr,readValueFromPointer:Cv,destructorFunction(U){Ir(U)}})},CA=function(o,c){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{isVoid:!0,name:c,argPackAdvance:0,fromWireType:()=>{},toWireType:(f,p)=>{}})},RA=!0,PA=()=>RA;function cf(o){if(o>>>=0,typeof Atomics.waitAsync=="function"){var c=Atomics.waitAsync(l(),o>>>2,o);c.value.then(uu);var f=o+128;Atomics.store(l(),f>>>2,1)}}u.__emscripten_thread_mailbox_await=cf;var uu=()=>{var o=pu();o&&(cf(o),sf(()=>i0()))};u.checkMailbox=uu;var LA=function(o,c,f){if(o>>>=0,c>>>=0,o==c)setTimeout(()=>uu());else if(P)postMessage({targetThread:o,cmd:"checkMailbox"});else{var p=Ee.pthreads[o];if(!p)return;p.postMessage({cmd:"checkMailbox"})}},IA=o=>{var c=Se(),f=o();return xe(c),f},Vt=function(o,c){var f=arguments.length-2,p=arguments;return IA(()=>{for(var _=f,y=s0(_*8),x=y>>>3,C=0;C>>0]=U}return t0(o,_,y,c)})},uf=[];function DA(o,c,f,p){c>>>=0,p>>>=0,uf.length=f;for(var _=p>>>3,y=0;y>>0];var x=_C[o];Ee.currentProxiedOperationCallerThread=c;var C=x.apply(null,uf);return Ee.currentProxiedOperationCallerThread=0,C}function df(){if(P)return Vt(20,1);Ht=!1,oi=0}function kA(o){o>>>=0,E&&Ee.pthreads[o].ref()}function FA(o,c,f){o>>>=0,c>>>=0,f>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as");var p=[],_=Qt.toHandle(p);return d()[f>>>2>>>0]=_,c.toWireType(p,o)}function UA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as"),c.toWireType(null,o)}function OA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as"),c.toWireType(null,o)}var Pv=(o,c)=>{for(var f=new Array(o),p=0;p>>2>>>0],"parameter "+p);return f};function NA(o,c,f,p){o>>>=0,f>>>=0,p>>>=0,o=Qt.toValue(o);for(var _=Pv(c,f),y=new Array(c),x=0;x{var c=BA[o];return c===void 0?Bn(o):c},ff=[];function zA(o,c,f,p,_){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,o=ff[o],c=Qt.toValue(c),f=hf(f);var y=[],x=o(c,f,y,_);return y.length&&(d()[p>>>2>>>0]=Qt.toHandle(y)),x}function HA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),o==c}var Lv=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")();function GA(o){return o>>>=0,o===0?Qt.toHandle(Lv()):(o=hf(o),Qt.toHandle(Lv()[o]))}var VA=o=>{var c=ff.length;return ff.push(o),c};function WA(o,c){c>>>=0;var f=Pv(o,c),p=f.shift();o--;for(var _=["retType"],y=[p],x="",C=0;Cye.name).join("_")+"$",H=iu("methodCaller_"+U),K="return function "+H+`(handle, name, destructors, args) { +`,se=0,C=0;C>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),Qt.toHandle(o[c])}function XA(o){o>>>=0,o>4&&(er.get(o).refcount+=1)}function YA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),o instanceof c}function $A(){return Qt.toHandle([])}function qA(o){return o>>>=0,Qt.toHandle(hf(o))}function KA(){return Qt.toHandle({})}function ZA(o){o>>>=0;var c=Qt.toValue(o);au(c),of(o)}function QA(o,c,f){o>>>=0,c>>>=0,f>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),f=Qt.toValue(f),o[c]=f}function JA(o,c){o>>>=0,c>>>=0,o=Va(o,"_emval_take_value");var f=o.readValueFromPointer(c);return Qt.toHandle(f)}function eC(o){return o>>>=0,o=Qt.toValue(o),Qt.toHandle(typeof o)}function Iv(o,c,f,p,_,y,x,C){if(P)return Vt(21,1,o,c,f,p,_,y,x,C);o>>>=0;var U=Bt(_,y);x>>>=0,C>>>=0;try{if(isNaN(U))return 61;var H=J.getStreamFromFD(p),K=R.mmap(H,o,U,c,f),se=K.ptr;return l()[x>>>2>>>0]=K.allocated,d()[C>>>2>>>0]=se,0}catch(he){if(typeof R>"u"||he.name!=="ErrnoError")throw he;return-he.errno}}function Dv(o,c,f,p,_,y,x){if(P)return Vt(22,1,o,c,f,p,_,y,x);o>>>=0,c>>>=0;var C=Bt(y,x);try{if(isNaN(C))return 61;var U=J.getStreamFromFD(_);f&2&&J.doMsync(o,U,c,p,C),R.munmap(U)}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return-H.errno}}var wl={},pf;pf=()=>performance.timeOrigin+performance.now();function kv(o,c){if(P)return Vt(23,1,o,c);if(wl[o]&&(clearTimeout(wl[o].id),delete wl[o]),!c)return 0;var f=setTimeout(()=>{delete wl[o],sf(()=>n0(o,pf()))},c);return wl[o]={id:f,timeout_ms:c},0}var tC=()=>{lt("")},nC=()=>{},iC=()=>Date.now(),rC=()=>{throw Ev(),"unwind"};function Fv(o){if(P)return Vt(24,1,o);df(),Oe(o)}var Uv=()=>4294901760;function sC(){return Uv()}var aC=()=>E?require("os").cpus().length:navigator.hardwareConcurrency,oC=o=>{var c=ue.buffer,f=(o-c.byteLength+65535)/65536;try{return ue.grow(f),ft(),1}catch{}};function lC(o){o>>>=0;var c=r().length;if(o<=c)return!1;var f=Uv();if(o>f)return!1;for(var p=(U,H)=>U+(H-U%H)%H,_=1;_<=4;_*=2){var y=c*(1+.2/_);y=Math.min(y,o+100663296);var x=Math.min(f,p(Math.max(o,y),65536)),C=oC(x);if(C)return!0}return!1}var mf={},cC=()=>T||"./this.program",Sl=()=>{if(!Sl.strings){var o=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",c={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:o,_:cC()};for(var f in mf)mf[f]===void 0?delete c[f]:c[f]=mf[f];var p=[];for(var f in c)p.push(`${f}=${c[f]}`);Sl.strings=p}return Sl.strings},uC=(o,c)=>{for(var f=0;f>>0>>>0]=o.charCodeAt(f);i()[c>>>0>>>0]=0},Ov=function(o,c){if(P)return Vt(25,1,o,c);o>>>=0,c>>>=0;var f=0;return Sl().forEach((p,_)=>{var y=c+f;d()[o+_*4>>>2>>>0]=y,uC(p,y),f+=p.length+1}),0},Nv=function(o,c){if(P)return Vt(26,1,o,c);o>>>=0,c>>>=0;var f=Sl();d()[o>>>2>>>0]=f.length;var p=0;return f.forEach(_=>p+=_.length+1),d()[c>>>2>>>0]=p,0};function Bv(o){if(P)return Vt(27,1,o);try{var c=J.getStreamFromFD(o);return R.close(c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function zv(o,c){if(P)return Vt(28,1,o,c);c>>>=0;try{var f=0,p=0,_=0,y=J.getStreamFromFD(o),x=y.tty?2:R.isDir(y.mode)?3:R.isLink(y.mode)?7:4;return i()[c>>>0>>>0]=x,s()[c+2>>>1>>>0]=_,it=[f>>>0,(Ie=f,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+8>>>2>>>0]=it[0],l()[c+12>>>2>>>0]=it[1],it=[p>>>0,(Ie=p,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+16>>>2>>>0]=it[0],l()[c+20>>>2>>>0]=it[1],0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return C.errno}}var Hv=(o,c,f,p)=>{for(var _=0,y=0;y>>2>>>0],C=d()[c+4>>>2>>>0];c+=8;var U=R.read(o,i(),x,C,p);if(U<0)return-1;if(_+=U,U>>=0,f>>>=0;var x=Bt(p,_);y>>>=0;try{if(isNaN(x))return 61;var C=J.getStreamFromFD(o),U=Hv(C,c,f,x);return d()[y>>>2>>>0]=U,0}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return H.errno}}var Vv=(o,c,f,p)=>{for(var _=0,y=0;y>>2>>>0],C=d()[c+4>>>2>>>0];c+=8;var U=R.write(o,i(),x,C,p);if(U<0)return-1;_+=U,typeof p<"u"&&(p+=U)}return _};function Wv(o,c,f,p,_,y){if(P)return Vt(30,1,o,c,f,p,_,y);c>>>=0,f>>>=0;var x=Bt(p,_);y>>>=0;try{if(isNaN(x))return 61;var C=J.getStreamFromFD(o),U=Vv(C,c,f,x);return d()[y>>>2>>>0]=U,0}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return H.errno}}function jv(o,c,f,p){if(P)return Vt(31,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{var _=J.getStreamFromFD(o),y=Hv(_,c,f);return d()[p>>>2>>>0]=y,0}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return x.errno}}function Xv(o,c,f,p,_){if(P)return Vt(32,1,o,c,f,p,_);var y=Bt(c,f);_>>>=0;try{if(isNaN(y))return 61;var x=J.getStreamFromFD(o);return R.llseek(x,y,p),it=[x.position>>>0,(Ie=x.position,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[_>>>2>>>0]=it[0],l()[_+4>>>2>>>0]=it[1],x.getdents&&y===0&&p===0&&(x.getdents=null),0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return C.errno}}function Yv(o,c,f,p){if(P)return Vt(33,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{var _=J.getStreamFromFD(o),y=Vv(_,c,f);return d()[p>>>2>>>0]=y,0}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return x.errno}}function dC(o){return o>>>=0,o}var du=o=>o%4===0&&(o%100!==0||o%400===0),hC=(o,c)=>{for(var f=0,p=0;p<=c;f+=o[p++]);return f},$v=[31,29,31,30,31,30,31,31,30,31,30,31],qv=[31,28,31,30,31,30,31,31,30,31,30,31],fC=(o,c)=>{for(var f=new Date(o.getTime());c>0;){var p=du(f.getFullYear()),_=f.getMonth(),y=(p?$v:qv)[_];if(c>y-f.getDate())c-=y-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+c),f}return f},pC=(o,c)=>{i().set(o,c>>>0)};function mC(o,c,f,p){o>>>=0,c>>>=0,f>>>=0,p>>>=0;var _=d()[p+40>>>2>>>0],y={tm_sec:l()[p>>>2>>>0],tm_min:l()[p+4>>>2>>>0],tm_hour:l()[p+8>>>2>>>0],tm_mday:l()[p+12>>>2>>>0],tm_mon:l()[p+16>>>2>>>0],tm_year:l()[p+20>>>2>>>0],tm_wday:l()[p+24>>>2>>>0],tm_yday:l()[p+28>>>2>>>0],tm_isdst:l()[p+32>>>2>>>0],tm_gmtoff:l()[p+36>>>2>>>0],tm_zone:_?fe(_):""},x=fe(f),C={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var U in C)x=x.replace(new RegExp(U,"g"),C[U]);var H=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],K=["January","February","March","April","May","June","July","August","September","October","November","December"];function se(Re,je,dn){for(var zt=typeof Re=="number"?Re.toString():Re||"";zt.length0?1:0}var zt;return(zt=dn(Re.getFullYear()-je.getFullYear()))===0&&(zt=dn(Re.getMonth()-je.getMonth()))===0&&(zt=dn(Re.getDate()-je.getDate())),zt}function ze(Re){switch(Re.getDay()){case 0:return new Date(Re.getFullYear()-1,11,29);case 1:return Re;case 2:return new Date(Re.getFullYear(),0,3);case 3:return new Date(Re.getFullYear(),0,2);case 4:return new Date(Re.getFullYear(),0,1);case 5:return new Date(Re.getFullYear()-1,11,31);case 6:return new Date(Re.getFullYear()-1,11,30)}}function Ke(Re){var je=fC(new Date(Re.tm_year+1900,0,1),Re.tm_yday),dn=new Date(je.getFullYear(),0,4),zt=new Date(je.getFullYear()+1,0,4),ci=ze(dn),hn=ze(zt);return ye(ci,je)<=0?ye(hn,je)<=0?je.getFullYear()+1:je.getFullYear():je.getFullYear()-1}var at={"%a":Re=>H[Re.tm_wday].substring(0,3),"%A":Re=>H[Re.tm_wday],"%b":Re=>K[Re.tm_mon].substring(0,3),"%B":Re=>K[Re.tm_mon],"%C":Re=>{var je=Re.tm_year+1900;return he(je/100|0,2)},"%d":Re=>he(Re.tm_mday,2),"%e":Re=>se(Re.tm_mday,2," "),"%g":Re=>Ke(Re).toString().substring(2),"%G":Re=>Ke(Re),"%H":Re=>he(Re.tm_hour,2),"%I":Re=>{var je=Re.tm_hour;return je==0?je=12:je>12&&(je-=12),he(je,2)},"%j":Re=>he(Re.tm_mday+hC(du(Re.tm_year+1900)?$v:qv,Re.tm_mon-1),3),"%m":Re=>he(Re.tm_mon+1,2),"%M":Re=>he(Re.tm_min,2),"%n":()=>` +`,"%p":Re=>Re.tm_hour>=0&&Re.tm_hour<12?"AM":"PM","%S":Re=>he(Re.tm_sec,2),"%t":()=>" ","%u":Re=>Re.tm_wday||7,"%U":Re=>{var je=Re.tm_yday+7-Re.tm_wday;return he(Math.floor(je/7),2)},"%V":Re=>{var je=Math.floor((Re.tm_yday+7-(Re.tm_wday+6)%7)/7);if((Re.tm_wday+371-Re.tm_yday-2)%7<=2&&je++,je){if(je==53){var zt=(Re.tm_wday+371-Re.tm_yday)%7;zt!=4&&(zt!=3||!du(Re.tm_year))&&(je=1)}}else{je=52;var dn=(Re.tm_wday+7-Re.tm_yday-1)%7;(dn==4||dn==5&&du(Re.tm_year%400-1))&&je++}return he(je,2)},"%w":Re=>Re.tm_wday,"%W":Re=>{var je=Re.tm_yday+7-(Re.tm_wday+6)%7;return he(Math.floor(je/7),2)},"%y":Re=>(Re.tm_year+1900).toString().substring(2),"%Y":Re=>Re.tm_year+1900,"%z":Re=>{var je=Re.tm_gmtoff,dn=je>=0;return je=Math.abs(je)/60,je=je/60*100+je%60,(dn?"+":"-")+("0000"+je).slice(-4)},"%Z":Re=>Re.tm_zone,"%%":()=>"%"};x=x.replace(/%%/g,"\0\0");for(var U in at)x.includes(U)&&(x=x.replace(new RegExp(U,"g"),at[U](y)));x=x.replace(/\0\0/g,"%");var dt=Xr(x,!1);return dt.length>c?0:(pC(dt,o),dt.length-1)}function gC(o,c,f,p,_){return o>>>=0,c>>>=0,f>>>=0,p>>>=0,mC(o,c,f,p)}Ee.init();var Kv=function(o,c,f,p){o||(o=this),this.parent=o,this.mount=o.mount,this.mounted=null,this.id=R.nextInode++,this.name=c,this.mode=f,this.node_ops={},this.stream_ops={},this.rdev=p},hu=365,fu=146;Object.defineProperties(Kv.prototype,{read:{get:function(){return(this.mode&hu)===hu},set:function(o){o?this.mode|=hu:this.mode&=~hu}},write:{get:function(){return(this.mode&fu)===fu},set:function(o){o?this.mode|=fu:this.mode&=~fu}},isFolder:{get:function(){return R.isDir(this.mode)}},isDevice:{get:function(){return R.isChrdev(this.mode)}}}),R.FSNode=Kv,R.createPreloadedFile=te,R.staticInit(),u.FS_createPath=R.createPath,u.FS_createDataFile=R.createDataFile,u.FS_createPreloadedFile=R.createPreloadedFile,u.FS_unlink=R.unlink,u.FS_createLazyFile=R.createLazyFile,u.FS_createDevice=R.createDevice,CT(),Ga=u.BindingError=class extends Error{constructor(c){super(c),this.name="BindingError"}},mv=u.InternalError=class extends Error{constructor(c){super(c),this.name="InternalError"}},zT(),UT(),YT(),wv=u.UnboundTypeError=ZT(Error,"UnboundTypeError"),aA(),lA();var _C=[be,qe,q_,Z_,Q_,J_,ev,tv,nv,iv,rv,sv,av,ov,lv,cv,uv,dv,hv,fv,df,Iv,Dv,kv,Fv,Ov,Nv,Bv,zv,Gv,Wv,jv,Xv,Yv],vC={Qb:ee,Lc:pt,r:Xt,D:Zt,b:za,l:vT,Na:yT,nb:bT,Ua:$_,Bc:xT,y:wT,Cc:ST,Rc:MT,bb:ET,Nc:K_,f:sa,gb:Z_,$c:Q_,_b:J_,Xc:ev,hb:tv,Wc:nv,Sc:iv,Kc:rv,cd:sv,Tc:av,Pc:ov,Uc:lv,eb:cv,Jc:uv,Ic:dv,Vc:hv,Ec:fv,cc:AT,gd:PT,H:QT,da:tA,wa:nA,N:iA,z:rA,x:sA,fd:cA,sb:dA,Ea:hA,jb:pA,ld:mA,oa:_A,T:vA,qa:yA,ib:bA,Wa:AA,hd:CA,_c:PA,Fc:LA,Oc:DA,Mc:df,Qc:cf,Zc:kA,ra:FA,lc:UA,kc:OA,Ha:NA,la:zA,yd:of,kd:HA,od:GA,ka:WA,Ad:jA,$a:XA,pd:YA,Ub:$A,Rb:qA,Tb:KA,Vb:ZA,Sb:QA,F:JA,qd:eC,$b:Iv,ac:Dv,ab:kv,fa:tC,Pb:He,rd:oe,cb:nC,fb:iC,Yc:rC,tb:Fv,Gc:sC,ba:pf,Hc:aC,Dc:lC,dd:Ov,ed:Nv,xa:Oe,Ia:Bv,db:zv,Zb:Gv,Yb:Wv,bd:jv,bc:Xv,Va:Yv,ub:JR,jd:MP,s:GC,P:rP,nd:oP,pa:aR,Ta:WC,sa:iR,mc:BP,Aa:kR,Kb:bR,Gb:TR,mb:bP,Sa:JC,xd:YR,k:EC,Ab:WR,Bb:VR,La:GR,Ma:HR,zb:XR,Fa:jR,ob:gP,Ja:_P,Eb:RR,c:wC,Q:VC,J:cP,_a:NR,xb:qR,na:sR,aa:qC,vd:eP,Za:BR,M:$C,ta:tR,id:EP,e:yC,q:zC,sd:iP,ma:aP,td:nP,zd:zR,ca:UC,w:sP,vb:QR,wb:ZR,ya:yP,Ra:eR,h:bC,R:ZC,I:uP,wd:KR,ua:cR,md:mP,yb:$R,Hb:ER,m:AC,L:jC,Ca:dR,o:SC,Pa:xR,B:kC,rb:lP,C:IC,ud:tP,A:HC,va:QC,kb:wP,Da:XC,za:UR,Oa:OR,Cb:FR,Xb:YP,dc:XP,ec:jP,gc:VP,sc:DP,rc:kP,jc:zP,zc:TP,wc:RP,pc:UP,yc:AP,Wb:$P,xc:CP,p:PC,Z:YC,pb:pP,Fb:CR,j:xC,_:LC,Mb:vR,Jb:SR,Qa:mR,ea:dP,Ka:fP,qb:hP,U:wR,V:AR,d:MC,W:NC,Lb:yR,Nb:_R,ja:BC,Xa:SP,t:nR,g:CC,Y:KC,Ob:gR,O:OC,ha:hR,Ba:pR,Db:DR,i:RC,E:oR,ia:lR,Ya:vP,n:TC,S:fR,X:uR,v:DC,G:FC,Ib:MR,K:rR,$:IR,ga:LR,lb:xP,Ga:PR,ic:HP,fc:WP,hc:GP,vc:PP,nc:NP,qc:FP,uc:LP,tc:IP,oc:OP,u:dC,a:ue||u.wasmMemory,ad:be,Ac:gC},ne=bt(),pu=u._pthread_self=()=>(pu=u._pthread_self=ne.Cd)(),Ir=o=>(Ir=ne.Ed)(o),Ml=o=>(Ml=ne.Fd)(o),Zv=()=>(Zv=ne.Gd)();u.__emscripten_tls_init=()=>(u.__emscripten_tls_init=ne.Hd)();var Qv=(o,c)=>(Qv=ne.Id)(o,c),Jv=o=>(Jv=ne.Jd)(o);u.__embind_initialize_bindings=()=>(u.__embind_initialize_bindings=ne.Kd)();var e0=u.__emscripten_thread_init=(o,c,f,p,_,y)=>(e0=u.__emscripten_thread_init=ne.Ld)(o,c,f,p,_,y);u.__emscripten_thread_crashed=()=>(u.__emscripten_thread_crashed=ne.Md)();var t0=(o,c,f,p)=>(t0=ne.Nd)(o,c,f,p),gf=o=>(gf=ne.Od)(o),_f=u.__emscripten_thread_exit=o=>(_f=u.__emscripten_thread_exit=ne.Pd)(o),n0=(o,c)=>(n0=ne.Qd)(o,c),i0=u.__emscripten_check_mailbox=()=>(i0=u.__emscripten_check_mailbox=ne.Rd)(),we=(o,c)=>(we=ne.Sd)(o,c),El=o=>(El=ne.Td)(o),r0=(o,c)=>(r0=ne.Ud)(o,c),Se=()=>(Se=ne.Vd)(),xe=o=>(xe=ne.Wd)(o),s0=o=>(s0=ne.Xd)(o),a0=o=>(a0=ne.Yd)(o),o0=o=>(o0=ne.Zd)(o),l0=(o,c,f)=>(l0=ne._d)(o,c,f),c0=o=>(c0=ne.$d)(o),u0=u.dynCall_iii=(o,c,f)=>(u0=u.dynCall_iii=ne.ae)(o,c,f),d0=u.dynCall_iiii=(o,c,f,p)=>(d0=u.dynCall_iiii=ne.be)(o,c,f,p),vf=u.dynCall_vi=(o,c)=>(vf=u.dynCall_vi=ne.ce)(o,c),yf=u.dynCall_ii=(o,c)=>(yf=u.dynCall_ii=ne.de)(o,c),h0=u.dynCall_iiiiii=(o,c,f,p,_,y)=>(h0=u.dynCall_iiiiii=ne.ee)(o,c,f,p,_,y),f0=u.dynCall_vii=(o,c,f)=>(f0=u.dynCall_vii=ne.fe)(o,c,f),p0=u.dynCall_i=o=>(p0=u.dynCall_i=ne.ge)(o),m0=u.dynCall_viiiii=(o,c,f,p,_,y)=>(m0=u.dynCall_viiiii=ne.he)(o,c,f,p,_,y),g0=u.dynCall_v=o=>(g0=u.dynCall_v=ne.ie)(o),_0=u.dynCall_viii=(o,c,f,p)=>(_0=u.dynCall_viii=ne.je)(o,c,f,p),v0=u.dynCall_vid=(o,c,f)=>(v0=u.dynCall_vid=ne.ke)(o,c,f),y0=u.dynCall_di=(o,c)=>(y0=u.dynCall_di=ne.le)(o,c),b0=u.dynCall_iiiii=(o,c,f,p,_)=>(b0=u.dynCall_iiiii=ne.me)(o,c,f,p,_),x0=u.dynCall_viiii=(o,c,f,p,_)=>(x0=u.dynCall_viiii=ne.ne)(o,c,f,p,_),w0=u.dynCall_viid=(o,c,f,p)=>(w0=u.dynCall_viid=ne.oe)(o,c,f,p),S0=u.dynCall_dii=(o,c,f)=>(S0=u.dynCall_dii=ne.pe)(o,c,f),M0=u.dynCall_viiid=(o,c,f,p,_)=>(M0=u.dynCall_viiid=ne.qe)(o,c,f,p,_),E0=u.dynCall_iiiid=(o,c,f,p,_)=>(E0=u.dynCall_iiiid=ne.re)(o,c,f,p,_),T0=u.dynCall_iiiiiiii=(o,c,f,p,_,y,x,C)=>(T0=u.dynCall_iiiiiiii=ne.se)(o,c,f,p,_,y,x,C),A0=u.dynCall_viiiiii=(o,c,f,p,_,y,x)=>(A0=u.dynCall_viiiiii=ne.te)(o,c,f,p,_,y,x),C0=u.dynCall_iiiiiii=(o,c,f,p,_,y,x)=>(C0=u.dynCall_iiiiiii=ne.ue)(o,c,f,p,_,y,x),R0=u.dynCall_diii=(o,c,f,p)=>(R0=u.dynCall_diii=ne.ve)(o,c,f,p),P0=u.dynCall_j=o=>(P0=u.dynCall_j=ne.we)(o),L0=u.dynCall_iiid=(o,c,f,p)=>(L0=u.dynCall_iiid=ne.xe)(o,c,f,p),I0=u.dynCall_iiiiid=(o,c,f,p,_,y)=>(I0=u.dynCall_iiiiid=ne.ye)(o,c,f,p,_,y),D0=u.dynCall_vd=(o,c)=>(D0=u.dynCall_vd=ne.ze)(o,c),k0=u.dynCall_iiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(k0=u.dynCall_iiiiiiiiiiii=ne.Ae)(o,c,f,p,_,y,x,C,U,H,K,se),F0=u.dynCall_iid=(o,c,f)=>(F0=u.dynCall_iid=ne.Be)(o,c,f),U0=u.dynCall_viidi=(o,c,f,p,_)=>(U0=u.dynCall_viidi=ne.Ce)(o,c,f,p,_),O0=u.dynCall_iidiii=(o,c,f,p,_,y)=>(O0=u.dynCall_iidiii=ne.De)(o,c,f,p,_,y),N0=u.dynCall_iiiiiiiii=(o,c,f,p,_,y,x,C,U)=>(N0=u.dynCall_iiiiiiiii=ne.Ee)(o,c,f,p,_,y,x,C,U),B0=u.dynCall_iiiiiiiiii=(o,c,f,p,_,y,x,C,U,H)=>(B0=u.dynCall_iiiiiiiiii=ne.Fe)(o,c,f,p,_,y,x,C,U,H),z0=u.dynCall_iiidi=(o,c,f,p,_)=>(z0=u.dynCall_iiidi=ne.Ge)(o,c,f,p,_),H0=u.dynCall_fiii=(o,c,f,p)=>(H0=u.dynCall_fiii=ne.He)(o,c,f,p),G0=u.dynCall_iiifi=(o,c,f,p,_)=>(G0=u.dynCall_iiifi=ne.Ie)(o,c,f,p,_),V0=u.dynCall_viif=(o,c,f,p)=>(V0=u.dynCall_viif=ne.Je)(o,c,f,p),W0=u.dynCall_iiffi=(o,c,f,p,_)=>(W0=u.dynCall_iiffi=ne.Ke)(o,c,f,p,_),j0=u.dynCall_fif=(o,c,f)=>(j0=u.dynCall_fif=ne.Le)(o,c,f),X0=u.dynCall_iif=(o,c,f)=>(X0=u.dynCall_iif=ne.Me)(o,c,f),Y0=u.dynCall_dif=(o,c,f)=>(Y0=u.dynCall_dif=ne.Ne)(o,c,f),$0=u.dynCall_viiiiiii=(o,c,f,p,_,y,x,C)=>($0=u.dynCall_viiiiiii=ne.Oe)(o,c,f,p,_,y,x,C),q0=u.dynCall_viiiiiiii=(o,c,f,p,_,y,x,C,U)=>(q0=u.dynCall_viiiiiiii=ne.Pe)(o,c,f,p,_,y,x,C,U),K0=u.dynCall_iidii=(o,c,f,p,_)=>(K0=u.dynCall_iidii=ne.Qe)(o,c,f,p,_),Z0=u.dynCall_viiidiiiii=(o,c,f,p,_,y,x,C,U,H)=>(Z0=u.dynCall_viiidiiiii=ne.Re)(o,c,f,p,_,y,x,C,U,H),Q0=u.dynCall_viiiidi=(o,c,f,p,_,y,x)=>(Q0=u.dynCall_viiiidi=ne.Se)(o,c,f,p,_,y,x),J0=u.dynCall_viiidii=(o,c,f,p,_,y,x)=>(J0=u.dynCall_viiidii=ne.Te)(o,c,f,p,_,y,x),ey=u.dynCall_viiiid=(o,c,f,p,_,y)=>(ey=u.dynCall_viiiid=ne.Ue)(o,c,f,p,_,y),ty=u.dynCall_iiiidiii=(o,c,f,p,_,y,x,C)=>(ty=u.dynCall_iiiidiii=ne.Ve)(o,c,f,p,_,y,x,C),ny=u.dynCall_iiiiidiiii=(o,c,f,p,_,y,x,C,U,H)=>(ny=u.dynCall_iiiiidiiii=ne.We)(o,c,f,p,_,y,x,C,U,H),iy=u.dynCall_viiiiid=(o,c,f,p,_,y,x)=>(iy=u.dynCall_viiiiid=ne.Xe)(o,c,f,p,_,y,x),ry=u.dynCall_viiiiidi=(o,c,f,p,_,y,x,C)=>(ry=u.dynCall_viiiiidi=ne.Ye)(o,c,f,p,_,y,x,C),sy=u.dynCall_viiiddddi=(o,c,f,p,_,y,x,C,U)=>(sy=u.dynCall_viiiddddi=ne.Ze)(o,c,f,p,_,y,x,C,U),ay=u.dynCall_viiddi=(o,c,f,p,_,y)=>(ay=u.dynCall_viiddi=ne._e)(o,c,f,p,_,y),oy=u.dynCall_vidddi=(o,c,f,p,_,y)=>(oy=u.dynCall_vidddi=ne.$e)(o,c,f,p,_,y),ly=u.dynCall_viiddddi=(o,c,f,p,_,y,x,C)=>(ly=u.dynCall_viiddddi=ne.af)(o,c,f,p,_,y,x,C),cy=u.dynCall_fid=(o,c,f)=>(cy=u.dynCall_fid=ne.bf)(o,c,f),uy=u.dynCall_iiiiiid=(o,c,f,p,_,y,x)=>(uy=u.dynCall_iiiiiid=ne.cf)(o,c,f,p,_,y,x),dy=u.dynCall_vif=(o,c,f)=>(dy=u.dynCall_vif=ne.df)(o,c,f),hy=u.dynCall_viiidi=(o,c,f,p,_,y)=>(hy=u.dynCall_viiidi=ne.ef)(o,c,f,p,_,y),fy=u.dynCall_viddi=(o,c,f,p,_)=>(fy=u.dynCall_viddi=ne.ff)(o,c,f,p,_),py=u.dynCall_viiiiiiid=(o,c,f,p,_,y,x,C,U)=>(py=u.dynCall_viiiiiiid=ne.gf)(o,c,f,p,_,y,x,C,U),my=u.dynCall_jiij=(o,c,f,p,_)=>(my=u.dynCall_jiij=ne.hf)(o,c,f,p,_),gy=u.dynCall_ji=(o,c)=>(gy=u.dynCall_ji=ne.jf)(o,c),_y=u.dynCall_iiiifffffiiff=(o,c,f,p,_,y,x,C,U,H,K,se,he)=>(_y=u.dynCall_iiiifffffiiff=ne.kf)(o,c,f,p,_,y,x,C,U,H,K,se,he);u.dynCall_jif=(o,c,f)=>(u.dynCall_jif=ne.lf)(o,c,f);var vy=u.dynCall_vifii=(o,c,f,p,_)=>(vy=u.dynCall_vifii=ne.mf)(o,c,f,p,_),yy=u.dynCall_vfiiii=(o,c,f,p,_,y)=>(yy=u.dynCall_vfiiii=ne.nf)(o,c,f,p,_,y),by=u.dynCall_ifii=(o,c,f,p)=>(by=u.dynCall_ifii=ne.of)(o,c,f,p);u.dynCall_jiiijji=(o,c,f,p,_,y,x,C,U)=>(u.dynCall_jiiijji=ne.pf)(o,c,f,p,_,y,x,C,U);var xy=u.dynCall_viiif=(o,c,f,p,_)=>(xy=u.dynCall_viiif=ne.qf)(o,c,f,p,_),wy=u.dynCall_iiiiiiiiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je)=>(wy=u.dynCall_iiiiiiiiiiiiiiiiiiii=ne.rf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je),Sy=u.dynCall_viiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(Sy=u.dynCall_viiiiiiiiii=ne.sf)(o,c,f,p,_,y,x,C,U,H,K),My=u.dynCall_viiiiiiiii=(o,c,f,p,_,y,x,C,U,H)=>(My=u.dynCall_viiiiiiiii=ne.tf)(o,c,f,p,_,y,x,C,U,H),Ey=u.dynCall_iiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he)=>(Ey=u.dynCall_iiiiiiiiiiiii=ne.uf)(o,c,f,p,_,y,x,C,U,H,K,se,he);u.dynCall_ff=(o,c)=>(u.dynCall_ff=ne.vf)(o,c),u.dynCall_fff=(o,c,f)=>(u.dynCall_fff=ne.wf)(o,c,f),u.dynCall_iiijiii=(o,c,f,p,_,y,x,C)=>(u.dynCall_iiijiii=ne.xf)(o,c,f,p,_,y,x,C);var Ty=u.dynCall_jii=(o,c,f)=>(Ty=u.dynCall_jii=ne.yf)(o,c,f);u.dynCall_iiij=(o,c,f,p,_)=>(u.dynCall_iiij=ne.zf)(o,c,f,p,_),u.dynCall_iiiji=(o,c,f,p,_,y)=>(u.dynCall_iiiji=ne.Af)(o,c,f,p,_,y);var Ay=u.dynCall_iiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)=>(Ay=u.dynCall_iiiiiiiiiiiiii=ne.Bf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye),Cy=u.dynCall_iiddddddiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(Cy=u.dynCall_iiddddddiiii=ne.Cf)(o,c,f,p,_,y,x,C,U,H,K,se),Ry=u.dynCall_iidiiiii=(o,c,f,p,_,y,x,C)=>(Ry=u.dynCall_iidiiiii=ne.Df)(o,c,f,p,_,y,x,C),Py=u.dynCall_iddiii=(o,c,f,p,_,y)=>(Py=u.dynCall_iddiii=ne.Ef)(o,c,f,p,_,y),Ly=u.dynCall_iddii=(o,c,f,p,_)=>(Ly=u.dynCall_iddii=ne.Ff)(o,c,f,p,_),Iy=u.dynCall_idddiii=(o,c,f,p,_,y,x)=>(Iy=u.dynCall_idddiii=ne.Gf)(o,c,f,p,_,y,x),Dy=u.dynCall_idddii=(o,c,f,p,_,y)=>(Dy=u.dynCall_idddii=ne.Hf)(o,c,f,p,_,y),ky=u.dynCall_idii=(o,c,f,p)=>(ky=u.dynCall_idii=ne.If)(o,c,f,p),Fy=u.dynCall_idi=(o,c,f)=>(Fy=u.dynCall_idi=ne.Jf)(o,c,f),Uy=u.dynCall_fiiid=(o,c,f,p,_)=>(Uy=u.dynCall_fiiid=ne.Kf)(o,c,f,p,_),Oy=u.dynCall_iidi=(o,c,f,p)=>(Oy=u.dynCall_iidi=ne.Lf)(o,c,f,p),Ny=u.dynCall_iiiidii=(o,c,f,p,_,y,x)=>(Ny=u.dynCall_iiiidii=ne.Mf)(o,c,f,p,_,y,x),By=u.dynCall_iiiidiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(By=u.dynCall_iiiidiiiiii=ne.Nf)(o,c,f,p,_,y,x,C,U,H,K),zy=u.dynCall_iiidiiiii=(o,c,f,p,_,y,x,C,U)=>(zy=u.dynCall_iiidiiiii=ne.Of)(o,c,f,p,_,y,x,C,U),Hy=u.dynCall_iiidiiidiiiidiif=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)=>(Hy=u.dynCall_iiidiiidiiiidiif=ne.Pf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke),Gy=u.dynCall_dddd=(o,c,f,p)=>(Gy=u.dynCall_dddd=ne.Qf)(o,c,f,p),Vy=u.dynCall_iidiiii=(o,c,f,p,_,y,x)=>(Vy=u.dynCall_iidiiii=ne.Rf)(o,c,f,p,_,y,x),Wy=u.dynCall_iiiddii=(o,c,f,p,_,y,x)=>(Wy=u.dynCall_iiiddii=ne.Sf)(o,c,f,p,_,y,x),jy=u.dynCall_iiiiiiiidi=(o,c,f,p,_,y,x,C,U,H)=>(jy=u.dynCall_iiiiiiiidi=ne.Tf)(o,c,f,p,_,y,x,C,U,H),Xy=u.dynCall_iiiddi=(o,c,f,p,_,y)=>(Xy=u.dynCall_iiiddi=ne.Uf)(o,c,f,p,_,y),Yy=u.dynCall_iiidd=(o,c,f,p,_)=>(Yy=u.dynCall_iiidd=ne.Vf)(o,c,f,p,_);u.dynCall_iiiif=(o,c,f,p,_)=>(u.dynCall_iiiif=ne.Wf)(o,c,f,p,_);var $y=u.dynCall_fi=(o,c)=>($y=u.dynCall_fi=ne.Xf)(o,c),qy=u.dynCall_did=(o,c,f)=>(qy=u.dynCall_did=ne.Yf)(o,c,f),Ky=u.dynCall_iiidii=(o,c,f,p,_,y)=>(Ky=u.dynCall_iiidii=ne.Zf)(o,c,f,p,_,y),Zy=u.dynCall_iiidddii=(o,c,f,p,_,y,x,C)=>(Zy=u.dynCall_iiidddii=ne._f)(o,c,f,p,_,y,x,C),Qy=u.dynCall_didii=(o,c,f,p,_)=>(Qy=u.dynCall_didii=ne.$f)(o,c,f,p,_),Jy=u.dynCall_iiiiiiidddi=(o,c,f,p,_,y,x,C,U,H,K)=>(Jy=u.dynCall_iiiiiiidddi=ne.ag)(o,c,f,p,_,y,x,C,U,H,K),eb=u.dynCall_iidd=(o,c,f,p)=>(eb=u.dynCall_iidd=ne.bg)(o,c,f,p),tb=u.dynCall_viij=(o,c,f,p,_)=>(tb=u.dynCall_viij=ne.cg)(o,c,f,p,_),nb=u.dynCall_viji=(o,c,f,p,_)=>(nb=u.dynCall_viji=ne.dg)(o,c,f,p,_),ib=u.dynCall_vijii=(o,c,f,p,_,y)=>(ib=u.dynCall_vijii=ne.eg)(o,c,f,p,_,y),rb=u.dynCall_iiijj=(o,c,f,p,_,y,x)=>(rb=u.dynCall_iiijj=ne.fg)(o,c,f,p,_,y,x),sb=u.dynCall_iiijji=(o,c,f,p,_,y,x,C)=>(sb=u.dynCall_iiijji=ne.gg)(o,c,f,p,_,y,x,C),ab=u.dynCall_vij=(o,c,f,p)=>(ab=u.dynCall_vij=ne.hg)(o,c,f,p),ob=u.dynCall_vijji=(o,c,f,p,_,y,x)=>(ob=u.dynCall_vijji=ne.ig)(o,c,f,p,_,y,x),lb=u.dynCall_viiji=(o,c,f,p,_,y)=>(lb=u.dynCall_viiji=ne.jg)(o,c,f,p,_,y),cb=u.dynCall_jiii=(o,c,f,p)=>(cb=u.dynCall_jiii=ne.kg)(o,c,f,p),ub=u.dynCall_iiiiddd=(o,c,f,p,_,y,x)=>(ub=u.dynCall_iiiiddd=ne.lg)(o,c,f,p,_,y,x),db=u.dynCall_vidii=(o,c,f,p,_)=>(db=u.dynCall_vidii=ne.mg)(o,c,f,p,_),hb=u.dynCall_vidiiii=(o,c,f,p,_,y,x)=>(hb=u.dynCall_vidiiii=ne.ng)(o,c,f,p,_,y,x),fb=u.dynCall_vidiii=(o,c,f,p,_,y)=>(fb=u.dynCall_vidiii=ne.og)(o,c,f,p,_,y),pb=u.dynCall_dj=(o,c,f)=>(pb=u.dynCall_dj=ne.pg)(o,c,f),mb=u.dynCall_vdiii=(o,c,f,p,_)=>(mb=u.dynCall_vdiii=ne.qg)(o,c,f,p,_),gb=u.dynCall_idiiiiii=(o,c,f,p,_,y,x,C)=>(gb=u.dynCall_idiiiiii=ne.rg)(o,c,f,p,_,y,x,C),_b=u.dynCall_idiiiiiii=(o,c,f,p,_,y,x,C,U)=>(_b=u.dynCall_idiiiiiii=ne.sg)(o,c,f,p,_,y,x,C,U),vb=u.dynCall_iiiidiiii=(o,c,f,p,_,y,x,C,U)=>(vb=u.dynCall_iiiidiiii=ne.tg)(o,c,f,p,_,y,x,C,U),yb=u.dynCall_viiiidiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(yb=u.dynCall_viiiidiiiiii=ne.ug)(o,c,f,p,_,y,x,C,U,H,K,se),bb=u.dynCall_iiiff=(o,c,f,p,_)=>(bb=u.dynCall_iiiff=ne.vg)(o,c,f,p,_);u.dynCall_viiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(u.dynCall_viiiiiiiiiii=ne.wg)(o,c,f,p,_,y,x,C,U,H,K,se);var xb=u.dynCall_iij=(o,c,f,p)=>(xb=u.dynCall_iij=ne.xg)(o,c,f,p),wb=u.dynCall_vidi=(o,c,f,p)=>(wb=u.dynCall_vidi=ne.yg)(o,c,f,p),Sb=u.dynCall_fii=(o,c,f)=>(Sb=u.dynCall_fii=ne.zg)(o,c,f),Mb=u.dynCall_viiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)=>(Mb=u.dynCall_viiiiiiiiiiiii=ne.Ag)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye),Eb=u.dynCall_iiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(Eb=u.dynCall_iiiiiiiiiii=ne.Bg)(o,c,f,p,_,y,x,C,U,H,K),Tb=u.dynCall_viidii=(o,c,f,p,_,y)=>(Tb=u.dynCall_viidii=ne.Cg)(o,c,f,p,_,y),Ab=u.dynCall_viiiijii=(o,c,f,p,_,y,x,C,U)=>(Ab=u.dynCall_viiiijii=ne.Dg)(o,c,f,p,_,y,x,C,U),Cb=u.dynCall_viiijjii=(o,c,f,p,_,y,x,C,U,H)=>(Cb=u.dynCall_viiijjii=ne.Eg)(o,c,f,p,_,y,x,C,U,H),Rb=u.dynCall_iiiijjii=(o,c,f,p,_,y,x,C,U,H)=>(Rb=u.dynCall_iiiijjii=ne.Fg)(o,c,f,p,_,y,x,C,U,H),Pb=u.dynCall_viiijii=(o,c,f,p,_,y,x,C)=>(Pb=u.dynCall_viiijii=ne.Gg)(o,c,f,p,_,y,x,C),Lb=u.dynCall_iiiijii=(o,c,f,p,_,y,x,C)=>(Lb=u.dynCall_iiiijii=ne.Hg)(o,c,f,p,_,y,x,C),Ib=u.dynCall_ddiiiii=(o,c,f,p,_,y,x)=>(Ib=u.dynCall_ddiiiii=ne.Ig)(o,c,f,p,_,y,x),Db=u.dynCall_iifi=(o,c,f,p)=>(Db=u.dynCall_iifi=ne.Jg)(o,c,f,p),kb=u.dynCall_iiiij=(o,c,f,p,_,y)=>(kb=u.dynCall_iiiij=ne.Kg)(o,c,f,p,_,y);u.dynCall_jiji=(o,c,f,p,_)=>(u.dynCall_jiji=ne.Lg)(o,c,f,p,_);var Fb=u.dynCall_iiiiij=(o,c,f,p,_,y,x)=>(Fb=u.dynCall_iiiiij=ne.Mg)(o,c,f,p,_,y,x);u.dynCall_viijii=(o,c,f,p,_,y,x)=>(u.dynCall_viijii=ne.Ng)(o,c,f,p,_,y,x);var Ub=u.dynCall_jiiii=(o,c,f,p,_)=>(Ub=u.dynCall_jiiii=ne.Og)(o,c,f,p,_),Ob=u.dynCall_viiiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)=>(Ob=u.dynCall_viiiiiiiiiiiiiii=ne.Pg)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke);u.dynCall_iiiiijj=(o,c,f,p,_,y,x,C,U)=>(u.dynCall_iiiiijj=ne.Qg)(o,c,f,p,_,y,x,C,U),u.dynCall_iiiiiijj=(o,c,f,p,_,y,x,C,U,H)=>(u.dynCall_iiiiiijj=ne.Rg)(o,c,f,p,_,y,x,C,U,H);var Nb=o=>(Nb=ne.Sg)(o),Bb=()=>(Bb=ne.Tg)(),zb=o=>(zb=ne.Ug)(o),Hb=()=>(Hb=ne.Vg)();u.___start_em_js=3895468,u.___stop_em_js=3896792;function yC(o,c,f){var p=Se();try{return u0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function bC(o,c,f,p){var _=Se();try{return d0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function xC(o,c){var f=Se();try{vf(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function wC(o,c){var f=Se();try{return yf(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function SC(o,c,f,p,_,y){var x=Se();try{return h0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function MC(o,c,f){var p=Se();try{f0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function EC(o){var c=Se();try{return p0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function TC(o,c,f,p,_,y){var x=Se();try{m0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function AC(o,c,f,p,_){var y=Se();try{return b0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function CC(o,c,f,p){var _=Se();try{_0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function RC(o,c,f,p,_){var y=Se();try{x0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function PC(o){var c=Se();try{g0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function LC(o,c,f){var p=Se();try{v0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function IC(o,c,f,p,_,y,x,C){var U=Se();try{return T0(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function DC(o,c,f,p,_,y,x){var C=Se();try{A0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function kC(o,c,f,p,_,y,x){var C=Se();try{return C0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function FC(o,c,f,p,_,y,x,C){var U=Se();try{$0(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function UC(o,c,f,p,_){var y=Se();try{return z0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function OC(o,c,f,p,_,y){var x=Se();try{hy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function NC(o,c,f,p){var _=Se();try{w0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function BC(o,c,f,p,_){var y=Se();try{U0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function zC(o,c,f,p){var _=Se();try{return L0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function HC(o,c,f,p,_,y,x,C,U){var H=Se();try{return N0(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function GC(o,c){var f=Se();try{return y0(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function VC(o,c,f){var p=Se();try{return F0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function WC(o,c,f){var p=Se();try{return S0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function jC(o,c,f,p,_,y){var x=Se();try{return I0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function XC(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{return k0(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function YC(o,c){var f=Se();try{D0(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function $C(o,c,f){var p=Se();try{return X0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function qC(o,c,f,p,_,y){var x=Se();try{return O0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function KC(o,c,f,p,_){var y=Se();try{M0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function ZC(o,c,f,p,_){var y=Se();try{return E0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function QC(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return B0(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function JC(o,c,f,p){var _=Se();try{return H0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function eR(o,c,f,p,_){var y=Se();try{return G0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function tR(o,c,f,p,_){var y=Se();try{return W0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function nR(o,c,f,p){var _=Se();try{V0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function iR(o,c,f,p){var _=Se();try{return R0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function rR(o,c,f,p,_,y,x,C,U){var H=Se();try{q0(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function sR(o,c,f,p,_){var y=Se();try{return K0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function aR(o,c,f){var p=Se();try{return Y0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function oR(o,c,f,p,_,y){var x=Se();try{ey(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function lR(o,c,f,p,_,y,x){var C=Se();try{Q0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function cR(o,c,f,p,_,y,x,C){var U=Se();try{return ty(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function uR(o,c,f,p,_,y,x,C){var U=Se();try{ry(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function dR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return ny(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function hR(o,c,f,p,_,y,x){var C=Se();try{J0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function fR(o,c,f,p,_,y,x){var C=Se();try{iy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function pR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{Z0(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function mR(o,c,f,p){var _=Se();try{wb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function gR(o,c,f,p,_,y,x,C,U){var H=Se();try{sy(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function _R(o,c,f,p,_,y){var x=Se();try{ay(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function vR(o,c,f,p,_,y){var x=Se();try{oy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function yR(o,c,f,p,_,y,x,C){var U=Se();try{ly(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function bR(o,c,f){var p=Se();try{return cy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function xR(o,c,f,p,_,y,x){var C=Se();try{return uy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function wR(o,c,f){var p=Se();try{dy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function SR(o,c,f,p,_){var y=Se();try{fy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function MR(o,c,f,p,_,y,x,C,U){var H=Se();try{py(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function ER(o,c,f,p,_,y,x,C,U,H,K,se,he){var ye=Se();try{return _y(o,c,f,p,_,y,x,C,U,H,K,se,he)}catch(ze){if(xe(ye),ze!==ze+0)throw ze;we(1,0)}}function TR(o,c,f){var p=Se();try{return j0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function AR(o,c,f,p,_){var y=Se();try{vy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function CR(o,c,f,p,_,y){var x=Se();try{yy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function RR(o,c,f,p){var _=Se();try{return by(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function PR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke){var at=Se();try{Ob(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)}catch(dt){if(xe(at),dt!==dt+0)throw dt;we(1,0)}}function LR(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{Sy(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function IR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{My(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function DR(o,c,f,p,_){var y=Se();try{xy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function kR(o,c){var f=Se();try{return $y(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function FR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je){var dn=Se();try{return wy(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je)}catch(zt){if(xe(dn),zt!==zt+0)throw zt;we(1,0)}}function UR(o,c,f,p,_,y,x,C,U,H,K,se,he){var ye=Se();try{return Ey(o,c,f,p,_,y,x,C,U,H,K,se,he)}catch(ze){if(xe(ye),ze!==ze+0)throw ze;we(1,0)}}function OR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye){var ze=Se();try{return Ay(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)}catch(Ke){if(xe(ze),Ke!==Ke+0)throw Ke;we(1,0)}}function NR(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{return Cy(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function BR(o,c,f,p,_,y,x,C){var U=Se();try{return Ry(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function zR(o,c,f,p,_,y,x){var C=Se();try{return Wy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function HR(o,c,f,p,_,y){var x=Se();try{return Py(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function GR(o,c,f,p,_){var y=Se();try{return Ly(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function VR(o,c,f,p,_,y,x){var C=Se();try{return Iy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function WR(o,c,f,p,_,y){var x=Se();try{return Dy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function jR(o,c,f,p){var _=Se();try{return ky(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function XR(o,c,f){var p=Se();try{return Fy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function YR(o,c,f,p,_){var y=Se();try{return Uy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function $R(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return By(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function qR(o,c,f,p){var _=Se();try{return Oy(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function KR(o,c,f,p,_,y,x){var C=Se();try{return Ny(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function ZR(o,c,f,p,_,y,x,C,U){var H=Se();try{return zy(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function QR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke){var at=Se();try{return Hy(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)}catch(dt){if(xe(at),dt!==dt+0)throw dt;we(1,0)}}function JR(o,c,f,p){var _=Se();try{return Gy(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function eP(o,c,f,p,_,y,x){var C=Se();try{return Vy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function tP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return jy(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function nP(o,c,f,p,_,y){var x=Se();try{return Xy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function iP(o,c,f,p,_){var y=Se();try{return Yy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function rP(o,c,f){var p=Se();try{return qy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function sP(o,c,f,p,_,y){var x=Se();try{return Ky(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function aP(o,c,f,p,_,y,x,C){var U=Se();try{return Zy(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function oP(o,c,f,p,_){var y=Se();try{return Qy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function lP(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return Jy(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function cP(o,c,f,p){var _=Se();try{return eb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function uP(o,c,f,p,_,y,x){var C=Se();try{return ub(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function dP(o,c,f,p,_){var y=Se();try{db(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function hP(o,c,f,p,_,y,x){var C=Se();try{hb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function fP(o,c,f,p,_,y){var x=Se();try{fb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function pP(o,c,f,p,_){var y=Se();try{mb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function mP(o,c,f,p,_,y,x,C,U){var H=Se();try{return vb(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function gP(o,c,f,p,_,y,x,C){var U=Se();try{return gb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function _P(o,c,f,p,_,y,x,C,U){var H=Se();try{return _b(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function vP(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{yb(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function yP(o,c,f,p,_){var y=Se();try{return bb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function bP(o,c,f){var p=Se();try{return Sb(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function xP(o,c,f,p,_,y,x,C,U,H,K,se,he,ye){var ze=Se();try{Mb(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)}catch(Ke){if(xe(ze),Ke!==Ke+0)throw Ke;we(1,0)}}function wP(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return Eb(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function SP(o,c,f,p,_,y){var x=Se();try{Tb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function MP(o,c,f,p,_,y,x){var C=Se();try{return Ib(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function EP(o,c,f,p){var _=Se();try{return Db(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function TP(o){var c=Se();try{return P0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function AP(o,c,f,p){var _=Se();try{return cb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function CP(o,c,f,p,_){var y=Se();try{return my(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function RP(o,c){var f=Se();try{return gy(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function PP(o,c,f,p,_){var y=Se();try{tb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function LP(o,c,f,p,_){var y=Se();try{nb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function IP(o,c,f,p,_,y){var x=Se();try{ib(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function DP(o,c,f,p,_,y,x){var C=Se();try{return rb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function kP(o,c,f,p,_,y,x,C){var U=Se();try{return sb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function FP(o,c,f,p){var _=Se();try{ab(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function UP(o,c,f){var p=Se();try{return Ty(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function OP(o,c,f,p,_,y,x){var C=Se();try{ob(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function NP(o,c,f,p,_,y){var x=Se();try{lb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function BP(o,c,f){var p=Se();try{return pb(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function zP(o,c,f,p){var _=Se();try{return xb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function HP(o,c,f,p,_,y,x,C,U){var H=Se();try{Ab(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function GP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{Cb(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function VP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return Rb(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function WP(o,c,f,p,_,y,x,C){var U=Se();try{Pb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function jP(o,c,f,p,_,y,x,C){var U=Se();try{return Lb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function XP(o,c,f,p,_,y){var x=Se();try{return kb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function YP(o,c,f,p,_,y,x){var C=Se();try{return Fb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function $P(o,c,f,p,_){var y=Se();try{return Ub(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function qP(o){o=Object.assign({},o);var c=_=>()=>_()>>>0,f=_=>y=>_(y)>>>0,p=_=>(y,x)=>_(y,x)>>>0;return o.Cd=c(o.Cd),o.Fd=f(o.Fd),o.Gd=c(o.Gd),o.Id=p(o.Id),o.Jd=f(o.Jd),o.Vd=c(o.Vd),o.Xd=f(o.Xd),o}u.addRunDependency=ke,u.removeRunDependency=Le,u.FS_createPath=R.createPath,u.FS_createLazyFile=R.createLazyFile,u.FS_createDevice=R.createDevice,u.wasmMemory=ue,u.keepRuntimeAlive=ii,u.ExitStatus=Ce,u.FS_createPreloadedFile=R.createPreloadedFile,u.FS_createDataFile=R.createDataFile,u.FS_unlink=R.unlink,u.PThread=Ee,u.FS_readdir=R.readdir,u.FS_analyzePath=R.analyzePath;var mu;ve=function o(){mu||Gb(),mu||(ve=o)};function Gb(){if(N>0)return;if(P){g(u),ut(),startWorker(u);return}if(jt(),N>0)return;function o(){mu||(mu=!0,u.calledRun=!0,!pe&&(ut(),g(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),yn()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),o()},1)):o()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return Gb(),t.ready}})();typeof _T=="object"&&typeof xg=="object"?xg.exports=yg:typeof define=="function"&&define.amd&&define([],()=>yg);globalThis["NEEDLE:USD:GET"]=yg;let Op=null;async function Az(n){if(Op)return Op;const e=globalThis["NEEDLE:USD:GET"];if(!e)throw new Error('"NEEDLE:USD:GET" not found in globalThis - please modify "emHdBindings.js" and add: globalThis["NEEDLE:USD:GET"] = getUsdModule;');const t=await Promise.all([Wl(()=>import("./emHdBindings-B2pBhR1n.js"),[]),Wl(()=>import("./emHdBindings-A46AWXYl.js"),[]),Wl(()=>import("./emHdBindings.worker-t1x5VIsg.js"),[]),Wl(()=>import("./emHdBindings.worker-CyHENA1f.js"),[]),Wl(()=>import("./emHdBindings-qRmJXJBb.js"),[])]),[i,r,s,a,l]=t,d=s,h=await fetch(r.default).then(m=>m.arrayBuffer());return Op=e({mainScriptUrlOrBlob:i.default,setStatus:m=>{console.debug("🧊 USD STATUS",m)},...n,locateFile:m=>{var v;(n==null?void 0:n.debug)===!0&&console.warn("LOCATE FILE:",m);const u=(v=n==null?void 0:n.locateFile)==null?void 0:v.call(n,m);if(u)return u;let g=null;return m.includes("emHdBindings.data")?g=r.default:m.includes("emHdBindings.wasm")?g=l.default:m.includes("emHdBindings.worker.js")&&(g=d.default),g??m},getPreloadedPackage(m,u){var v;const g=(v=n==null?void 0:n.getPreloadedPackage)==null?void 0:v.call(n,m,u);if(g)return g;if(m.includes("emHdBindings.data")&&h.byteLength!==u)throw new Error(`emHdBindings.data size mismatch: expected ${u} but got ${h.byteLength} +${r.default}`);return null}})}const Cz=!1;class Rz{constructor(e,t){this.basename=e,this.config=t,this.allPaths=t.paths,this.textures=[],this.loader=new Xh,this.tgaLoader=new uz,this.exrLoader=new eT;let r=new URLSearchParams(window.location.search).get("file");if(r){let s=r.lastIndexOf("/");s>=0&&(r=r.substring(0,s)),this.baseUrl=r}}getTexture(e){if(this.textures[e])return this.textures[e];let t,i;if(this.textures[e]=new Promise((a,l)=>{t=a,i=l}),!e)return Promise.reject(new Error("Empty resource path for file: "+e+" at "+this.basename));let r,s=e.toLowerCase();return s.indexOf(".png")>=s.length-5?r="image/png":s.indexOf(".jpg")>=s.length-5||s.indexOf(".jpeg")>=s.length-5?r="image/jpeg":s.indexOf(".exr")>=s.length-4?(console.warn("EXR textures are not fully supported yet",e),r="image/x-exr"):s.indexOf(".tga")>=s.length-4?(console.warn("TGA textures are not fully supported yet",e),r="image/tga"):console.error("Error when loading texture: unknown filetype",e),this.config.driver().getFile(e,async a=>{let l=this.loader;r==="image/tga"?l=this.tgaLoader:r==="image/x-exr"&&(l=this.exrLoader);const d=this.baseUrl;function h(m){let u;if(m){let g=new Blob([m.slice(0)],{type:r});u=URL.createObjectURL(g)}else d?u=d+"/"+e:u=e;l.load(u,g=>{g.name=e,t(g)},void 0,g=>{i(g)})}if(!a)if(d)console.log("File not found in filesystem, trying to fetch",e);else{i(new Error("Unknown file: "+e));return}h(a)}),this.textures[e]}}class Pz{constructor(e,t){this._geometry=new On,this._id=e,this._interface=t,this._points=void 0,this._normals=void 0,this._colors=void 0,this._uvs=void 0,this._indices=void 0,this._materials=[];let i=new qi({side:Si,color:new Je(11842740)});this._materials.push(i),this._mesh=new wn(this._geometry,i),this._mesh.castShadow=!0,this._mesh.receiveShadow=!0;let r=e,s=r.lastIndexOf("/");s>=0&&(r=r.substring(s+1)),this._mesh.name=r,t.config.usdRoot.add(this._mesh)}updateOrder(e,t,i=3){if(e&&this._indices){let r=[];for(let s=0;s{var a;const s=Li.usdPreviewToMeshPhysicalTextureMap[t];if(s===void 0){console.warn(`Unsupported material texture parameter '${t}'.`),i();return}if(e[t]&&e[t].nodeIn){const l=e[t].nodeIn;l.resolvedPath||console.warn("Texture node has no file!",l);const d=(a=l.resolvedPath)==null?void 0:a.replace("./",""),h=e[t].inputName;Object.keys(this._nodes).find(m=>this._nodes[m]===e),this._interface.registry.getTexture(d).then(m=>{var v,w,T,M;if(this._material||(console.error("Material not set when trying to assign texture, this is likely a bug"),i()),s==="alphaMap"){l.file===((w=(v=e.diffuseColor)==null?void 0:v.nodeIn)==null?void 0:w.file)&&h==="a"?this._material.map.format=Vn:console.warn("Separate alpha channel is currently not supported.",l.file,(M=(T=e.diffuseColor)==null?void 0:T.nodeIn)==null?void 0:M.file,h),this._material.alphaClip||(this._material.transparent=!0),this._material.needsUpdate=!0,i();return}else if(s==="metalnessMap")this._material.metalness=1;else if(s==="roughnessMap")this._material.roughness=1;else if(s==="emissiveMap")this._material.emissive=new Je(16777215);else if(!Li.channelMap[h]){console.warn(`Unsupported texture channel '${h}'!`),i();return}const u=m.clone();let g="rgba";if(s=="roughnessMap"&&h!="g"&&(g="0"+h+"11"),s=="metalnessMap"&&h!="b"&&(g="01"+h+"1"),s=="occlusionMap"&&h!="r"&&(g=h+"111"),s=="opacityMap"&&h!="a"&&(g=h+h+h+h),u.colorSpace=Li.usdPreviewToColorSpaceMap[t]||Sn,g!="rgba"&&(u.image=Li._swizzleImageChannels(u.image,g)),u.format=Li.channelMap[h],u.needsUpdate=!0,l.st&&l.st.nodeIn){const b=l.st.nodeIn,A=b.rotation?b.rotation/180*Math.PI:0,E=b.translation?new et(b.translation[0],b.translation[1]):new et(0,0),P=b.scale?new et(b.scale[0],b.scale[1]):new et(1,1),G=Math.sin(A),O=Math.cos(A);E.y=E.y-(1-O)*P.y,E.x=E.x-G*P.x,u.repeat.set(P.x,P.y),u.offset.set(E.x,E.y),u.rotation=A}u.wrapS=this.convertWrap(l.wrapS),u.wrapT=this.convertWrap(l.wrapT),this._material[s]=u,this._material.needsUpdate=!0,i()}).catch(m=>{console.warn("Error when loading texture",m),i()})}else{this._material[s]=void 0,i();return}})}static SRGBToLinear(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}static LinearToSRGB(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}static _swizzleImageChannels(e,t){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=e.width,i.height=e.height;const r=i.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),a=s.data,l={r:0,g:1,b:2,a:3,x:0,y:1,z:2,w:3,0:4,1:5,"-":-1},d=[4,4,4,4];for(let m=0;m0&&(this._material.transparent=!1,this._material.alphaClip=!0)))}async updateFinished(e,t){for(let d of t)d.nodeIn=this._nodes[d.inputId],d.nodeOut=this._nodes[d.outputId],d.nodeIn[d.inputName]=d,d.nodeOut[d.outputName]=d;let i;for(let d of Object.values(this._nodes))if(d.diffuseColor){i=d;break}if(!i||Cz){this._material=Jl;return}this._material=new qi({}),this._material.side=Si;let r=this._id,s=r.lastIndexOf("/");s>=0&&(r=r.substring(s+1)),this._material.name=r;const a=!!(i.roughness&&i.roughness.nodeIn),l=!!(i.metallic&&i.metallic.nodeIn);i.occlusion&&i.occlusion.nodeIn;{const d=[];for(let h in Li.usdPreviewToMeshPhysicalTextureMap)d.push(this.assignTexture(i,h));await Promise.all(d),a&&!l?(this._material.metalnessMap=this._material.roughnessMap,this._material.metalnessMap?this._material.metalnessMap.needsUpdate=!0:console.error("Something went wrong with the texture promise; haveRoughnessMap is true but no roughnessMap was loaded.")):l&&!a?(this._material.roughnessMap=this._material.metalnessMap,this._material.roughnessMap?this._material.roughnessMap.needsUpdate=!0:console.error("Something went wrong with the texture promise; haveMetalnessMap is true but no metalnessMap was loaded.")):l&&a&&console.warn("TODO: [Three USD] separate metalness and roughness textures need to be merged")}for(let d in Li.usdPreviewToMeshPhysicalMap)this.assignProperty(i,d)}};Ve(Li,"usdPreviewToMeshPhysicalTextureMap",{diffuseColor:"map",clearcoat:"clearcoatMap",clearcoatRoughness:"clearcoatRoughnessMap",emissiveColor:"emissiveMap",occlusion:"aoMap",roughness:"roughnessMap",metallic:"metalnessMap",normal:"normalMap",opacity:"alphaMap"}),Ve(Li,"usdPreviewToColorSpaceMap",{diffuseColor:on,emissiveColor:on,opacity:on}),Ve(Li,"channelMap",{r:Vn,g:Vn,b:Vn,rgb:Vn,rgba:Vn}),Ve(Li,"usdPreviewToMeshPhysicalMap",{clearcoat:"clearcoat",clearcoatRoughness:"clearcoatRoughness",diffuseColor:"color",emissiveColor:"emissive",ior:"ior",metallic:"metalness",opacity:"opacity",roughness:"roughness",opacityThreshold:"alphaTest"});let bg=Li;class Lz{constructor(e,t){this.config=t,this.registry=new Rz(e,t),this.materials={},this.meshes={}}createRPrim(e,t,i){let r=new Pz(t,this);return this.meshes[t]=r,r}createBPrim(e,t){}createSPrim(e,t){if(e==="material"){let i=new bg(t,this);return this.materials[t]=i,i}else return}CommitResources(){for(const e in this.meshes)this.meshes[e].commit()}}function Iz(n){const e=new Uint8Array(n,0,16);return e[0]==80&&e[1]==75&&e[2]==3&&e[3]==4?"usdz":e[0]==80&&e[1]==88&&e[2]==82&&e[3]==45&&e[4]==85&&e[5]==83&&e[6]==68&&e[7]==67?"usd":"unknown"}async function Dz(n){if(typeof n.filepath!="string")throw new Error("Filepath must be a string");let e=n.filepath,t=n.buffer;t||(t=await(await fetch(e)).arrayBuffer()),e=e.replaceAll(/\\/g,"/").replaceAll("/","_");const i=Iz(t),r=e.split(".").pop();return r!=="usdz"&&r!=="usd"&&r!=="usda"?i==="usdz"||i==="usd"||i==="usda"?e+="."+i:(console.warn("Unknown file format - assuming .usdz"),e+=".usdz"):i!==r&&console.warn("File extension does not match file format",{ext:r,format:i}),n.USD.FS_createDataFile("",e,new Uint8Array(t),!0,!0,!0),e}async function kz(n){const e=n.debug||!1;n.USD.debug=e,e&&console.log("USD",n.USD),await n.USD.ready.catch(console.error);const{usdz:t,buffer:i,USD:r}=n,s=await Dz({USD:r,filepath:t,buffer:i});let a=null;const l={usdRoot:n.scene,paths:new Array,driver:()=>a},d=new Lz(s,l);a=new n.USD.HdWebSyncDriver(d,s),a instanceof Promise&&(a=await a);const h=a;e&&console.log("DRIVER",h);let m=h.GetStage();h.Draw();let u=0;return e&&console.log("STAGE",m),{driver:a,update:g=>{if(h.isDeleted()){e&&(n["debug:delete"]===void 0&&console.error("Called update for three hydra after it was deleted!"),n["debug:delete"]=!0);return}u+=g;let v=u*m.GetTimeCodesPerSecond();v=v%(m.GetEndTimeCode()-m.GetStartTimeCode()),h.SetTime(v),h.Draw()},dispose:()=>{e&&console.warn("Disposing Three Hydra"),a=null,n.USD.FS_unlink(s),h.delete(),e&&console.warn("Disposed Three Hydra")}}}class Fz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["usdz"])}load({url:t,onLoad:i}){Az({mainScriptUrlOrBlob:"/extensions/ComfyUI-Rodin/threeVisualizer/external/emHdBindings.js"}).then(async r=>{const s=t,a=new kc;await kz({USD:r,usdz:s,scene:a}).catch(l=>{console.error("unsupport usd",l)}),setTimeout(()=>{var d;const l=(d=a.children)==null?void 0:d[0];l.updateMatrix(),i(Nn._setUserData(l))},1e3)})}}class Uz extends sl{constructor(t){super();Ve(this,"_sceneManager",new xz);Ve(this,"_index");this._index=t}async start(){try{await this._init(),await this._prepareScene(),await this._enterScene()}catch(t){console.error(t)}}async _init(){const t=this.viewer;t.addLoader(u4),t.addLoader(W4),t.addLoader(c4),t.addLoader(wz),t.addLoader(Sz),t.addLoader(Mz),t.addLoader(Fz)}async _prepareScene(){const t=this.viewer;this._sceneManager.registerScene("HomeScene",new vz(t,this._index)),await this._sceneManager.prepareScene()}async _enterScene(){this._sceneManager.runScene("HomeScene")}update(t){this._sceneManager.updateScene(t)}onDestroy(){this._sceneManager.clear()}}const Oz="_categorySelection_xm8rv_1",Nz="_dragging_xm8rv_1",Bz="_categoryContent_xm8rv_21",zz="_categoryItem_xm8rv_26",Hz="_bottomSDFPreview_xm8rv_40",Gz="_active_xm8rv_51",Vz="_container_xm8rv_61",Wz={categorySelection:Oz,dragging:Nz,categoryContent:Bz,categoryItem:zz,bottomSDFPreview:Hz,active:Gz,container:Vz},jz="_loadingContainer_ebap8_42",Xz="_rodinBg_ebap8_50",Yz="_loadingBox_ebap8_55",$z="_loading_ebap8_42",qz="_white_ebap8_75",Kz="_loadingText_ebap8_93",yr={loadingContainer:jz,rodinBg:Xz,loadingBox:Yz,loading:$z,"rotate-loading":"_rotate-loading_ebap8_1",white:qz,loadingText:Kz,"loading-text-opacity":"_loading-text-opacity_ebap8_1"},Zz=({color:n,type:e="defalut"})=>({defalut:an.jsx("div",{className:`${yr.loadingContainer} ${n?yr.white:""}`,children:an.jsxs("div",{className:yr.loadingBox,children:[an.jsx("div",{className:yr.loading}),an.jsx("div",{className:yr.loadingText,children:"Deemos"})]})}),rodin:an.jsx("div",{className:`${yr.loadingContainer} ${yr.rodinBg} ${n?yr.white:""}`,children:an.jsxs("div",{className:yr.loadingBox,children:[an.jsx("div",{className:yr.loading}),an.jsx("div",{className:yr.loadingText,children:"Deemos"})]})})})[e];function Qz({renderMode:n,index:e=0}){const[t,i]=Xn.useState(null),r=Xn.useRef(null),[s,a]=Xn.useState(null),[l,d]=Xn.useState(!0),h=Xn.useRef();return Xn.useEffect(()=>{if(s){const m=()=>{const u=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,g=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;r.current.resize(u,g)};return window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}}},[s]),Xn.useEffect(()=>{r.current&&(["Tracer"].includes(n)?r.current.stop():r.current.start())},[n]),Xn.useEffect(()=>{if(t)try{const m=new kt({autoResize:!1,canvas:t,antialias:!0,alpha:!0,toneMapping:7,loader:{onLoad:()=>d(!1)}});m.addNode(new Uz(e)),r.current=m;const u=g=>d(g);return rr[e].onLoading(u),()=>{m.scene.environment=null,m.scene.remove(...m.scene.children),m.destroy(),rr[e].destroy(),Z4(),rr[e].offLoading(u)}}catch(m){console.error(m)}},[t]),an.jsxs("aside",{className:"w-full h-full select-none overflow-hidden flex justify-center items-center",style:{background:"var(--background)","--background":"radial-gradient(circle at center, rgba(165, 202, 243, 90%), rgba(165, 202, 243, 90%) 40%, rgba(33, 51, 72, 70%))"},id:"canvas-scene",ref:a,children:[Xn.useMemo(()=>an.jsx(an.Fragment,{children:an.jsx("canvas",{ref:i,className:"outline-none hover:cursor-grab active:cursor-grabbing w-full h-full"})}),[]),an.jsx("div",{className:Wz.container,ref:h}),an.jsx("div",{className:"outline-none absolute top-0 left-0 right-0 bottom-0 pointer-events-none",style:{background:"var(--background-tracer)",boxShadow:"inset 0 0 60px rgb(30, 30, 30, 0.7)"},children:l&&an.jsx(Zz,{color:!0,type:"rodin"})})]})}const Jz="_container_c3wv7_1",eH="_header_c3wv7_9",tH="_mobileContainer_c3wv7_16",nH="_creatorBox_c3wv7_23",iH="_avatar_c3wv7_34",rH="_creatorInfoCon_c3wv7_49",sH="_creatorName_c3wv7_56",aH="_creatorInfo_c3wv7_49",oH="_shareCon_c3wv7_77",lH="_shared_c3wv7_96",cH="_hideOnSmallScreen_c3wv7_108",uH="_titleBtn_c3wv7_114",dH="_like_c3wv7_130",hH="_unLike_c3wv7_135",fH="_animateContainer_c3wv7_140",pH="_box_c3wv7_149",mH="_center_c3wv7_170",gH="_opacityChange_c3wv7_1",_H="_body_c3wv7_281",vH="_loadingOverlay_c3wv7_294",yH="_modelContainer_c3wv7_307",bH="_modelIframe_c3wv7_313",xH="_clickArea_c3wv7_319",wH="_carouselContainer_c3wv7_326",SH="_sdfPreview_c3wv7_336",MH="_fadeIn_c3wv7_350",EH="_slider_c3wv7_354",TH="_dragging_c3wv7_354",AH="_categorySelection_c3wv7_359",CH="_sliderBar_c3wv7_378",RH="_categoryContent_c3wv7_405",PH="_categoryBottom_c3wv7_410",LH="_categoryItem_c3wv7_420",IH="_bottomSDFPreview_c3wv7_434",DH="_active_c3wv7_474",kH="_black_c3wv7_520",FH="_red_c3wv7_527",UH="_grey_c3wv7_534",OH="_colorful_c3wv7_541",NH="_gradient_c3wv7_548",BH="_hoverListWrapper_c3wv7_636",zH="_Icon_c3wv7_648",HH="_hoverList_c3wv7_636",GH="_tracerSwitch_c3wv7_675",VH="_signalButton_c3wv7_693",WH="_tracerOn_c3wv7_704",jH="_Brand_c3wv7_744",XH="_brandTitle_c3wv7_760",YH="_closeIcon_c3wv7_764",$H="_border_c3wv7_769",qH="_close_c3wv7_764",KH="_hoverpluginItem_c3wv7_797",ZH="_tempBody_c3wv7_837",QH="_tempContent_c3wv7_853",JH="_downloadImgBtn_c3wv7_877",e8="_loading_c3wv7_294",gd={container:Jz,header:eH,mobileContainer:tH,creatorBox:nH,avatar:iH,creatorInfoCon:rH,creatorName:sH,creatorInfo:aH,shareCon:oH,shared:lH,hideOnSmallScreen:cH,titleBtn:uH,like:dH,unLike:hH,animateContainer:fH,box:pH,center:mH,opacityChange:gH,"top-left":"_top-left_c3wv7_200","top-right":"_top-right_c3wv7_220","bottom-left":"_bottom-left_c3wv7_240","bottom-right":"_bottom-right_c3wv7_260",body:_H,loadingOverlay:vH,modelContainer:yH,modelIframe:bH,clickArea:xH,carouselContainer:wH,sdfPreview:SH,fadeIn:MH,slider:EH,dragging:TH,categorySelection:AH,sliderBar:CH,categoryContent:RH,categoryBottom:PH,categoryItem:LH,bottomSDFPreview:IH,active:DH,black:kH,red:FH,grey:UH,colorful:OH,gradient:NH,hoverListWrapper:BH,Icon:zH,hoverList:HH,tracerSwitch:GH,signalButton:VH,tracerOn:WH,Brand:jH,brandTitle:XH,closeIcon:YH,border:$H,close:qH,hoverpluginItem:KH,tempBody:ZH,tempContent:QH,downloadImgBtn:JH,loading:e8},t8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAsCAMAAAAHH4uhAAAAb1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8v0wLRAAAAJHRSTlMABgkMDxIfFhwiGSbxhnUpSTzIw7lmqI2TWVDk48mBQzKOf1vO4PlOAAABdklEQVRIx+3Vy5KCMBAFUDEQE54J+H7PDP//jdPdpiZdhIjMwpXXDaY8dTsYdPHJ/5Iks8Ugs9jSBa5esn+oOWwgxpKepMmCVF53Ze9SdptGTFFiwnT9IFtD9KkTDbGAQmu8E+vqsh9NWVNpdMyq92m/d2v2tkL5gjsbCbHnuOT7YwUWndaGLRnc55hL2WRr7dL6tS4dkThoym7MvijIFWz6kmBwYESaMVgVLnsOaZfhpBn7Ci+Ng3z8DGQwKsJj73Mk2dzY0p1gMtK42vlPnW4Ijye/slv5xiHMv1jBel9deubyZ1BeY0fuqjzkcVBJux1zrZVRSFIpqX8C2h60VIqcg2ElSm3r1j/IbXXX6FzhGHxIPKIQc6ghG4vXkrsAumGRBgEGzu8wvLFpBqW5GiSHOnDRJ3lJ0xKlKHqBWqET0BeBj2mJ+iAi5vriUpDlSXF3EISTlEeIF35YkaJFLZCg8myKUpx5sNn/Ogko5qYty+KTt+UXu/NCZQQvRfsAAAAASUVORK5CYII=";function n8(n){const e=n.match(/(.*\/).*$/);return e?e[1]:""}const XS=[{name:"PBR",symbol:"PBR"},{name:"Shaded",symbol:"Shaded"}];function i8({index:n=0}){const e=lz[n](),[t,i]=Xn.useState({model:"",texture_diffuse:"",texture_normal:"",texture_pbr:"",shaded:""}),[r,s]=Xn.useState("PBR");return Xn.useEffect(()=>{const a=({data:{model_path:l}})=>{const d=n8(l);i({model:"/viewfile?"+new URLSearchParams({filepath:l}),texture_diffuse:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_diffuse.png`}),texture_normal:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_normal.png`}),texture_pbr:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_pbr.png`}),shaded:"/viewfile?"+new URLSearchParams({filepath:`${d}shaded.png`})})};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[]),Xn.useEffect(()=>{e.states.ModelAssets={model:t.model,texture_diffuse:t.texture_diffuse,texture_normal:t.texture_normal,texture_pbr:t.texture_pbr,shaded:t.shaded}},[t]),Xn.useEffect(()=>{e.states.renderMode=r},[r]),an.jsxs(an.Fragment,{children:[an.jsx("main",{className:"flex h-5/6 w-5/6 flex-col items-center justify-center gap-0 relative",children:an.jsx("div",{className:"relative flex min-h-0 w-full grow flex-col items-center justify-center bg-white",children:an.jsx(Qz,{index:n,renderMode:r})})}),an.jsxs("div",{className:`${gd.hoverListWrapper}`,children:[an.jsx("div",{className:`${gd.Icon}`,children:an.jsx("img",{src:t8,alt:"viewSwitch"})}),an.jsx("ul",{className:`${gd.hoverList}`,children:XS.slice(0,XS.length).map((a,l)=>an.jsx("li",{onClick:()=>{s(a.symbol)},className:`${gd.hoverpluginItem} `,children:a.name},l))})]})]})}sE(document.getElementById("root")).render(an.jsx(Xn.StrictMode,{children:an.jsx(i8,{})}))});export default r8(); diff --git a/web/threeVisualizer/assets/index-DfT-kUaP.css b/web/threeVisualizer/assets/index-DfT-kUaP.css new file mode 100644 index 0000000..6165da8 --- /dev/null +++ b/web/threeVisualizer/assets/index-DfT-kUaP.css @@ -0,0 +1 @@ +._categorySelection_xm8rv_1._dragging_xm8rv_1{opacity:0;bottom:-240px}._categorySelection_xm8rv_1{position:absolute;width:60%;bottom:0;left:50%;transform:translate(-50%);display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:3;transition:bottom .4s ease,opacity .4s ease}._categoryContent_xm8rv_21{display:flex;gap:16px}._categoryItem_xm8rv_26{flex-shrink:0;flex-grow:0;width:var(--categoryItemSize);height:var(--categoryItemSize);box-shadow:0 4px 10px #00000040;border-radius:12px;position:relative;z-index:2;cursor:pointer;transition:transform .3s ease,margin .3s ease;overflow:hidden}._bottomSDFPreview_xm8rv_40{border-radius:inherit}._categoryItem_xm8rv_26:hover{transform:scale(1.09)}._active_xm8rv_51._categoryItem_xm8rv_26{transform:translateY(-5px) scale(1.3)}._active_xm8rv_51._categoryItem_xm8rv_26{margin:0 6px}@media (min-height: 1080px){._container_xm8rv_61{--carouseSize: 400px;--categoryItemSize: 74px}}@media (min-height: 1200px){._container_xm8rv_61{--carouseSize: 450px;--categoryItemSize: 84px}}@media (min-height: 1440px){._container_xm8rv_61{--carouseSize: 550px;--categoryItemSize: 94px}}@media (max-height: 1080px){._container_xm8rv_61{--carouseSize: 400px;--categoryItemSize: 80px}}@media (max-height: 1024px){._container_xm8rv_61{--carouseSize: 350px;--categoryItemSize: 64px}}@media (max-height: 900px){._container_xm8rv_61{--carouseSize: 300px;--categoryItemSize: 64px;--fs: 16px;--mt: 10px}}@media (max-height: 800px){._container_xm8rv_61{--carouseSize: 300px;--categoryItemSize: 64px}}@media (max-height: 640px){._container_xm8rv_61{--carouseSize: 200px;--categoryItemSize: 50px}}@keyframes _rotate-loading_ebap8_1{0%{transform:rotate(0);-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);-moz-transform:rotate(0deg)}to{transform:rotate(360deg);-ms-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);-moz-transform:rotate(360deg)}}@keyframes _loading-text-opacity_ebap8_1{0%{opacity:1}25%{opacity:.5}50%{opacity:0}75%{opacity:.5}to{opacity:1}}._loadingContainer_ebap8_42{height:100%;width:100%;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000}._loadingBox_ebap8_55{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}._loading_ebap8_42{width:100px;height:100px;border-radius:100%}._loading_ebap8_42{border:4px solid transparent;border-color:transparent #4500d966 transparent #4500d966;animation:_rotate-loading_ebap8_1 1.5s linear 0s infinite normal;transform-origin:50% 50%}._loadingContainer_ebap8_42._white_ebap8_75 ._loading_ebap8_42{border-color:transparent #fff transparent #fff}._loadingContainer_ebap8_42:hover ._loading_ebap8_42{border-color:transparent var(--theme-color) transparent var(--theme-color)}._loadingContainer_ebap8_42._white_ebap8_75:hover ._loading_ebap8_42{border-color:transparent #fff transparent #fff}._loadingContainer_ebap8_42:hover ._loading_ebap8_42,._loadingContainer_ebap8_42 ._loading_ebap8_42{transition:all .5s ease-in-out}._loadingText_ebap8_93{animation:_loading-text-opacity_ebap8_1 2s linear 0s infinite normal;color:#4500d966;font-family:Helvetica Neue,Helvetica,Arial,Roboto,ui-sans-serif,-apple-system,system-ui,BlinkMacSystemFont,sans-serif;font-size:10px;font-weight:700;margin-top:45px;opacity:0;position:absolute;text-align:center;text-transform:uppercase;top:0;width:100px}._loadingContainer_ebap8_42._white_ebap8_75 ._loadingText_ebap8_93{color:#fff}.clr-picker{display:none;flex-wrap:wrap;position:absolute;width:200px;z-index:1000;border-radius:10px;background-color:#fff;justify-content:flex-end;direction:ltr;box-shadow:0 0 5px #0000000d,0 5px 20px #0000001a;-moz-user-select:none;-webkit-user-select:none;user-select:none}.clr-picker.clr-open,.clr-picker[data-inline=true]{display:flex}.clr-picker[data-inline=true]{position:relative}.clr-gradient{position:relative;width:100%;height:100px;margin-bottom:15px;border-radius:3px 3px 0 0;background-image:linear-gradient(#0000,#000),linear-gradient(90deg,#fff,currentColor);cursor:pointer}.clr-marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:currentColor;cursor:pointer}.clr-picker input[type=range]::-webkit-slider-runnable-track{width:100%;height:16px}.clr-picker input[type=range]::-webkit-slider-thumb{width:16px;height:16px;-webkit-appearance:none}.clr-picker input[type=range]::-moz-range-track{width:100%;height:16px;border:0}.clr-picker input[type=range]::-moz-range-thumb{width:16px;height:16px;border:0}.clr-hue{background-image:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.clr-hue,.clr-alpha{position:relative;width:calc(100% - 40px);height:8px;margin:5px 20px;border-radius:4px}.clr-alpha span{display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.clr-hue input[type=range],.clr-alpha input[type=range]{position:absolute;width:calc(100% + 32px);height:16px;left:-16px;top:-4px;margin:0;background-color:transparent;opacity:0;cursor:pointer;-moz-appearance:none;appearance:none;-webkit-appearance:none}.clr-hue div,.clr-alpha div{position:absolute;width:16px;height:16px;left:0;top:50%;margin-left:-8px;transform:translateY(-50%);border:2px solid #fff;border-radius:50%;background-color:currentColor;box-shadow:0 0 1px #888;pointer-events:none}.clr-alpha div:before{content:"";position:absolute;height:100%;width:100%;left:0;top:0;border-radius:50%;background-color:currentColor}.clr-format{display:none;order:1;width:calc(100% - 40px);margin:0 20px 20px}.clr-segmented{display:flex;position:relative;width:100%;margin:0;padding:0;border:1px solid #ddd;border-radius:15px;box-sizing:border-box;color:#999;font-size:12px}.clr-segmented input,.clr-segmented legend{position:absolute;width:100%;height:100%;margin:0;padding:0;border:0;left:0;top:0;opacity:0;pointer-events:none}.clr-segmented label{flex-grow:1;margin:0;padding:4px 0;font-size:inherit;font-weight:400;line-height:initial;text-align:center;cursor:pointer}.clr-segmented label:first-of-type{border-radius:10px 0 0 10px}.clr-segmented label:last-of-type{border-radius:0 10px 10px 0}.clr-segmented input:checked+label{color:#fff;background-color:#666}.clr-swatches{order:2;width:calc(100% - 32px);margin:0 16px}.clr-swatches div{display:flex;flex-wrap:wrap;padding-bottom:12px;justify-content:center}.clr-swatches button{position:relative;width:20px;height:20px;margin:0 4px 6px;padding:0;border:0;border-radius:50%;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;cursor:pointer}.clr-swatches button:after{content:"";display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 0 1px #0000001a}input.clr-color{order:1;width:calc(100% - 80px);height:32px;margin:15px 20px 20px auto;padding:0 10px;border:1px solid #ddd;border-radius:16px;color:#444;background-color:#fff;font-family:sans-serif;font-size:14px;text-align:center;box-shadow:none}input.clr-color:focus{outline:none;border:1px solid #1e90ff}.clr-close,.clr-clear{display:none;order:2;height:24px;margin:0 20px 20px;padding:0 20px;border:0;border-radius:12px;color:#fff;background-color:#666;font-family:inherit;font-size:12px;font-weight:400;cursor:pointer}.clr-close{display:block;margin:0 20px 20px auto}.clr-preview{position:relative;width:32px;height:32px;margin:15px 0 20px 20px;border-radius:50%;overflow:hidden}.clr-preview:before,.clr-preview:after{content:"";position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.clr-preview:after{border:0;background-color:currentColor;box-shadow:inset 0 0 0 1px #0000001a}.clr-preview button{position:absolute;width:100%;height:100%;z-index:1;margin:0;padding:0;border:0;border-radius:50%;outline-offset:-2px;background-color:transparent;text-indent:-9999px;cursor:pointer;overflow:hidden}.clr-marker,.clr-hue div,.clr-alpha div,.clr-color{box-sizing:border-box}.clr-field{display:inline-block;position:relative;color:transparent}.clr-field input{margin:0;direction:ltr}.clr-field.clr-rtl input{text-align:right}.clr-field button{position:absolute;width:30px;height:100%;right:0;top:50%;transform:translateY(-50%);margin:0;padding:0;border:0;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;pointer-events:none}.clr-field.clr-rtl button{right:auto;left:0}.clr-field button:after{content:"";display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 1px #00000080}.clr-alpha,.clr-alpha div,.clr-swatches button,.clr-preview:before,.clr-field button{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.clr-marker:focus{outline:none}.clr-keyboard-nav .clr-marker:focus,.clr-keyboard-nav .clr-hue input:focus+div,.clr-keyboard-nav .clr-alpha input:focus+div,.clr-keyboard-nav .clr-segmented input:focus+label{outline:none;box-shadow:0 0 0 2px #1e90ff,0 0 2px 2px #fff}.clr-picker[data-alpha=false] .clr-alpha{display:none}.clr-picker[data-minimal=true]{padding-top:16px}.clr-picker[data-minimal=true] .clr-gradient,.clr-picker[data-minimal=true] .clr-hue,.clr-picker[data-minimal=true] .clr-alpha,.clr-picker[data-minimal=true] .clr-color,.clr-picker[data-minimal=true] .clr-preview{display:none}.clr-dark{background-color:#444}.clr-dark .clr-segmented{border-color:#777}.clr-dark .clr-swatches button:after{box-shadow:inset 0 0 0 1px #ffffff4d}.clr-dark input.clr-color{color:#fff;border-color:#777;background-color:#555}.clr-dark input.clr-color:focus{border-color:#1e90ff}.clr-dark .clr-preview:after{box-shadow:inset 0 0 0 1px #ffffff80}.clr-dark .clr-alpha,.clr-dark .clr-alpha div,.clr-dark .clr-swatches button,.clr-dark .clr-preview:before{background-image:repeating-linear-gradient(45deg,#666 25%,transparent 25%,transparent 75%,#888 75%,#888),repeating-linear-gradient(45deg,#888 25%,#444 25%,#444 75%,#888 75%,#888)}.clr-picker.clr-polaroid{border-radius:6px;box-shadow:0 0 5px #0000001a,0 5px 30px #0003}.clr-picker.clr-polaroid:before{content:"";display:block;position:absolute;width:16px;height:10px;left:20px;top:-10px;border:solid transparent;border-width:0 8px 10px 8px;border-bottom-color:currentColor;box-sizing:border-box;color:#fff;filter:drop-shadow(0 -4px 3px rgba(0,0,0,.1));pointer-events:none}.clr-picker.clr-polaroid.clr-dark:before{color:#444}.clr-picker.clr-polaroid.clr-left:before{left:auto;right:20px}.clr-picker.clr-polaroid.clr-top:before{top:auto;bottom:-10px;transform:rotate(180deg)}.clr-polaroid .clr-gradient{width:calc(100% - 20px);height:120px;margin:10px;border-radius:3px}.clr-polaroid .clr-hue,.clr-polaroid .clr-alpha{width:calc(100% - 30px);height:10px;margin:6px 15px;border-radius:5px}.clr-polaroid .clr-hue div,.clr-polaroid .clr-alpha div{box-shadow:0 0 5px #0003}.clr-polaroid .clr-format{width:calc(100% - 20px);margin:0 10px 15px}.clr-polaroid .clr-swatches{width:calc(100% - 12px);margin:0 6px}.clr-polaroid .clr-swatches div{padding-bottom:10px}.clr-polaroid .clr-swatches button{width:22px;height:22px}.clr-polaroid input.clr-color{width:calc(100% - 60px);margin:10px 10px 15px auto}.clr-polaroid .clr-clear{margin:0 10px 15px}.clr-polaroid .clr-close{margin:0 10px 15px auto}.clr-polaroid .clr-preview{margin:10px 0 15px 10px}.clr-picker.clr-large{width:275px}.clr-large .clr-gradient{height:150px}.clr-large .clr-swatches button{width:22px;height:22px}.clr-picker.clr-pill{width:380px;padding-left:180px;box-sizing:border-box}.clr-pill .clr-gradient{position:absolute;width:180px;height:100%;left:0;top:0;margin-bottom:0;border-radius:3px 0 0 3px}.clr-pill .clr-hue{margin-top:20px}._container_c3wv7_1{display:flex;flex-direction:column;width:56%;height:100%;padding:0 12px}._header_c3wv7_9{width:100%;display:flex;margin-bottom:16px;position:relative}._mobileContainer_c3wv7_16{width:100%;padding:0}._creatorBox_c3wv7_23{display:flex;justify-content:flex-start;align-items:center;width:calc(100% - 336px);flex-shrink:0;min-width:150px;margin-right:auto}._avatar_c3wv7_34{flex-shrink:0;height:3rem;width:3rem;border-radius:1.5rem;overflow:hidden;margin-right:1rem;margin-left:0}._avatar_c3wv7_34 img{height:3rem;width:3rem}._creatorInfoCon_c3wv7_49{text-align:left;flex-shrink:1;flex-grow:0;overflow:hidden}._creatorName_c3wv7_56{line-height:1.8rem;font-size:1.2rem;font-weight:700;color:var(--font-dark-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._creatorInfo_c3wv7_49{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2rem;font-size:1rem;color:var(--font-gray-color)}._shareCon_c3wv7_77{flex-shrink:0;height:3rem;border-radius:var(--radius);background-color:var(--bg-gray0-color);display:flex;justify-content:center;align-items:center;cursor:pointer;-webkit-user-select:none;user-select:none;font-size:1.2rem;margin-left:1rem;width:fit-content;padding:0 1rem;transition:background-color .3s ease;color:#333}._shareCon_c3wv7_77:not(._shared_c3wv7_96):hover{background-color:#ecececcc}._shareCon_c3wv7_77 span{margin-right:.5rem}._shared_c3wv7_96{background-color:#0f03}@media (max-height: 768px){._hideOnSmallScreen_c3wv7_108{display:none!important}}._titleBtn_c3wv7_114{flex-shrink:0;width:3rem;height:3rem;border-radius:var(--radius);background-color:var(--bg-gray0-color);color:var(--bg-gray1-color);display:flex;justify-content:center;align-items:center;cursor:pointer;-webkit-user-select:none;user-select:none;font-size:1.2rem;margin-left:1rem}._titleBtn_c3wv7_114._like_c3wv7_130{background-color:#fa2d5380;color:#fa2d53}._unLike_c3wv7_135:hover{background-color:#ececec}._animateContainer_c3wv7_140{position:absolute;top:50px;left:30px;width:150px;height:150px;z-index:100000}._box_c3wv7_149{position:absolute;transition:all .5s cubic-bezier(.76,-.68,.68,1.56),z-index .15s ease;border-radius:12px;width:120px;height:120px;overflow:hidden;cursor:pointer;background:#d8e3ff}._box_c3wv7_149 img{padding:10px;width:100%;height:100%;object-fit:contain}._box_c3wv7_149:not(._center_c3wv7_170):hover{transform:scale(1.1);z-index:3!important;animation:_opacityChange_c3wv7_1 .3s linear;opacity:1}@keyframes _opacityChange_c3wv7_1{0%{opacity:1}50%{opacity:.8}to{opacity:1}}._center_c3wv7_170{top:47%;left:49%;transform:translate(-50%,-50%);width:105px;height:105px;box-shadow:0 0 8px 8px #0000000d}._top-left_c3wv7_200{top:0;left:0;width:53px;height:53px;opacity:.9}._top-left_c3wv7_200:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#d3d3d333;z-index:1}._top-right_c3wv7_220{top:-20px;left:60%;width:63px;height:63px;opacity:.9}._top-right_c3wv7_220:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#d3d3d333;z-index:1}._bottom-left_c3wv7_240{top:66%;left:10px;width:57px;height:57px;opacity:.9}._bottom-left_c3wv7_240:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#d3d3d333;z-index:1}._bottom-right_c3wv7_260{top:56%;left:58%;width:52px;height:52px;opacity:.9}._bottom-right_c3wv7_260:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#d3d3d333;z-index:1}._body_c3wv7_281{background-color:#f8f8f8;border-radius:8px;height:100%;width:100%;display:flex;justify-content:center;align-items:center;position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}._loadingOverlay_c3wv7_294{position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;display:flex;justify-content:center;align-items:center;z-index:10}._modelContainer_c3wv7_307{width:100%;height:100%;z-index:1000}._modelIframe_c3wv7_313{height:100%;width:100%;border:none}._clickArea_c3wv7_319{width:100%;height:var(--carouseSize);display:flex;justify-content:center}._carouselContainer_c3wv7_326{width:var(--carouseSize);height:var(--carouseSize);border-radius:16px;cursor:pointer;position:relative;z-index:1;overflow:hidden}._sdfPreview_c3wv7_336{border-radius:inherit;transition:opacity .15s ease-in-out}@keyframes _fadeIn_c3wv7_350{0%{opacity:.5}to{opacity:1}}._fadeIn_c3wv7_350{animation:_fadeIn_c3wv7_350 .4s ease-out forwards}._slider_c3wv7_354._dragging_c3wv7_354{opacity:1;bottom:20px}._categorySelection_c3wv7_359._dragging_c3wv7_354{opacity:0;bottom:-240px}._slider_c3wv7_354{position:absolute;left:50%;transform:translate(-50%);width:90%;height:8px;background:#e5e5e5;border-radius:60px;opacity:0;bottom:-20px;transition:opacity .4s ease,bottom .4s ease;overflow:hidden}._sliderBar_c3wv7_378{position:absolute;top:0;width:94px;height:8px;background:linear-gradient(90deg,#4a00e040,#4a00e066,#4a00e040);box-shadow:0 0 4px #4a00e033;border-radius:60px}._categorySelection_c3wv7_359{position:absolute;width:60%;height:185px;bottom:-275px;left:50%;transform:translate(-50%);display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:3;transition:bottom .4s ease,opacity .4s ease}._categoryContent_c3wv7_405{display:flex;gap:16px}._categoryBottom_c3wv7_410{flex-shrink:0;margin-top:-10px;width:750px;height:500px;aspect-ratio:3/1;border-radius:50%;transition:background-color .3s ease}._categoryItem_c3wv7_420{flex-shrink:0;flex-grow:0;width:var(--categoryItemSize);height:var(--categoryItemSize);box-shadow:0 4px 10px #00000040;border-radius:12px;position:relative;z-index:2;cursor:pointer;transition:transform .3s ease,margin .3s ease;overflow:hidden}._bottomSDFPreview_c3wv7_434{border-radius:inherit}._categoryItem_c3wv7_420:nth-of-type(1){transform:translateY(10px) rotate(-15deg)}._categoryItem_c3wv7_420:nth-of-type(2){transform:translateY(-8px) rotate(-5deg)}._categoryItem_c3wv7_420:nth-of-type(3){transform:translateY(-8px) rotate(5deg)}._categoryItem_c3wv7_420:nth-of-type(4){transform:translateY(10px) rotate(15deg)}._categoryItem_c3wv7_420:nth-of-type(1):hover{transform:rotate(-15deg) scale(1.09)}._categoryItem_c3wv7_420:nth-of-type(2):hover{transform:translateY(-15px) rotate(-5deg) scale(1.09)}._categoryItem_c3wv7_420:nth-of-type(3):hover{transform:translateY(-15px) rotate(5deg) scale(1.09)}._categoryItem_c3wv7_420:nth-of-type(4):hover{transform:rotate(15deg) scale(1.09)}._active_c3wv7_474._categoryItem_c3wv7_420:nth-of-type(1){transform:translateY(-5px) rotate(-15deg) scale(1.3)}._active_c3wv7_474._categoryItem_c3wv7_420:nth-of-type(2){transform:translateY(-20px) rotate(-5deg) scale(1.3)}._active_c3wv7_474._categoryItem_c3wv7_420:nth-of-type(3){transform:translateY(-20px) rotate(5deg) scale(1.3)}._active_c3wv7_474._categoryItem_c3wv7_420:nth-of-type(4){transform:translateY(-5px) rotate(15deg) scale(1.3)}._active_c3wv7_474._categoryItem_c3wv7_420{margin:0 6px}@property --blackColor1{syntax: ""; inherits: false; initial-value: #737373;}@property --blackColor2{syntax: ""; inherits: false; initial-value: #595959;}@property --blackColor3{syntax: ""; inherits: false; initial-value: #323232;}@property --blackColor4{syntax: ""; inherits: false; initial-value: #1C1C1C;}._black_c3wv7_520{--blackColor1: #737373;--blackColor2: #595959;--blackColor3: #323232;--blackColor4: #1C1C1C}._red_c3wv7_527{--blackColor1: #43A8B7;--blackColor2: #648A9E;--blackColor3: #935C66;--blackColor4: #BC3535}._grey_c3wv7_534{--blackColor1: #91B5D7;--blackColor2: #697D8E;--blackColor3: #4D5B62;--blackColor4: #4D5B62}._colorful_c3wv7_541{--blackColor1: #EF8E38;--blackColor2: #C5BFA8;--blackColor3: #96C5D5;--blackColor4: #7EA5B4}._gradient_c3wv7_548{background:radial-gradient(ellipse at center,var(--blackColor1) 4%,var(--blackColor2) 25%,var(--blackColor3),var(--blackColor4));position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:140%;height:140%;transition:--blackColor1 .3s ease,--blackColor2 .3s ease,--blackColor3 .3s ease,--blackColor4 .3s ease,}@media (min-height: 1080px){._container_c3wv7_1{--carouseSize: 400px;--categoryItemSize: 74px}}@media (min-height: 1200px){._container_c3wv7_1{--carouseSize: 450px;--categoryItemSize: 84px}}@media (min-height: 1440px){._container_c3wv7_1{--carouseSize: 550px;--categoryItemSize: 94px}}@media (max-height: 1080px){._container_c3wv7_1{--carouseSize: 400px;--categoryItemSize: 80px}}@media (max-height: 1024px){._container_c3wv7_1{--carouseSize: 350px;--categoryItemSize: 64px}}@media (max-height: 900px){._container_c3wv7_1{--carouseSize: 300px;--categoryItemSize: 64px;--fs: 16px;--mt: 10px}}@media (max-height: 800px){._container_c3wv7_1{--carouseSize: 300px;--categoryItemSize: 64px}._animateContainer_c3wv7_140{scale:.8;top:10px;left:0}}@media (max-height: 640px){._container_c3wv7_1{--carouseSize: 200px;--categoryItemSize: 50px}._animateContainer_c3wv7_140{scale:.6;top:0;left:0}}._hoverListWrapper_c3wv7_636{position:absolute;border-radius:12px;top:28px;left:28px;opacity:1;width:50px;height:50px;transition:opacity .3s ease;z-index:100000}._Icon_c3wv7_648{background:#37373780;border:2px solid rgba(255,255,255,.1);border-radius:12px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:opacity .3s ease;opacity:1;visibility:visible;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);height:100%;width:100%}._hoverListWrapper_c3wv7_636:hover ._hoverList_c3wv7_636{opacity:1;visibility:visible}._hoverListWrapper_c3wv7_636:hover ._Icon_c3wv7_648{opacity:0;visibility:hidden}._tracerSwitch_c3wv7_675{position:absolute;width:113px;height:36px;top:28px;right:28px;padding-left:12px;border-radius:8px;display:flex;align-items:center;gap:8px;background:#00000040;font-size:14px;font-weight:700;line-height:16px;z-index:10000;cursor:pointer}._tracerSwitch_c3wv7_675 ._signalButton_c3wv7_693{width:10px;height:10px;border-radius:10px;background:#c8c8c8}._tracerSwitch_c3wv7_675:hover{background:#00000059}._tracerOn_c3wv7_704._tracerSwitch_c3wv7_675{color:#121212;background:#6f6cff40}._tracerOn_c3wv7_704._tracerSwitch_c3wv7_675:hover{background:#6f6cff59}._tracerOn_c3wv7_704._tracerSwitch_c3wv7_675 ._signalButton_c3wv7_693{background:#6f6cff}._hoverList_c3wv7_636{margin:0;position:absolute;display:flex;flex-direction:column;list-style:none;justify-content:center;align-items:center;padding:0;background:linear-gradient(180deg,#9898984d,#989898cc);border-bottom:1px solid rgba(255,255,255,1);border-radius:12px;width:104px;top:0;left:0;transition:opacity .3s ease;-webkit-backdrop-filter:blur(50px);backdrop-filter:blur(50px);opacity:0;visibility:hidden}._Icon_c3wv7_648 img{width:80%;height:auto;position:relative;top:3px}._Brand_c3wv7_744{height:22px;border-radius:6px;opacity:1;transition:opacity .3s ease;font-size:10px;line-height:11px;display:flex;background:#0000001f;color:#fff9;position:absolute;top:28px;right:28px;z-index:100000}._Brand_c3wv7_744 ._brandTitle_c3wv7_760{padding:5.5px 8px}._Brand_c3wv7_744 ._closeIcon_c3wv7_764{padding:3px;cursor:pointer}._Brand_c3wv7_744 ._border_c3wv7_769{height:8px;display:block;width:.5px;margin-top:7px;background:#fff9}._Brand_c3wv7_744:hover ._Brand_c3wv7_744{background:#0000004d;color:#fffc}._Brand_c3wv7_744:hover ._closeIcon_c3wv7_764:hover{background:#0003;border-radius:0 6px 6px 0;color:#fff}._Brand_c3wv7_744:hover ._brandTitle_c3wv7_760:hover{background:#0003;border-radius:6px 0 0 6px;color:#fff}._Brand_c3wv7_744._close_c3wv7_764{display:none}._hoverpluginItem_c3wv7_797{position:relative;width:104px;list-style:none;align-items:center;justify-content:center;line-height:35px;color:#fff9;font-family:Helvetica Neue,Helvetica,Arial,Roboto,ui-sans-serif,-apple-system,system-ui,BlinkMacSystemFont,sans-serif;font-size:14px;font-style:normal;font-weight:700;font-family:Arial;transition:all .1s ease;display:flex}._hoverpluginItem_c3wv7_797:first-child{border-top-right-radius:12px;border-top-left-radius:12px;padding-top:1px}._hoverpluginItem_c3wv7_797:last-child{padding-bottom:1px;border-bottom-right-radius:12px;border-bottom-left-radius:12px}._hoverpluginItem_c3wv7_797:hover{background:#ffffff26;color:#fff;cursor:pointer;transition:background-color .3s ease}._tempBody_c3wv7_837{width:25rem;height:25rem;display:flex;flex-direction:column;align-items:center;position:absolute;top:4rem;transform:translate(-50%);background-color:#fff;z-index:9999999;padding:15px;border-radius:8px;box-shadow:#0000004d 0 5px 15px}._tempContent_c3wv7_853{position:relative;width:100%;height:100%;border-radius:8px;background:#fffc;display:flex;justify-content:center;align-items:center}._tempContent_c3wv7_853 img{height:90%;width:90%;border-radius:8px}._tempContent_c3wv7_853 video{height:90%;width:90%;border-radius:8px;object-fit:cover}._downloadImgBtn_c3wv7_877{height:40px;width:90%;border:1px solid transparent;background:#4a00e0;color:#fff;border-radius:20px;cursor:pointer;transition:all .2s ease;position:relative}._downloadImgBtn_c3wv7_877 svg{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);transition:all .2s ease}._downloadImgBtn_c3wv7_877:hover{border:1px solid rgba(74,0,224,1);background:#fff;color:#4a00e0}._downloadImgBtn_c3wv7_877:hover svg{color:#4a00e0}._loading_c3wv7_294{position:absolute;background:#fffc;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);width:90%;height:90%;border-radius:8px;display:flex;justify-content:center;align-items:center;font-size:2rem}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.container{width:100%}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1400px){.container{max-width:1400px}}@media (min-width: 1600px){.container{max-width:1600px}}@media (min-width: 1920px){.container{max-width:1920px}}@media (min-width: 2560px){.container{max-width:2560px}}@media (min-width: 3200px){.container{max-width:3200px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-32{height:8rem}.h-8{height:2rem}.h-\[56px\]{height:56px}.h-full{height:100%}.min-h-0{min-height:0px}.w-8{width:2rem}.w-\[56px\]{width:56px}.w-full{width:100%}.grow{flex-grow:1}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-0{gap:0px}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-\[10px\]{border-radius:10px}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-\[0\.5px\]{border-width:.5px}.border-solid{border-style:solid}.border-\[var\(--bg-border\)\]{border-color:var(--bg-border)}.border-transparent{border-color:transparent}.bg-\[var\(--bg-base-hover\)\]{background-color:var(--bg-base-hover)}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fill-black{fill:#000}.stroke-\[var\(--bg-border\)\]{stroke:var(--bg-border)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.pt-\[2px\]{padding-top:2px}.text-center{text-align:center}.text-\[8px\]{font-size:8px}.font-medium{font-weight:500}.text-\[var\(--accent-base\)\]{color:var(--accent-base)}.text-\[var\(--label-muted\)\]{color:var(--label-muted)}.opacity-40{opacity:.4}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\:cursor-grab:hover{cursor:grab}.hover\:border-\[var\(--accent-base\)\]:hover{border-color:var(--accent-base)}.hover\:bg-\[var\(--bg-shade\)\]:hover{background-color:var(--bg-shade)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[var\(--accent-base\)\]:focus{--tw-ring-color: var(--accent-base)}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-\[var\(--bg-sub\)\]:focus{--tw-ring-offset-color: var(--bg-sub)}.focus-visible\:ring-\[var\(--label-title\)\]:focus-visible{--tw-ring-color: var(--label-title)}.active\:cursor-grabbing:active{cursor:grabbing}.active\:opacity-70:active{opacity:.7}.group:hover .group-hover\:text-\[var\(--label-base\)\]{color:var(--label-base)} diff --git a/web/threeVisualizer/environments/interior.exr b/web/threeVisualizer/environments/interior.exr new file mode 100644 index 0000000..853a83e Binary files /dev/null and b/web/threeVisualizer/environments/interior.exr differ diff --git a/web/threeVisualizer/external/.gitattributes b/web/threeVisualizer/external/.gitattributes new file mode 100644 index 0000000..734160f --- /dev/null +++ b/web/threeVisualizer/external/.gitattributes @@ -0,0 +1,2 @@ +*.data binary +*.wasm binary \ No newline at end of file diff --git a/web/threeVisualizer/external/emHdBindings.data b/web/threeVisualizer/external/emHdBindings.data new file mode 100644 index 0000000..168e611 --- /dev/null +++ b/web/threeVisualizer/external/emHdBindings.data @@ -0,0 +1,19331 @@ +{ + "Plugins": [ + { + "Info": { + "Types": { + "ArResolver": {}, + "ArDefaultResolver": { + "bases": [ + "ArResolver" + ], + "implementsContexts": true + }, + "ArPackageResolver": {} + } + }, + "LibraryPath": "", + "Name": "ar", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +// +// Copyright 2023 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#include "{{ INCLUDE_PATH }}/{{ FILE_NAME }}.h" + +#include "pxr/imaging/hd/retainedDataSource.h" + +{%- if IMPL_SCHEMA_INCLUDES is defined -%} +{%- for t in IMPL_SCHEMA_INCLUDES %} +#include "{{ t | expand }}.h" +{%- endfor -%} +{%- endif %} + +#include "pxr/base/trace/trace.h" + +// --(BEGIN CUSTOM CODE: Includes)-- +{%- if 'Includes' in CUSTOM_CODE_IMPL %} +{{ CUSTOM_CODE_IMPL['Includes'] }} +{%- endif %} +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +TF_DEFINE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens, + {{ SCHEMA_CLASS_NAME|snake }}_TOKENS); + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +{%- if 'Schema Methods' in CUSTOM_CODE_IMPL %} +{{ CUSTOM_CODE_IMPL['Schema Methods'] }} +{%- endif %} +// --(END CUSTOM CODE: Schema Methods)-- + +{%- if GENERIC_MEMBER is defined -%} +{%- set name, type_name, opt_dict = GENERIC_MEMBER -%} +{%- if opt_dict.get('GETTER', True) %} + +TfTokenVector +{{ SCHEMA_CLASS_NAME }}::Get{{ name | capitalizeFirst }}Names() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + if (_container) { + return _container->GetNames(); + } else { + return {}; + } +} + +{{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} +{{ SCHEMA_CLASS_NAME }}::Get{{ name | capitalizeFirst }}(const TfToken &name) +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + {%- if type_name.endswith('Schema') %} + return {{type_name}}( + _GetTypedDataSource<{{ type_name | underlyingDataSource}}>(name)); + {%- else %} + return _GetTypedDataSource<{{ type_name | underlyingDataSource}}>(name); + {%- endif %} +} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endif -%} {# if GENERIC_MEMBER is defiend #} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict.get('GETTER', True) %} + +{{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} +{{ SCHEMA_CLASS_NAME }}::Get{{ name|capitalizeFirst }}() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const +#else + +#endif +{% else %} const +{% endif -%} {#- if VERSION_GUARD_CONST_GETTER -#} +{ + return {% if type_name.endswith('Schema') %}{{ type_name }}({% endif %}_GetTypedDataSource<{{type_name | underlyingDataSource}}>( + {{SCHEMA_CLASS_NAME}}Tokens->{{ name }}){% if type_name.endswith('Schema') %}){% endif %}; +} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if GENERIC_MEMBER is defined %} + +/*static*/ +HdContainerDataSourceHandle +{{SCHEMA_CLASS_NAME}}::BuildRetained( + const size_t count, + const TfToken * const names, + const HdDataSourceBaseHandle * const values) +{ + return HdRetainedContainerDataSource::New(count, names, values); +} +{%- else -%} +{%- if MEMBERS %} + +/*static*/ +HdContainerDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + const {{type_name | underlyingDataSource}}Handle &{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} +) +{ + TfToken _names[{{MEMBERS|length}}]; + HdDataSourceBaseHandle _values[{{MEMBERS|length}}]; + + size_t _count = 0; +{%- for name, type_name, opt_dict in MEMBERS %} + + if ({{name}}) { + _names[_count] = {{SCHEMA_CLASS_NAME}}Tokens->{{name}}; + _values[_count++] = {{name}}; + } +{%- endfor %} + return HdRetainedContainerDataSource::New(_count, _names, _values); +} + +{%- for name, type_name, opt_dict in MEMBERS %} + +{{ SCHEMA_CLASS_NAME }}::Builder & +{{ SCHEMA_CLASS_NAME }}::Builder::Set{{ name|capitalizeFirst }}( + const {{ type_name | underlyingDataSource}}Handle &{{name}}) +{ + _{{name}} = {{name}}; + return *this; +} +{%- endfor %} + +HdContainerDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::Builder::Build() +{ + return {{ SCHEMA_CLASS_NAME }}::BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + _{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} + ); +} +{%- endif -%} {# else of if MEMBERS #} +{%- endif -%} {# else of if GENERIC_MEMBER is defined #} + +{%- if SCHEMA_TOKEN is defined %} + +/*static*/ +{{ SCHEMA_CLASS_NAME }} +{{ SCHEMA_CLASS_NAME }}::GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer) +{ + return {{ SCHEMA_CLASS_NAME }}( + fromParentContainer + ? HdContainerDataSource::Cast(fromParentContainer->Get( + {{SCHEMA_CLASS_NAME}}Tokens->{{SCHEMA_TOKEN}})) + : nullptr); +} + +/*static*/ +const TfToken & +{{ SCHEMA_CLASS_NAME }}::GetSchemaToken() +{ + return {{SCHEMA_CLASS_NAME}}Tokens->{{SCHEMA_TOKEN}}; +} +{%- endif -%} + +{%- if ADD_DEFAULT_LOCATOR is defined %} + +/*static*/ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::GetDefaultLocator() +{ +{%- if LOCATOR_PREFIX is defined %} + static const HdDataSourceLocator locator = + {{ LOCATOR_PREFIX }}.Append(GetSchemaToken()); +{%- else %} + static const HdDataSourceLocator locator(GetSchemaToken()); +{%- endif %} + return locator; +} +{%- endif -%} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict['ADD_LOCATOR'] %} + +/* static */ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::Get{{ name |capitalizeFirst }}Locator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + {{SCHEMA_CLASS_NAME}}Tokens->{{name}}); + return locator; +} +{%- endif -%} {# if opt_dict['ADD_LOCATOR'] #} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if STATIC_LOCATOR_ACCESSORS is defined -%} +{%- for name, tokens in STATIC_LOCATOR_ACCESSORS %} + +/*static*/ +const HdDataSourceLocator & +{{ SCHEMA_CLASS_NAME }}::Get{{name|capitalizeFirst}}Locator() +{ + static const HdDataSourceLocator locator( + {%- for t in tokens -%} + {%if t is string %}{{SCHEMA_CLASS_NAME}}Tokens->{{ t }}{% else %}{{ t[0] }}SchemaTokens->{{ t[1] }}{% endif %}{%if loop.last == False %},{% endif -%} + {%- endfor %} + ); + return locator; +} +{%- endfor -%} +{%- endif -%} {# if STATIC_LOCATOR_ACCESSORS is defined #} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS %} + +/*static*/ +HdTokenDataSourceHandle +{{ SCHEMA_CLASS_NAME }}::Build{{typeName|capitalizeFirst}}DataSource( + const TfToken &{{typeName}}) +{ +{% for token in tokens %} + if ({{typeName}} == {{SCHEMA_CLASS_NAME}}Tokens->{{ token | tokenName }}) { + static const HdRetainedTypedSampledDataSource::Handle ds = + HdRetainedTypedSampledDataSource::New({{typeName}}); + return ds; + } +{%- endfor %} + // fallback for unknown token + return HdRetainedTypedSampledDataSource::New({{typeName}}); +} +{%- endfor -%} +{%- endif %} {# if STATIC_TOKEN_DATASOURCE_BUILDERS is defined #} + +PXR_NAMESPACE_CLOSE_SCOPE +// +// Copyright 2023 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#ifndef {{ HEADER_GUARD|snake }}_{{ FILE_NAME|snake }}_H +#define {{ HEADER_GUARD|snake }}_{{ FILE_NAME|snake }}_H + +/// \file + +#include "{{ INCLUDE_PATH }}/api.h" + +{%- if SCHEMA_INCLUDES is defined -%} +{%- for t in SCHEMA_INCLUDES %} +#include "{{ t | expand }}.h" +{%- endfor -%} +{%- endif %} + +#include "pxr/imaging/hd/schema.h" +{%- if VERSION_GUARD_CONST_GETTER %} +#include "pxr/imaging/hd/version.h" +{%- endif %} + +// --(BEGIN CUSTOM CODE: Includes)-- +{%- if 'Includes' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Includes'] }} +{%- endif %} +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +// --(BEGIN CUSTOM CODE: Declares)-- +{%- if 'Declares' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Declares'] }} +{%- endif %} +// --(END CUSTOM CODE: Declares)-- + +#define {{ SCHEMA_CLASS_NAME|snake }}_TOKENS \ + +{%- if SCHEMA_TOKEN is defined %} + ({{SCHEMA_TOKEN}}) \ +{%- endif -%} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if SCHEMA_TOKEN is not defined or name != SCHEMA_TOKEN %} + ({{name}}) \ +{%- endif -%} +{%- endfor -%} +{%- endif -%} + +{%- if EXTRA_TOKENS is defined -%} +{%- for t in EXTRA_TOKENS %} + ({{t}}) \ +{%- endfor -%} +{%- endif -%} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS -%} +{%- for token in tokens %} + ({{token}}) \ +{%- endfor -%} +{%- endfor -%} +{%- endif %} + +TF_DECLARE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens, {{ LIBRARY_API }}, + {{ SCHEMA_CLASS_NAME|snake }}_TOKENS); + +//----------------------------------------------------------------------------- + +{% if DOC is defined -%} +{{ DOC | expand | makeComment }} +{%- endif %} +class {{ SCHEMA_CLASS_NAME }} : public HdSchema +{ +public: + /// \name Schema retrieval + /// @{ + + {{ SCHEMA_CLASS_NAME }}(HdContainerDataSourceHandle container) + : HdSchema(container) {} + +{%- if SCHEMA_TOKEN is defined %} + + /// Retrieves a container data source with the schema's default name token + /// "{{ SCHEMA_TOKEN }}" from the parent container and constructs a + /// {{SCHEMA_CLASS_NAME}} instance. + /// Because the requested container data source may not exist, the result + /// should be checked with IsDefined() or a bool comparison before use. + {{ LIBRARY_API }} + static {{ SCHEMA_CLASS_NAME }} GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer); +{%- endif %} + + /// @} + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +{%- if 'Schema Methods' in CUSTOM_CODE_HEADER %} +{{ CUSTOM_CODE_HEADER['Schema Methods'] }} +{%- endif %} +// --(END CUSTOM CODE: Schema Methods)-- + + /// \name Member accessor + /// @{ +{%- if GENERIC_MEMBER is defined -%} +{%- set name, type_name, opt_dict = GENERIC_MEMBER -%} +{%- if opt_dict.get('GETTER', True) %} + + {{ LIBRARY_API }} + TfTokenVector Get{{ name | capitalizeFirst }}Names() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{% endif -%} {# if VERSION_GUARD_CONST_GETTER #} + +{%- if 'DOC' in opt_dict -%} +{%- for l in (opt_dict['DOC'].split()|join(' ')|wordwrap(width=70)).split('\n') %} + /// {{l}} +{%- endfor -%} +{%- endif %} + {{ LIBRARY_API }} + {{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} Get{{ name|capitalizeFirst }}(const TfToken &name) +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{%- endif -%} {# if VERSION_GUARD_CONST_GETTER #} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endif -%} {# if GENERIC_MEMBER is defined #} + +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict.get('GETTER', True) %} +{% if 'DOC' in opt_dict -%} +{%- for l in (opt_dict['DOC'].split()|join(' ')|wordwrap(width=70)).split('\n') %} + /// {{l}} +{%- endfor -%} +{%- endif %} + {{ LIBRARY_API }} + {{ type_name}}{% if not type_name.endswith('Schema') %}Handle{% endif %} Get{{ name|capitalizeFirst }}() +{%- if VERSION_GUARD_CONST_GETTER %} +#if HD_API_VERSION >= 66 + const; +#else + ; +#endif +{% else %} const; +{%- endif -%} {# if VERSION_GUARD_CONST_GETTER #} +{%- endif -%} {# if opt_dict.get('GETTER', True) #} +{%- endfor -%} +{%- endif %} {# if MEMBERS is defined #} + + /// @} + +{%- if SCHEMA_TOKEN is defined %} + + /// \name Schema location + /// @{ + + /// Returns a token where the container representing this schema is found in + /// a container by default. + {{ LIBRARY_API }} + static const TfToken &GetSchemaToken(); + +{%- if ADD_DEFAULT_LOCATOR is defined %} + + /// Returns an HdDataSourceLocator (relative to the prim-level data source) + /// where the container representing this schema is found by default. + {{ LIBRARY_API }} + static const HdDataSourceLocator &GetDefaultLocator(); +{%- endif %} + + /// @} +{%- endif -%} + + +{%- if self.member_locators() | trim %} + + /// \name Data source locators for members + /// + /// The following methods return an HdDataSourceLocator (relative to the + /// prim-level data source) where the data source for a member can be found. + /// + /// This is often useful for checking intersection against the + /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied. + /// @{ + +{%- block member_locators -%} +{%- if MEMBERS is defined -%} +{%- for name, type_name, opt_dict in MEMBERS -%} +{%- if opt_dict['ADD_LOCATOR'] %} + + /// Prim-level relative data source locator to locate {{ name }}. + {{ LIBRARY_API }} + static const HdDataSourceLocator &Get{{ name |capitalizeFirst }}Locator(); +{%- endif -%} +{%- endfor -%} +{%- endif -%} {# if MEMBERS is defined #} + +{%- if STATIC_LOCATOR_ACCESSORS is defined -%} +{%- for name, tokens in STATIC_LOCATOR_ACCESSORS %} + + /// Additional prim-level relative data source locator to locate + /// {{ name }}. + {{ LIBRARY_API }} + static const HdDataSourceLocator &Get{{name | capitalizeFirst}}Locator(); +{%- endfor -%} +{%- endif -%} +{%- endblock member_locators %} + /// @} +{%- endif %} {# if self.member_locators() | trim #} + + /// \name Schema construction + /// @{ + +{%- if GENERIC_MEMBER is defined %} + {{ LIBRARY_API }} + static HdContainerDataSourceHandle + BuildRetained( + size_t count, + const TfToken *names, + const HdDataSourceBaseHandle *values); +{%- else -%} +{%- if MEMBERS %} + + /// \deprecated Use Builder instead. + /// + /// Builds a container data source which includes the provided child data + /// sources. Parameters with nullptr values are excluded. This is a + /// low-level interface. For cases in which it's desired to define + /// the container with a sparse set of child fields, the Builder class + /// is often more convenient and readable. + {{ LIBRARY_API }} + static HdContainerDataSourceHandle + BuildRetained( +{%- for name, type_name, opt_dict in MEMBERS %} + const {{ type_name | underlyingDataSource }}Handle &{{ name }}{%if loop.last == False %},{% endif -%} +{%- endfor %} + ); + + /// \class {{ SCHEMA_CLASS_NAME }}::Builder + /// + /// Utility class for setting sparse sets of child data source fields to be + /// filled as arguments into BuildRetained. Because all setter methods + /// return a reference to the instance, this can be used in the "builder + /// pattern" form. + class Builder + { + public: +{%- for name, type_name, opt_dict in MEMBERS %} + {{ LIBRARY_API }} + Builder &Set{{ name|capitalizeFirst }}( + const {{ type_name | underlyingDataSource}}Handle &{{name}}); +{%- endfor %} + + /// Returns a container data source containing the members set thus far. + {{ LIBRARY_API }} + HdContainerDataSourceHandle Build(); + + private: +{%- for name, type_name, opt_dict in MEMBERS %} + {{ type_name | underlyingDataSource}}Handle _{{name}}; +{%- endfor %} + + }; +{%- endif -%} {# else of if MEMBERS #} +{%- endif -%} {# else of if GENERIC_MEMBER is defined #} + +{%- if STATIC_TOKEN_DATASOURCE_BUILDERS is defined -%} +{%- for typeName, tokens in STATIC_TOKEN_DATASOURCE_BUILDERS %} + + /// Returns token data source for use as {{typeName}} value. + /// + /// The following values will be stored statically and reused for future + /// calls: +{%- for token in tokens %} + /// - {{SCHEMA_CLASS_NAME}}Tokens->{{ token | tokenName }} +{%- endfor %} + {{ LIBRARY_API }} + static HdTokenDataSourceHandle Build{{typeName|capitalizeFirst}}DataSource( + const TfToken &{{typeName}}); +{%- endfor -%} +{%- endif %} + + /// @} +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif +{ + "Plugins": [ + { + "Info": {}, + "LibraryPath": "", + "Name": "hd", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "HttpResolver": { + "bases": ["ArDefaultResolver"] + } + } + }, + "Name": "HttpResolver", + "LibraryPath": "", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "NdrDiscoveryPlugin": {}, + "_NdrFilesystemDiscoveryPlugin" : { + "bases": ["NdrDiscoveryPlugin"], + "displayName": "Filesystem Discovery" + }, + "NdrParserPlugin": {} + } + }, + "LibraryPath": "", + "Name": "ndr", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +{ + "Includes": [ + "*/resources/" + ] +} +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "payloadAssetDependencies": { + "appliesTo": "prims", + "displayGroup": "Pipeline", + "type": "asset[]" + } + }, + "Types": { + "SdfFileFormat": { + "displayName": "Sdf file format base class", + "target": "sdf" + }, + "SdfTextFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "Sdf Text File Format", + "extensions": [ + "sdf" + ], + "formatId": "sdf" + } + } + }, + "LibraryPath": "", + "Name": "sdf", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +// +// Copyright 2017 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(libraryName) }}_API_H +#define {{ Upper(libraryName) }}_API_H + +#include "pxr/base/arch/export.h" + +#if defined(PXR_STATIC) +# define {{ Upper(libraryName) }}_API +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) +# define {{ Upper(libraryName) }}_LOCAL +#else +# if defined({{ Upper(libraryName) }}_EXPORTS) +# define {{ Upper(libraryName) }}_API ARCH_EXPORT +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) +# else +# define {{ Upper(libraryName) }}_API ARCH_IMPORT +# define {{ Upper(libraryName) }}_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) +# define {{ Upper(libraryName) }}_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) +# endif +# define {{ Upper(libraryName) }}_LOCAL ARCH_HIDDEN +#endif + +#endif +{ + "Plugins": [ + { + "Info": { + "Types": { + } + }, + "LibraryPath": "@PLUG_INFO_LIBRARY_PATH@", + "Name": "{{ libraryName }}", + "ResourcePath": "@PLUG_INFO_RESOURCE_PATH@", + "Root": "@PLUG_INFO_ROOT@", + "Type": "library" + } + ] +} +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/{{ cls.GetHeaderFile() }}" +#include "pxr/usd/usd/schemaRegistry.h" +#include "pxr/usd/usd/typed.h" + +#include "pxr/usd/sdf/types.h" +#include "pxr/usd/sdf/assetPath.h" + +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} +#include "pxr/base/tf/staticTokens.h" + +{% endif %} +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +// Register the schema with the TfType system. +TF_REGISTRY_FUNCTION(TfType) +{ + TfType::Define<{{ cls.cppClassName }}, + TfType::Bases< {{ cls.parentCppClassName }} > >(); + +{% if cls.isConcrete %} + // Register the usd prim typename as an alias under UsdSchemaBase. This + // enables one to call + // TfType::Find().FindDerivedByName("{{ cls.usdPrimTypeName }}") + // to find TfType<{{ cls.cppClassName }}>, which is how IsA queries are + // answered. + TfType::AddAlias("{{ cls.usdPrimTypeName }}"); +{% endif %} +} + +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} +TF_DEFINE_PRIVATE_TOKENS( + _schemaTokens, + ({{ cls.propertyNamespacePrefix }}) +); + +{% endif %} +/* virtual */ +{{ cls.cppClassName }}::~{{ cls.cppClassName }}() +{ +} + +{% if not cls.isAPISchemaBase %} +/* static */ +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Get(const UsdStagePtr &stage, const SdfPath &path) +{ + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return {{ cls.cppClassName }}(); + } +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + TfToken name; + if (!Is{{ cls.usdPrimTypeName }}Path(path, &name)) { + TF_CODING_ERROR("Invalid {{ cls.propertyNamespacePrefix }} path <%s>.", path.GetText()); + return {{ cls.cppClassName }}(); + } + return {{ cls.cppClassName }}(stage->GetPrimAtPath(path.GetPrimPath()), name); +{% else %} + return {{ cls.cppClassName }}(stage->GetPrimAtPath(path)); +{% endif %} +} + +{% if cls.isMultipleApply %} +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Get(const UsdPrim &prim, const TfToken &name) +{ + return {{ cls.cppClassName }}(prim, name); +} + +/* static */ +std::vector<{{ cls.cppClassName }}> +{{ cls.cppClassName }}::GetAll(const UsdPrim &prim) +{ + std::vector<{{ cls.cppClassName }}> schemas; + + for (const auto &schemaName : + UsdAPISchemaBase::_GetMultipleApplyInstanceNames(prim, _GetStaticTfType())) { + schemas.emplace_back(prim, schemaName); + } + + return schemas; +} + +{% endif %} +{% endif %} +{% if cls.isConcrete %} +/* static */ +{{ cls.cppClassName }} +{{ cls.cppClassName }}::Define( + const UsdStagePtr &stage, const SdfPath &path) +{ + static TfToken usdPrimTypeName("{{ cls.usdPrimTypeName }}"); + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return {{ cls.cppClassName }}(); + } + return {{ cls.cppClassName }}( + stage->DefinePrim(path, usdPrimTypeName)); +} +{% endif %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +/* static */ +bool +{{ cls.cppClassName }}::IsSchemaPropertyBaseName(const TfToken &baseName) +{ + static TfTokenVector attrsAndRels = { +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} + UsdSchemaRegistry::GetMultipleApplyNameTemplateBaseName( + {{ tokensPrefix }}Tokens->{{ attr.name }}), +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName] %} + UsdSchemaRegistry::GetMultipleApplyNameTemplateBaseName( + {{ tokensPrefix }}Tokens->{{ rel.name }}), +{% endfor %} + }; + + return find(attrsAndRels.begin(), attrsAndRels.end(), baseName) + != attrsAndRels.end(); +} + +/* static */ +bool +{{ cls.cppClassName }}::Is{{ cls.usdPrimTypeName }}Path( + const SdfPath &path, TfToken *name) +{ + if (!path.IsPropertyPath()) { + return false; + } + + std::string propertyName = path.GetName(); + TfTokenVector tokens = SdfPath::TokenizeIdentifierAsTokens(propertyName); + + // The baseName of the {{ cls.usdPrimTypename }} path can't be one of the + // schema properties. We should validate this in the creation (or apply) + // API. + TfToken baseName = *tokens.rbegin(); + if (IsSchemaPropertyBaseName(baseName)) { + return false; + } + + if (tokens.size() >= 2 + && tokens[0] == _schemaTokens->{{ cls.propertyNamespacePrefix }}) { + *name = TfToken(propertyName.substr( + _schemaTokens->{{ cls.propertyNamespacePrefix }}.GetString().size() + 1)); + return true; + } + + return false; +} +{% endif %} + +/* virtual */ +UsdSchemaKind {{ cls.cppClassName }}::_GetSchemaKind() const +{ + return {{ cls.cppClassName }}::schemaKind; +} +{% if cls.isAppliedAPISchema %} + +/* static */ +bool +{% if not cls.isMultipleApply %} +{{ cls.cppClassName }}::CanApply( + const UsdPrim &prim, std::string *whyNot) +{% else %} +{{ cls.cppClassName }}::CanApply( + const UsdPrim &prim, const TfToken &name, std::string *whyNot) +{% endif %} +{ +{% if cls.isMultipleApply %} + return prim.CanApplyAPI<{{ cls.cppClassName }}>(name, whyNot); +{% else %} + return prim.CanApplyAPI<{{ cls.cppClassName }}>(whyNot); +{% endif %} +} + +/* static */ +{{ cls.cppClassName }} +{% if not cls.isMultipleApply %} +{{ cls.cppClassName }}::Apply(const UsdPrim &prim) +{% else %} +{{ cls.cppClassName }}::Apply(const UsdPrim &prim, const TfToken &name) +{% endif %} +{ +{% if cls.isMultipleApply %} + if (prim.ApplyAPI<{{ cls.cppClassName }}>(name)) { + return {{ cls.cppClassName }}(prim, name); + } +{% else %} + if (prim.ApplyAPI<{{ cls.cppClassName }}>()) { + return {{ cls.cppClassName }}(prim); + } +{% endif %} + return {{ cls.cppClassName }}(); +} +{% endif %} + +/* static */ +const TfType & +{{ cls.cppClassName }}::_GetStaticTfType() +{ + static TfType tfType = TfType::Find<{{ cls.cppClassName }}>(); + return tfType; +} + +/* static */ +bool +{{ cls.cppClassName }}::_IsTypedSchema() +{ + static bool isTyped = _GetStaticTfType().IsA(); + return isTyped; +} + +/* virtual */ +const TfType & +{{ cls.cppClassName }}::_GetTfType() const +{ + return _GetStaticTfType(); +} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +/// Returns the property name prefixed with the correct namespace prefix, which +/// is composed of the the API's propertyNamespacePrefix metadata and the +/// instance name of the API. +static inline +TfToken +_GetNamespacedPropertyName(const TfToken instanceName, const TfToken propName) +{ + return UsdSchemaRegistry::MakeMultipleApplyNameInstance(propName, instanceName); +} +{% endif %} + +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if attr.apiName != '' %} +{% if attr.apiGet != "custom" %} +UsdAttribute +{{ cls.cppClassName }}::Get{{ Proper(attr.apiName) }}Attr() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().GetAttribute( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ attr.name }})); +{% else %} + return GetPrim().GetAttribute({{ tokensPrefix }}Tokens->{{ attr.name }}); +{% endif %} +} +{% endif %} + +UsdAttribute +{{ cls.cppClassName }}::Create{{ Proper(attr.apiName) }}Attr(VtValue const &defaultValue, bool writeSparsely) const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return UsdSchemaBase::_CreateAttr( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ attr.name }}), +{% else %} + return UsdSchemaBase::_CreateAttr({{ tokensPrefix }}Tokens->{{ attr.name }}, +{% endif %} + {{ attr.usdType }}, + /* custom = */ {{ "true" if attr.custom else "false" }}, + {{ attr.variability }}, + defaultValue, + writeSparsely); +} + +{% endif %} +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName] %} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if rel.apiName != '' %} +{% if rel.apiGet != "custom" %} +UsdRelationship +{{ cls.cppClassName }}::Get{{ Proper(rel.apiName) }}Rel() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().GetRelationship( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ rel.name }})); +{% else %} + return GetPrim().GetRelationship({{ tokensPrefix }}Tokens->{{ rel.name }}); +{% endif %} +} +{% endif %} + +UsdRelationship +{{ cls.cppClassName }}::Create{{ Proper(rel.apiName) }}Rel() const +{ +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + return GetPrim().CreateRelationship( + _GetNamespacedPropertyName( + GetName(), + {{ tokensPrefix }}Tokens->{{ rel.name }}), +{% else %} + return GetPrim().CreateRelationship({{ tokensPrefix }}Tokens->{{rel.name}}, +{% endif %} + /* custom = */ {{ "true" if rel.custom else "false" }}); +} + +{% endif %} +{% endfor %} +{% if cls.attrOrder|length > 0 %} +namespace { +static inline TfTokenVector +_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right) +{ + TfTokenVector result; + result.reserve(left.size() + right.size()); + result.insert(result.end(), left.begin(), left.end()); + result.insert(result.end(), right.begin(), right.end()); + return result; +} +} + +{% endif %} +/*static*/ +const TfTokenVector& +{{ cls.cppClassName }}::GetSchemaAttributeNames(bool includeInherited) +{ +{% if cls.attrOrder|length > 0 %} + static TfTokenVector localNames = { +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName] %} +{% if attr.apiName != '' %} + {{ tokensPrefix }}Tokens->{{ attr.name }}, +{% endif %} +{% endfor %} + }; + static TfTokenVector allNames = + _ConcatenateAttributeNames( + {{ cls.parentCppClassName }}::GetSchemaAttributeNames(true), + localNames); +{% else %} + static TfTokenVector localNames; + static TfTokenVector allNames = + {{ cls.parentCppClassName }}::GetSchemaAttributeNames(true); +{% endif %} + + if (includeInherited) + return allNames; + else + return localNames; +} + +{% if cls.isMultipleApply %} +/*static*/ +TfTokenVector +{{ cls.cppClassName }}::GetSchemaAttributeNames( + bool includeInherited, const TfToken &instanceName) +{ + const TfTokenVector &attrNames = GetSchemaAttributeNames(includeInherited); + if (instanceName.IsEmpty()) { + return attrNames; + } + TfTokenVector result; + result.reserve(attrNames.size()); + for (const TfToken &attrName : attrNames) { + result.push_back( + UsdSchemaRegistry::MakeMultipleApplyNameInstance(attrName, instanceName)); + } + return result; +} + +{% endif %} +{% if useExportAPI %} +{{ namespaceClose }} + +{% endif %} +// ===================================================================== // +// Feel free to add custom code below this line. It will be preserved by +// the code generator. +{% if useExportAPI %} +// +// Just remember to wrap code in the appropriate delimiters: +// '{{ namespaceOpen }}', '{{ namespaceClose }}'. +{% endif %} +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(libraryName) }}_GENERATED_{{ Upper(cls.className) }}_H +#define {{ Upper(libraryName) }}_GENERATED_{{ Upper(cls.className) }}_H + +/// \file {{ libraryName }}/{{ cls.GetHeaderFile() }} + +{% if useExportAPI %} +#include "pxr/pxr.h" +#include "{{ libraryPath }}/api.h" +{% endif %} +#include "{{ cls.parentLibPath }}/{{ cls.GetParentHeaderFile() }}" +#include "pxr/usd/usd/prim.h" +#include "pxr/usd/usd/stage.h" +{% if cls.tokens -%} +#include "{{ libraryPath }}/tokens.h" +{% endif %} +{% if cls.extraIncludes -%} +{{ cls.extraIncludes }} +{% endif %} + +#include "pxr/base/vt/value.h" + +#include "pxr/base/gf/vec3d.h" +#include "pxr/base/gf/vec3f.h" +#include "pxr/base/gf/matrix4d.h" + +#include "pxr/base/tf/token.h" +#include "pxr/base/tf/type.h" + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +class SdfAssetPath; + +// -------------------------------------------------------------------------- // +// {{ Upper(cls.usdPrimTypeName) }}{{' ' * (74 - cls.usdPrimTypeName|count)}} // +// -------------------------------------------------------------------------- // + +/// \class {{ cls.cppClassName }} +/// +{% if cls.doc -%} +/// {{ cls.doc }} +{% endif %} +{% if cls.doc and hasTokenAttrs -%} +/// +{%endif%} +{% if hasTokenAttrs -%} +/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below +/// that are text/tokens, the actual token is published and defined in \ref {{ tokensPrefix }}Tokens. +/// So to set an attribute to the value "rightHanded", use {{ tokensPrefix }}Tokens->rightHanded +/// as the value. +{% endif %} +/// +class {{ cls.cppClassName }} : public {{ cls.parentCppClassName }} +{ +public: + /// Compile time constant representing what kind of schema this class is. + /// + /// \sa UsdSchemaKind + static const UsdSchemaKind schemaKind = {{cls.schemaKindEnumValue }}; + +{% if cls.isMultipleApply %} + /// Construct a {{ cls.cppClassName }} on UsdPrim \p prim with + /// name \p name . Equivalent to + /// {{ cls.cppClassName }}::Get( + /// prim.GetStage(), + /// prim.GetPath().AppendProperty( + /// "{{ cls.propertyNamespacePrefix }}:name")); + /// + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit {{ cls.cppClassName }}( + const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken()) + : {{ cls.parentCppClassName }}(prim, /*instanceName*/ name) + { } + + /// Construct a {{ cls.cppClassName }} on the prim held by \p schemaObj with + /// name \p name. Should be preferred over + /// {{ cls.cppClassName }}(schemaObj.GetPrim(), name), as it preserves + /// SchemaBase state. + explicit {{ cls.cppClassName }}( + const UsdSchemaBase& schemaObj, const TfToken &name) + : {{ cls.parentCppClassName }}(schemaObj, /*instanceName*/ name) + { } +{% else %} + /// Construct a {{ cls.cppClassName }} on UsdPrim \p prim . + /// Equivalent to {{ cls.cppClassName }}::Get(prim.GetStage(), prim.GetPath()) + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit {{ cls.cppClassName }}(const UsdPrim& prim=UsdPrim()) + : {{ cls.parentCppClassName }}(prim) + { + } + + /// Construct a {{ cls.cppClassName }} on the prim held by \p schemaObj . + /// Should be preferred over {{ cls.cppClassName }}(schemaObj.GetPrim()), + /// as it preserves SchemaBase state. + explicit {{ cls.cppClassName }}(const UsdSchemaBase& schemaObj) + : {{ cls.parentCppClassName }}(schemaObj) + { + } +{% endif %} + + /// Destructor. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + virtual ~{{ cls.cppClassName }}() {%- if cls.isAPISchemaBase %} = 0{% endif %}; + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes. Does not include attributes that + /// may be authored by custom/extended methods of the schemas involved. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static const TfTokenVector & + GetSchemaAttributeNames(bool includeInherited=true); +{% if cls.isMultipleApply %} + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes for a given instance name. Does not + /// include attributes that may be authored by custom/extended methods of + /// the schemas involved. The names returned will have the proper namespace + /// prefix. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static TfTokenVector + GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName); + + /// Returns the name of this multiple-apply schema instance + TfToken GetName() const { + return _GetInstanceName(); + } +{% endif %} +{% if not cls.isAPISchemaBase %} + + /// Return a {{ cls.cppClassName }} holding the prim adhering to this + /// schema at \p path on \p stage. If no prim exists at \p path on + /// \p stage, or if the prim at that path does not adhere to this schema, +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + /// return an invalid schema object. \p path must be of the format + /// .{{ cls.propertyNamespacePrefix }}:name . + /// + /// This is shorthand for the following: + /// + /// \code + /// TfToken name = SdfPath::StripNamespace(path.GetToken()); + /// {{ cls.cppClassName }}( + /// stage->GetPrimAtPath(path.GetPrimPath()), name); + /// \endcode +{% else %} + /// return an invalid schema object. This is shorthand for the following: + /// + /// \code + /// {{ cls.cppClassName }}(stage->GetPrimAtPath(path)); + /// \endcode +{% endif %} + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Get(const UsdStagePtr &stage, const SdfPath &path); +{% if cls.isMultipleApply %} + + /// Return a {{ cls.cppClassName }} with name \p name holding the + /// prim \p prim. Shorthand for {{ cls.cppClassName }}(prim, name); + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Get(const UsdPrim &prim, const TfToken &name); + + /// Return a vector of all named instances of {{ cls.cppClassName }} on the + /// given \p prim. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static std::vector<{{ cls.cppClassName }}> + GetAll(const UsdPrim &prim); +{% endif %} +{% endif %} + +{% if cls.isConcrete %} + /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path + /// is defined (according to UsdPrim::IsDefined()) on this stage. + /// + /// If a prim adhering to this schema at \p path is already defined on this + /// stage, return that prim. Otherwise author an \a SdfPrimSpec with + /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for + /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s + /// with \p specifier == \a SdfSpecifierDef and empty typeName at the + /// current EditTarget for any nonexistent, or existing but not \a Defined + /// ancestors. + /// + /// The given \a path must be an absolute prim path that does not contain + /// any variant selections. + /// + /// If it is impossible to author any of the necessary PrimSpecs, (for + /// example, in case \a path cannot map to the current UsdEditTarget's + /// namespace) issue an error and return an invalid \a UsdPrim. + /// + /// Note that this method may return a defined prim whose typeName does not + /// specify this schema class, in case a stronger typeName opinion overrides + /// the opinion at the current EditTarget. + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Define(const UsdStagePtr &stage, const SdfPath &path); +{% endif %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + /// Checks if the given name \p baseName is the base name of a property + /// of {{ cls.usdPrimTypeName }}. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + IsSchemaPropertyBaseName(const TfToken &baseName); + + /// Checks if the given path \p path is of an API schema of type + /// {{ cls.usdPrimTypeName }}. If so, it stores the instance name of + /// the schema in \p name and returns true. Otherwise, it returns false. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + Is{{ cls.usdPrimTypeName }}Path(const SdfPath &path, TfToken *name); +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + /// Returns true if this single-apply API schema can be applied to + /// the given \p prim. If this schema can not be a applied to the prim, + /// this returns false and, if provided, populates \p whyNot with the + /// reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + CanApply(const UsdPrim &prim, std::string *whyNot=nullptr); + + /// Applies this single-apply API schema to the given \p prim. + /// This information is stored by adding "{{ cls.primName }}" to the + /// token-valued, listOp metadata \em apiSchemas on the prim. + /// + /// \return A valid {{ cls.cppClassName }} object is returned upon success. + /// An invalid (or empty) {{ cls.cppClassName }} object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for conditions + /// resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Apply(const UsdPrim &prim); +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + /// Returns true if this multiple-apply API schema can be applied, + /// with the given instance name, \p name, to the given \p prim. If this + /// schema can not be a applied the prim, this returns false and, if + /// provided, populates \p whyNot with the reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static bool + CanApply(const UsdPrim &prim, const TfToken &name, + std::string *whyNot=nullptr); + + /// Applies this multiple-apply API schema to the given \p prim + /// along with the given instance name, \p name. + /// + /// This information is stored by adding "{{ cls.primName }}:name" + /// to the token-valued, listOp metadata \em apiSchemas on the prim. + /// For example, if \p name is 'instance1', the token + /// '{{ cls.primName }}:instance1' is added to 'apiSchemas'. + /// + /// \return A valid {{ cls.cppClassName }} object is returned upon success. + /// An invalid (or empty) {{ cls.cppClassName }} object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for + /// conditions resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static {{ cls.cppClassName }} + Apply(const UsdPrim &prim, const TfToken &name); +{% endif %} + +protected: + /// Returns the kind of schema this class belongs to. + /// + /// \sa UsdSchemaKind + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdSchemaKind _GetSchemaKind() const override; + +private: + // needs to invoke _GetStaticTfType. + friend class UsdSchemaRegistry; + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + static const TfType &_GetStaticTfType(); + + static bool _IsTypedSchema(); + + // override SchemaBase virtuals. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + const TfType &_GetTfType() const override; + +{% for attrName in cls.attrOrder %} +{% set attr = cls.attrs[attrName]%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if attr.apiName != '' %} +public: + // --------------------------------------------------------------------- // + // {{ Upper(attr.apiName) }} + // --------------------------------------------------------------------- // + /// {{ attr.doc }} + /// +{% if attr.details %} + /// | || + /// | -- | -- | +{% for detail in attr.details %} + /// | {{ detail[0] }} | {{ detail[1] }} | +{% endfor %} +{% endif %} + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdAttribute Get{{ Proper(attr.apiName) }}Attr() const; + + /// See Get{{ Proper(attr.apiName) }}Attr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdAttribute Create{{ Proper(attr.apiName) }}Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; + +{% endif %} +{% endfor %} +{% for relName in cls.relOrder %} +{% set rel = cls.rels[relName]%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% if rel.apiName != '' %} +public: + // --------------------------------------------------------------------- // + // {{ Upper(rel.apiName) }} + // --------------------------------------------------------------------- // + /// {{ rel.doc }} + /// +{% for detail in rel.details %} + /// \n {{ detail[0] }}: {{ detail[1] }} +{% endfor %} + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdRelationship Get{{ Proper(rel.apiName) }}Rel() const; + + /// See Get{{ Proper(rel.apiName) }}Rel(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create + {% if useExportAPI -%} + {{ Upper(libraryName) }}_API + {% endif -%} + UsdRelationship Create{{ Proper(rel.apiName) }}Rel() const; +{% endif %} + +{% endfor %} +public: + // ===================================================================== // + // Feel free to add custom code below this line, it will be preserved by + // the code generator. + // + // Just remember to: + // - Close the class declaration with }; +{% if useExportAPI %} + // - Close the namespace with {{ namespaceClose }} +{% endif %} + // - Close the include guard with #endif + // ===================================================================== // + // --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/tokens.h" + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} +{{ tokensPrefix }}TokensType::{{ tokensPrefix }}TokensType() : +{% for token in tokens %} + {{ token.id }}("{{ token.value }}", TfToken::Immortal), +{% endfor %} + allTokens({ +{% for token in tokens %} + {{ token.id }}{% if not loop.last %},{% endif %} + +{% endfor %} + }) +{ +} + +TfStaticData<{{ tokensPrefix }}TokensType> {{ tokensPrefix }}Tokens; +{% if useExportAPI %} + +{{ namespaceClose }} +{% endif %} +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef {{ Upper(tokensPrefix) }}_TOKENS_H +#define {{ Upper(tokensPrefix) }}_TOKENS_H + +/// \file {{ libraryName }}/tokens.h + +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// +// This is an automatically generated file (by usdGenSchema.py). +// Do not hand-edit! +// +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +{% if useExportAPI %} +#include "pxr/pxr.h" +#include "{{ libraryPath }}/api.h" +{% endif %} +#include "pxr/base/tf/staticData.h" +#include "pxr/base/tf/token.h" +#include + +{% if useExportAPI %} +{{ namespaceOpen }} + +{% endif %} + +/// \class {{ tokensPrefix }}TokensType +/// +/// \link {{ tokensPrefix }}Tokens \endlink provides static, efficient +/// \link TfToken TfTokens\endlink for use in all public USD API. +/// +/// These tokens are auto-generated from the module's schema, representing +/// property names, for when you need to fetch an attribute or relationship +/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient +/// manner, and allow the compiler to verify that you spelled the name +/// correctly. +/// +/// {{ tokensPrefix }}Tokens also contains all of the \em allowedTokens values +/// declared for schema builtin attributes of 'token' scene description type. +{% if tokens %} +/// Use {{ tokensPrefix }}Tokens like so: +/// +/// \code +/// gprim.GetMyTokenValuedAttr().Set({{ tokensPrefix }}Tokens->{{ tokens[0].id }}); +/// \endcode +{% endif %} +struct {{ tokensPrefix }}TokensType { + {% if useExportAPI %}{{ Upper(libraryName) }}_API {% endif %}{{ tokensPrefix }}TokensType(); +{% for token in tokens %} + /// \brief "{{ token.value }}" + /// + /// {{ token.desc }} + const TfToken {{ token.id }}; +{% endfor %} + /// A vector of all of the tokens listed above. + const std::vector allTokens; +}; + +/// \var {{ tokensPrefix }}Tokens +/// +/// A global variable with static, efficient \link TfToken TfTokens\endlink +/// for use in all public USD API. \sa {{ tokensPrefix }}TokensType +extern{% if useExportAPI %} {{ Upper(libraryName) }}_API{% endif %} TfStaticData<{{ tokensPrefix }}TokensType> {{ tokensPrefix }}Tokens; +{% if useExportAPI %} + +{{ namespaceClose }} +{% endif %} + +#endif +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "{{ libraryPath }}/{{ cls.GetHeaderFile() }}" +#include "pxr/usd/usd/schemaBase.h" + +#include "pxr/usd/sdf/primSpec.h" + +#include "pxr/usd/usd/pyConversions.h" +{% if cls.isAppliedAPISchema %} +#include "pxr/base/tf/pyAnnotatedBoolResult.h" +{% endif %} +#include "pxr/base/tf/pyContainerConversions.h" +#include "pxr/base/tf/pyResultConversions.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/base/tf/wrapTypeHelpers.h" + +#include + +#include + +using namespace boost::python; + +{% if useExportAPI %} +{{ namespaceUsing }} + +namespace { + +{% endif %} +#define WRAP_CUSTOM \ + template static void _CustomWrapCode(Cls &_class) + +// fwd decl. +WRAP_CUSTOM; + +{% for attrName in cls.attrOrder -%} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API if apiName is not empty string. #} +{% if attr.apiName != '' %} + +static UsdAttribute +_Create{{ Proper(attr.apiName) }}Attr({{ cls.cppClassName }} &self, + object defaultVal, bool writeSparsely) { + return self.Create{{ Proper(attr.apiName) }}Attr( + UsdPythonToSdfType(defaultVal, {{ attr.usdType }}), writeSparsely); +} +{% endif %} +{% endfor %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + +static bool _WrapIs{{ cls.usdPrimTypeName }}Path(const SdfPath &path) { + TfToken collectionName; + return {{ cls.cppClassName }}::Is{{ cls.usdPrimTypeName }}Path( + path, &collectionName); +} +{% endif %} +{% if not cls.isAPISchemaBase %} + +static std::string +_Repr(const {{ cls.cppClassName }} &self) +{ + std::string primRepr = TfPyRepr(self.GetPrim()); +{% if cls.isMultipleApply %} + std::string instanceName = TfPyRepr(self.GetName()); + return TfStringPrintf( + "{{ libraryName[0]|upper }}{{ libraryName[1:] }}.{{ cls.className }}(%s, '%s')", + primRepr.c_str(), instanceName.c_str()); +{% else %} + return TfStringPrintf( + "{{ libraryName[0]|upper }}{{ libraryName[1:] }}.{{ cls.className }}(%s)", + primRepr.c_str()); +{% endif %} +} +{% endif %} +{% if cls.isAppliedAPISchema %} + +struct {{ cls.cppClassName }}_CanApplyResult : + public TfPyAnnotatedBoolResult +{ + {{ cls.cppClassName }}_CanApplyResult(bool val, std::string const &msg) : + TfPyAnnotatedBoolResult(val, msg) {} +}; + +{% if cls.isMultipleApply %} +static {{ cls.cppClassName }}_CanApplyResult +_WrapCanApply(const UsdPrim& prim, const TfToken& name) +{ + std::string whyNot; + bool result = {{ cls.cppClassName }}::CanApply(prim, name, &whyNot); + return {{ cls.cppClassName }}_CanApplyResult(result, whyNot); +} +{% else %} +static {{ cls.cppClassName }}_CanApplyResult +_WrapCanApply(const UsdPrim& prim) +{ + std::string whyNot; + bool result = {{ cls.cppClassName }}::CanApply(prim, &whyNot); + return {{ cls.cppClassName }}_CanApplyResult(result, whyNot); +} +{% endif %} +{% endif %} +{% if useExportAPI %} + +} // anonymous namespace +{% endif %} + +void wrap{{ cls.cppClassName }}() +{ + typedef {{ cls.cppClassName }} This; + +{% if cls.isAppliedAPISchema %} + {{ cls.cppClassName }}_CanApplyResult::Wrap<{{ cls.cppClassName }}_CanApplyResult>( + "_CanApplyResult", "whyNot"); + +{% endif %} +{% if cls.isAPISchemaBase %} + class_< This , bases<{{ cls.parentCppClassName }}>, boost::noncopyable> cls ("APISchemaBase", "", no_init); +{% else %} + class_ > + cls("{{ cls.className }}"); +{% endif %} + + cls +{% if not cls.isAPISchemaBase %} +{% if cls.isMultipleApply %} + .def(init((arg("prim"), arg("name")))) + .def(init((arg("schemaObj"), arg("name")))) +{% else %} + .def(init(arg("prim"))) + .def(init(arg("schemaObj"))) +{% endif %} +{% endif %} + .def(TfTypePythonClass()) + +{% if not cls.isAPISchemaBase %} +{% if cls.isMultipleApply %} + .def("Get", + ({{ cls.cppClassName }}(*)(const UsdStagePtr &stage, + const SdfPath &path)) + &This::Get, + (arg("stage"), arg("path"))) + .def("Get", + ({{ cls.cppClassName }}(*)(const UsdPrim &prim, + const TfToken &name)) + &This::Get, + (arg("prim"), arg("name"))) +{% else %} + .def("Get", &This::Get, (arg("stage"), arg("path"))) +{% endif %} + .staticmethod("Get") +{% endif %} +{% if cls.isMultipleApply %} + + .def("GetAll", + (std::vector<{{ cls.cppClassName }}>(*)(const UsdPrim &prim)) + &This::GetAll, + arg("prim"), + return_value_policy()) + .staticmethod("GetAll") +{% endif %} +{% if cls.isConcrete %} + + .def("Define", &This::Define, (arg("stage"), arg("path"))) + .staticmethod("Define") +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + .def("CanApply", &_WrapCanApply, (arg("prim"))) + .staticmethod("CanApply") +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + .def("CanApply", &_WrapCanApply, (arg("prim"), arg("name"))) + .staticmethod("CanApply") +{% endif %} +{% if cls.isAppliedAPISchema and not cls.isMultipleApply %} + + .def("Apply", &This::Apply, (arg("prim"))) + .staticmethod("Apply") +{% endif %} +{% if cls.isAppliedAPISchema and cls.isMultipleApply %} + + .def("Apply", &This::Apply, (arg("prim"), arg("name"))) + .staticmethod("Apply") +{% endif %} + +{% if cls.isMultipleApply %} + .def("GetSchemaAttributeNames", + (const TfTokenVector &(*)(bool))&This::GetSchemaAttributeNames, + arg("includeInherited")=true, + return_value_policy()) + .def("GetSchemaAttributeNames", + (TfTokenVector(*)(bool, const TfToken &)) + &This::GetSchemaAttributeNames, + arg("includeInherited"), + arg("instanceName"), + return_value_policy()) +{% else %} + .def("GetSchemaAttributeNames", + &This::GetSchemaAttributeNames, + arg("includeInherited")=true, + return_value_policy()) +{% endif %} + .staticmethod("GetSchemaAttributeNames") + + .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find, + return_value_policy()) + .staticmethod("_GetStaticTfType") + + .def(!self) + +{% for attrName in cls.attrOrder -%} +{% set attr = cls.attrs[attrName] %} +{# Only emit Create/Get API if apiName is not empty string. #} +{% if attr.apiName != '' %} + + .def("Get{{ Proper(attr.apiName) }}Attr", + &This::Get{{ Proper(attr.apiName) }}Attr) + .def("Create{{ Proper(attr.apiName) }}Attr", + &_Create{{ Proper(attr.apiName) }}Attr, + (arg("defaultValue")=object(), + arg("writeSparsely")=false)) +{% endif %} +{% endfor %} + +{% for relName in cls.relOrder -%} +{# Only emit Create/Get API and doxygen if apiName is not empty string. #} +{% set rel = cls.rels[relName] %} +{% if rel.apiName != '' %} + + .def("Get{{ Proper(rel.apiName) }}Rel", + &This::Get{{ Proper(rel.apiName) }}Rel) + .def("Create{{ Proper(rel.apiName) }}Rel", + &This::Create{{ Proper(rel.apiName) }}Rel) +{% endif %} +{% endfor %} +{% if cls.isMultipleApply and cls.propertyNamespacePrefix %} + .def("Is{{ cls.usdPrimTypeName }}Path", _WrapIs{{ cls.usdPrimTypeName }}Path) + .staticmethod("Is{{ cls.usdPrimTypeName }}Path") +{% endif %} +{% if not cls.isAPISchemaBase %} + .def("__repr__", ::_Repr) +{% endif %} + ; + + _CustomWrapCode(cls); +} + +// ===================================================================== // +// Feel free to add custom code below this line, it will be preserved by +// the code generator. The entry point for your custom code should look +// minimally like the following: +// +// WRAP_CUSTOM { +// _class +// .def("MyCustomMethod", ...) +// ; +// } +// +// Of course any other ancillary or support code may be provided. +{% if useExportAPI %} +// +// Just remember to wrap code in the appropriate delimiters: +// 'namespace {', '}'. +// +{% endif %} +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +// GENERATED FILE. DO NOT EDIT. +#include +#include "{{ libraryPath }}/tokens.h" + +{% if useExportAPI %} +{{ namespaceUsing }} + +{% endif %} +namespace { + +// Helper to return a static token as a string. We wrap tokens as Python +// strings and for some reason simply wrapping the token using def_readonly +// bypasses to-Python conversion, leading to the error that there's no +// Python type for the C++ TfToken type. So we wrap this functor instead. +class _WrapStaticToken { +public: + _WrapStaticToken(const TfToken* token) : _token(token) { } + + std::string operator()() const + { + return _token->GetString(); + } + +private: + const TfToken* _token; +}; + +template +void +_AddToken(T& cls, const char* name, const TfToken& token) +{ + cls.add_static_property(name, + boost::python::make_function( + _WrapStaticToken(&token), + boost::python::return_value_policy< + boost::python::return_by_value>(), + boost::mpl::vector1())); +} + +} // anonymous + +void wrap{{ tokensPrefix }}Tokens() +{ + boost::python::class_<{{ tokensPrefix }}TokensType, boost::noncopyable> + cls("Tokens", boost::python::no_init); +{% for token in tokens %} + _AddToken(cls, "{{ token.id }}", {{ tokensPrefix }}Tokens->{{ token.id }}); +{% endfor %} +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "Typed" ( + doc = '''The base class for all typed schemas (those that can impart a + typeName to a UsdPrim), and therefore the base class for all + concrete, instantiable "IsA" schemas. + + UsdTyped implements a typeName-based query for its override of + UsdSchemaBase::_IsCompatible(). It provides no other behavior.''' +) +{ +} + +class "APISchemaBase" ( + doc = """The base class for all API schemas. + + An API schema provides an interface to a prim's qualities, but does not + specify a typeName for the underlying prim. The prim's qualities include + its inheritance structure, attributes, relationships etc. Since it cannot + provide a typeName, an API schema is considered to be non-concrete. + + To auto-generate an API schema using usdGenSchema, simply leave the + typeName empty and make it inherit from \"/APISchemaBase\" or from another + API schema. See UsdModelAPI, UsdClipsAPI and UsdCollectionAPI for examples. + + API schemas are classified into applied and non-applied API schemas. + The author of an API schema has to decide on the type of API schema + at the time of its creation by setting customData['apiSchemaType'] in the + schema definition (i.e. in the associated primSpec inside the schema.usda + file). UsdAPISchemaBase implements methods that are used to record the + application of an API schema on a USD prim. + + If an API schema only provides an interface to set certain core bits of + metadata (like UsdModelAPI, which sets model kind and UsdClipsAPI, which + sets clips-related metadata) OR if the API schema can apply to any type of + prim or only to a known fixed set of prim types OR if there is no use of + recording the application of the API schema, in such cases, it would be + better to make it a non-applied API schema. Examples of non-applied API + schemas include UsdModelAPI, UsdClipsAPI, UsdShadeConnectableAPI and + UsdGeomPrimvarsAPI. + + If there is a need to discover (or record) whether a prim contains or + subscribes to a given API schema, it would be advantageous to make the API + schema be \"applied\". In general, API schemas that add one or more properties + to a prim should be tagged as applied API schemas. A public Apply() method + is generated for applied API schemas by usdGenSchema. An applied API schema + must be applied to a prim via a call to the generated Apply() method, for + the schema object to evaluate to true when converted to a bool using the + explicit bool conversion operator. Examples of applied API schemas include + UsdCollectionAPI, UsdGeomModelAPI and UsdGeomMotionAPI + + \\anchor UsdAPISchemaBase_SingleVsMultipleApply + \\name Single vs. Multiple Apply API Schemas + + Applied API schemas can further be classified into single-apply and + multiple-apply API schemas. As the name suggests, a single-apply API schema + can only be applied once to a prim. A multiple-apply API schema can be + applied multiple times with different 'instanceName' values. An example of + a multiple-apply API schema is UsdCollectionAPI, where the API schema is + applied to a prim once for every collection owned by the prim. + + \\note An applied API schema can only inherit from another applied API + schema or directly from APISchemaBase. Similarly, a non-applied API schema + can only inherit from a non-applied API Schema or directly from + APISchemaBase. 'usdGenSchema' attempts to issue a warning if it detects + an incompatibility. + + \\note A multiple-apply API schema may not inherit from a single-apply API + schema and vice versa. + + \\note When the bool-conversion operator is invoked on an applied API + schema, it evaluates to true only if the application of the API schema has + been recorded on the prim via a call to the auto-generated Apply() method. + + """ +) +{ +} + +class "ModelAPI" ( + doc = """UsdModelAPI is an API schema that provides an interface to a prim's + model qualities, if it does, in fact, represent the root prim of a model. + + The first and foremost model quality is its kind, i.e. the metadata + that establishes it as a model (See KindRegistry). UsdModelAPI provides + various methods for setting and querying the prim's kind, as well as + queries (also available on UsdPrim) for asking what category of model + the prim is. See \"Kind and Model-ness\". + + UsdModelAPI also provides access to a prim's \"assetInfo\" + data. While any prim can host assetInfo, it is common that published + (referenced) assets are packaged as models, therefore it is convenient + to provide access to the one from the other. + + \\todo establish an _IsCompatible() override that returns IsModel() + \\todo GetModelInstanceName() + """ +) +{ +} + +class "CollectionAPI" ( + doc = """ This is a general purpose API schema, used to describe a + collection of heterogeneous objects within the scene. \"Objects\" here may be + prims or properties belonging to prims or other collections. It's an add-on + schema that can be applied many times to a prim with different collection + names. + + A collection allows an enumeration of a set of paths to include and a + set of paths to exclude. Whether the descendants of an included + path are members of a collection are decided by its expansion rule + (see below). If the collection excludes paths that are not descendents + of included paths, the collection implicitly includes the root path + </>. If such a collection also includes paths that are not + descendants of the excluded paths, it is considered invalid, since + the intention is ambiguous. + + All the properties authored by the schema are namespaced under + \"collection:\". The given name of the collection provides additional + namespacing for the various per-collection properties, which include the + following: + +
  • uniform token collection:collectionName:expansionRule - + specified how the paths that are included in the collection must be expanded + to determine its members. Possible values include: +
      +
    • explicitOnly - only paths in the includes rel targets and not + in the excludes rel targets belong to the collection. +
    • +
    • expandPrims - all the prims at or below the includes rel- + targets (and not under the excludes rel-targets) belong to the + collection. Any property paths included in the collection would, of + course, also be honored. This is the default behavior as it satisfies + most use cases. +
    • +
    • expandPrimsAndProperties - like expandPrims, but also + includes all properties on all matched prims. We're still not quite + sure what the use cases are for this, but you can use it to capture a + whole lot of UsdObjects very concisely. +
    • +
    +
  • +
  • bool collection:collectionName:includeRoot - boolean + attribute indicating whether the pseudo-root path </> should + be counted as one of the included target paths. The fallback is false. + This separate attribute is required because relationships cannot + directly target the root. When expansionRule is explicitOnly, this + attribute is ignored. +
  • rel collection:collectionName:includes - specifies a list + of targets that are included in the collection. This can target prims or + properties directly. A collection can insert the rules of another + collection by making its includes relationship target the + collection:{collectionName} property on the owning prim of the + collection to be included (see UsdCollectionAPI::GetCollectionAttr). + It is important to note that including another collection does not + guarantee the contents of that collection will be in the final collection; + instead, the rules are merged. This means, for example, an exclude + entry may exclude a portion of the included collection. + When a collection includes one or more collections, the order in which + targets are added to the includes relationship may become significant, if + there are conflicting opinions about the same path. Targets that are added + later are considered to be stronger than earlier targets for the same path. +
  • +
  • rel collection:collectionName:excludes - specifies a list + of targets that are excluded below the included paths in this + collection. This can target prims or properties directly, but cannot + target another collection. This is to keep the membership determining + logic simple, efficient and easier to reason about. Finally, it is invalid + for a collection to exclude paths that are not included in it. The presence + of such \"orphaned\" excluded paths will not affect the set of paths included + in the collection, but may affect the performance of querying membership of + a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects). +
  • +
  • uniform opaque collection:collectionName - opaque + attribute (meaning it can never have a value) that represents the collection + for the purpose of allowing another collection to include it. When this + property is targeted by another collection's includes relationship, + the rules of this collection will be inserted into the rules of the collection + that includes it. +
+ + Implicit inclusion + + In some scenarios it is useful to express a collection that includes + everything except certain paths. To support this, a collection + that has an exclude that is not a descendent of any include + will include the root path </>. + + Creating collections in C++ + + \\snippet examples_usd.cpp ApplyCollections + """ +) +{ + uniform opaque collection:__INSTANCE_NAME__ ( + doc = """This property represents the collection for the purpose of + allowing another collection to include it. When this property is + targeted by another collection's includes relationship, the rules + of this collection will be inserted into the rules of the collection + that includes it. + """ + ) + rel collection:__INSTANCE_NAME__:excludes ( + doc = '''Specifies a list of targets that are excluded below + the included paths in this collection. This can target prims or + properties directly, but cannot target another collection. This is to + keep the membership determining logic simple, efficient and easier to + reason about. Finally, it is invalid for a collection to exclude + paths that are not included in it. The presence of such "orphaned" + excluded paths will not affect the set of paths included in the + collection, but may affect the performance of querying membership of + a path in the collection (see + UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects).''' + ) + uniform token collection:__INSTANCE_NAME__:expansionRule = "expandPrims" ( + allowedTokens = ["explicitOnly", "expandPrims", "expandPrimsAndProperties"] + doc = """Specifies how the paths that are included in + the collection must be expanded to determine its members.""" + ) + uniform bool collection:__INSTANCE_NAME__:includeRoot ( + doc = """Boolean attribute indicating whether the pseudo-root + path </> should be counted as one of the included target + paths. The fallback is false. This separate attribute is + required because relationships cannot directly target the root.""" + ) + rel collection:__INSTANCE_NAME__:includes ( + doc = """Specifies a list of targets that are included in the collection. + This can target prims or properties directly. A collection can insert + the rules of another collection by making its includes + relationship target the collection:{collectionName} property on + the owning prim of the collection to be included""" + ) + uniform pathExpression collection:__INSTANCE_NAME__:membershipExpression ( + doc = """Specifies a path expression that determines membership in this + collection.""" + ) +} + +class "ClipsAPI" ( + doc = """ UsdClipsAPI is an API schema that provides an interface to + a prim's clip metadata. Clips are a \"value resolution\" feature that + allows one to specify a sequence of usd files (clips) to be consulted, + over time, as a source of varying overrides for the prims at and + beneath this prim in namespace. + + SetClipAssetPaths() establishes the set of clips that can be consulted. + SetClipActive() specifies the ordering of clip application over time + (clips can be repeated), while SetClipTimes() specifies time-mapping + from stage-time to clip-time for the clip active at a given stage-time, + which allows for time-dilation and repetition of clips. + Finally, SetClipPrimPath() determines the path within each clip that will + map to this prim, i.e. the location within the clip at which we will look + for opinions for this prim. + + The clip asset paths, times and active metadata can also be specified + through template clip metadata. This can be desirable when your set of + assets is very large, as the template metadata is much more concise. + SetClipTemplateAssetPath() establishes the asset identifier pattern of the + set of clips to be consulted. SetClipTemplateStride(), + SetClipTemplateEndTime(), and SetClipTemplateStartTime() specify the range + in which USD will search, based on the template. From the set of resolved + asset paths, times and active will be derived internally. + + A prim may have multiple \"clip sets\" -- named sets of clips that each + have their own values for the metadata described above. For example, + a prim might have a clip set named \"Clips_1\" that specifies some group + of clip asset paths, and another clip set named \"Clips_2\" that uses + an entirely different set of clip asset paths. These clip sets are + composed across composition arcs, so clip sets for a prim may be + defined in multiple sublayers or references, for example. Individual + metadata for a given clip set may be sparsely overridden. + + Important facts about clips: + - Within the layerstack in which clips are established, the + opinions within the clips will be weaker than any local opinions + in the layerstack, but em stronger than varying opinions coming across + references and variants. + - We will never look for metadata or default opinions in clips + when performing value resolution on the owning stage, since these + quantities must be time-invariant. + + This leads to the common structure in which we reference a model asset + on a prim, and then author clips at the same site: the asset reference + will provide the topology and unvarying data for the model, while the + clips will provide the time-sampled animation. + + For further information, see \\ref Usd_Page_ValueClips + """ +) +{ +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "apiSchemas": { + "appliesTo": "prims", + "type": "tokenlistop" + }, + "clipSets": { + "appliesTo": [ + "prims" + ], + "type": "stringlistop" + }, + "clips": { + "appliesTo": [ + "prims" + ], + "type": "dictionary" + }, + "fallbackPrimTypes": { + "appliesTo": [ + "layers" + ], + "type": "dictionary" + } + }, + "Types": { + "UsdAPISchemaBase": { + "alias": { + "UsdSchemaBase": "APISchemaBase" + }, + "autoGenerated": true, + "bases": [ + "UsdSchemaBase" + ], + "schemaKind": "abstractBase" + }, + "UsdClipsAPI": { + "alias": { + "UsdSchemaBase": "ClipsAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdCollectionAPI": { + "alias": { + "UsdSchemaBase": "CollectionAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "multipleApplyAPI" + }, + "UsdModelAPI": { + "alias": { + "UsdSchemaBase": "ModelAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdSchemaBase": { + "alias": { + "UsdSchemaBase": "SchemaBase" + }, + "schemaKind": "abstractBase" + }, + "UsdTyped": { + "alias": { + "UsdSchemaBase": "Typed" + }, + "autoGenerated": true, + "bases": [ + "UsdSchemaBase" + ], + "schemaKind": "abstractBase" + }, + "UsdUsdFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USD File Format", + "extensions": [ + "usd" + ], + "formatId": "usd", + "primary": true, + "target": "usd" + }, + "UsdUsdaFileFormat": { + "bases": [ + "SdfTextFileFormat" + ], + "displayName": "USD Text File Format", + "extensions": [ + "usda" + ], + "formatId": "usda", + "primary": true, + "target": "usd" + }, + "UsdUsdcFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USD Crate File Format", + "extensions": [ + "usdc" + ], + "formatId": "usdc", + "primary": true, + "target": "usd" + }, + "UsdUsdzFileFormat": { + "bases": [ + "SdfFileFormat" + ], + "displayName": "USDZ File Format", + "extensions": [ + "usdz" + ], + "formatId": "usdz", + "primary": true, + "supportsEditing": false, + "supportsWriting": false, + "target": "usd" + }, + "Usd_UsdzResolver": { + "bases": [ + "ArPackageResolver" + ], + "extensions": [ + "usdz" + ] + } + } + }, + "LibraryPath": "", + "Name": "usd", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD primitive schemata and drives code generation." +) + +def "GLOBAL" ( + customData = { + string libraryName = "usd" + string libraryPath = "pxr/usd/usd" + # string libraryPrefix = "Usd" + # string tokensPrefix = "Usd" + dictionary libraryTokens = { + dictionary apiSchemas = { + string doc = """ + A listop metadata containing the API schemas which have + been applied to this prim, using the Apply() method on + the particular schema class. + """ + } + dictionary fallbackPrimTypes = { + string doc = """ + A dictionary metadata that maps the name of a concrete schema + prim type to an ordered list of schema prim types to use instead + if the schema prim type doesn't exist in version of USD being + used. + """ + } + } + } +) +{ +} + +class "Typed" +( + doc = """The base class for all \\em typed schemas (those that can impart a + typeName to a UsdPrim), and therefore the base class for all + concrete, instantiable "IsA" schemas. + + UsdTyped implements a typeName-based query for its override of + UsdSchemaBase::_IsCompatible(). It provides no other behavior.""" +) +{ +} + +class "APISchemaBase" +( + doc = """The base class for all \\em API schemas. + + An API schema provides an interface to a prim's qualities, but does not + specify a typeName for the underlying prim. The prim's qualities include + its inheritance structure, attributes, relationships etc. Since it cannot + provide a typeName, an API schema is considered to be non-concrete. + + To auto-generate an API schema using usdGenSchema, simply leave the + typeName empty and make it inherit from "/APISchemaBase" or from another + API schema. See UsdModelAPI, UsdClipsAPI and UsdCollectionAPI for examples. + + API schemas are classified into applied and non-applied API schemas. + The author of an API schema has to decide on the type of API schema + at the time of its creation by setting customData['apiSchemaType'] in the + schema definition (i.e. in the associated primSpec inside the schema.usda + file). UsdAPISchemaBase implements methods that are used to record the + application of an API schema on a USD prim. + + If an API schema only provides an interface to set certain core bits of + metadata (like UsdModelAPI, which sets model kind and UsdClipsAPI, which + sets clips-related metadata) OR if the API schema can apply to any type of + prim or only to a known fixed set of prim types OR if there is no use of + recording the application of the API schema, in such cases, it would be + better to make it a non-applied API schema. Examples of non-applied API + schemas include UsdModelAPI, UsdClipsAPI, UsdShadeConnectableAPI and + UsdGeomPrimvarsAPI. + + If there is a need to discover (or record) whether a prim contains or + subscribes to a given API schema, it would be advantageous to make the API + schema be "applied". In general, API schemas that add one or more properties + to a prim should be tagged as applied API schemas. A public Apply() method + is generated for applied API schemas by usdGenSchema. An applied API schema + must be applied to a prim via a call to the generated Apply() method, for + the schema object to evaluate to true when converted to a bool using the + explicit bool conversion operator. Examples of applied API schemas include + UsdCollectionAPI, UsdGeomModelAPI and UsdGeomMotionAPI + + \\anchor UsdAPISchemaBase_SingleVsMultipleApply + \\name Single vs. Multiple Apply API Schemas + + Applied API schemas can further be classified into single-apply and + multiple-apply API schemas. As the name suggests, a single-apply API schema + can only be applied once to a prim. A multiple-apply API schema can be + applied multiple times with different 'instanceName' values. An example of + a multiple-apply API schema is UsdCollectionAPI, where the API schema is + applied to a prim once for every collection owned by the prim. + + \\note An applied API schema can only inherit from another applied API + schema or directly from APISchemaBase. Similarly, a non-applied API schema + can only inherit from a non-applied API Schema or directly from + APISchemaBase. 'usdGenSchema' attempts to issue a warning if it detects + an incompatibility. + + \\note A multiple-apply API schema may not inherit from a single-apply API + schema and vice versa. + + \\note When the bool-conversion operator is invoked on an applied API + schema, it evaluates to true only if the application of the API schema has + been recorded on the prim via a call to the auto-generated Apply() method. + + """ + customData = { + string fileName = "apiSchemaBase" + } +) +{ +} + +class "ModelAPI" +( + inherits = + doc = """UsdModelAPI is an API schema that provides an interface to a prim's + model qualities, if it does, in fact, represent the root prim of a model. + + The first and foremost model quality is its \\em kind, i.e. the metadata + that establishes it as a model (See KindRegistry). UsdModelAPI provides + various methods for setting and querying the prim's kind, as well as + queries (also available on UsdPrim) for asking what category of model + the prim is. See \\ref Usd_ModelKind "Kind and Model-ness". + + UsdModelAPI also provides access to a prim's \\ref Usd_Model_AssetInfo "assetInfo" + data. While any prim \\em can host assetInfo, it is common that published + (referenced) assets are packaged as models, therefore it is convenient + to provide access to the one from the other. + + \\todo establish an _IsCompatible() override that returns IsModel() + \\todo GetModelInstanceName() + """ + customData = { + string apiSchemaType = "nonApplied" + } +) +{ +} + +class "CollectionAPI" +( + inherits = + doc = """ This is a general purpose API schema, used to describe a + collection of heterogeneous objects within the scene. "Objects" here may be + prims or properties belonging to prims or other collections. It's an add-on + schema that can be applied many times to a prim with different collection + names. + + A collection allows an enumeration of a set of paths to include and a + set of paths to exclude. Whether the descendants of an included + path are members of a collection are decided by its expansion rule + (see below). If the collection excludes paths that are not descendents + of included paths, the collection implicitly includes the root path + </>. If such a collection also includes paths that are not + descendants of the excluded paths, it is considered invalid, since + the intention is ambiguous. + + All the properties authored by the schema are namespaced under + "collection:". The given name of the collection provides additional + namespacing for the various per-collection properties, which include the + following: + +
  • uniform token collection:collectionName:expansionRule - + specified how the paths that are included in the collection must be expanded + to determine its members. Possible values include: +
      +
    • explicitOnly - only paths in the includes rel targets and not + in the excludes rel targets belong to the collection. +
    • +
    • expandPrims - all the prims at or below the includes rel- + targets (and not under the excludes rel-targets) belong to the + collection. Any property paths included in the collection would, of + course, also be honored. This is the default behavior as it satisfies + most use cases. +
    • +
    • expandPrimsAndProperties - like expandPrims, but also + includes all properties on all matched prims. We're still not quite + sure what the use cases are for this, but you can use it to capture a + whole lot of UsdObjects very concisely. +
    • +
    +
  • +
  • bool collection:collectionName:includeRoot - boolean + attribute indicating whether the pseudo-root path </> should + be counted as one of the included target paths. The fallback is false. + This separate attribute is required because relationships cannot + directly target the root. When expansionRule is explicitOnly, this + attribute is ignored. +
  • rel collection:collectionName:includes - specifies a list + of targets that are included in the collection. This can target prims or + properties directly. A collection can insert the rules of another + collection by making its includes relationship target the + collection:{collectionName} property on the owning prim of the + collection to be included (see UsdCollectionAPI::GetCollectionAttr). + It is important to note that including another collection does not + guarantee the contents of that collection will be in the final collection; + instead, the rules are merged. This means, for example, an exclude + entry may exclude a portion of the included collection. + When a collection includes one or more collections, the order in which + targets are added to the includes relationship may become significant, if + there are conflicting opinions about the same path. Targets that are added + later are considered to be stronger than earlier targets for the same path. +
  • +
  • rel collection:collectionName:excludes - specifies a list + of targets that are excluded below the included paths in this + collection. This can target prims or properties directly, but cannot + target another collection. This is to keep the membership determining + logic simple, efficient and easier to reason about. Finally, it is invalid + for a collection to exclude paths that are not included in it. The presence + of such "orphaned" excluded paths will not affect the set of paths included + in the collection, but may affect the performance of querying membership of + a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects). +
  • +
  • uniform opaque collection:collectionName - opaque + attribute (meaning it can never have a value) that represents the collection + for the purpose of allowing another collection to include it. When this + property is targeted by another collection's includes relationship, + the rules of this collection will be inserted into the rules of the collection + that includes it. +
+ + Implicit inclusion + + In some scenarios it is useful to express a collection that includes + everything except certain paths. To support this, a collection + that has an exclude that is not a descendent of any include + will include the root path </>. + + Creating collections in C++ + + \\snippet examples_usd.cpp ApplyCollections + """ + + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/collectionMembershipQuery.h" +#include "pxr/usd/usd/primFlags.h" +#include "pxr/usd/usd/tokens.h" +#include "pxr/usd/sdf/pathExpression.h" +""" + token apiSchemaType = "multipleApply" + token propertyNamespacePrefix = "collection" + dictionary schemaTokens = { + dictionary exclude = { + string doc = """ + This is the token used to exclude a path from a collection. + Although it is not a possible value for the "expansionRule" + attribute, it is used as the expansionRule for excluded paths + in UsdCollectionAPI::MembershipQuery::IsPathIncluded. + """ + } + } + } +) +{ + uniform token expansionRule = "expandPrims" ( + allowedTokens = ["explicitOnly", "expandPrims", "expandPrimsAndProperties"] + doc = """Specifies how the paths that are included in + the collection must be expanded to determine its members.""" + ) + uniform bool includeRoot ( + doc = """Boolean attribute indicating whether the pseudo-root + path </> should be counted as one of the included target + paths. The fallback is false. This separate attribute is + required because relationships cannot directly target the root.""" + ) + rel includes ( + doc = """Specifies a list of targets that are included in the collection. + This can target prims or properties directly. A collection can insert + the rules of another collection by making its includes + relationship target the collection:{collectionName} property on + the owning prim of the collection to be included""" + ) + rel excludes ( + doc = """Specifies a list of targets that are excluded below + the included paths in this collection. This can target prims or + properties directly, but cannot target another collection. This is to + keep the membership determining logic simple, efficient and easier to + reason about. Finally, it is invalid for a collection to exclude + paths that are not included in it. The presence of such "orphaned" + excluded paths will not affect the set of paths included in the + collection, but may affect the performance of querying membership of + a path in the collection (see + UsdCollectionAPI::MembershipQuery::IsPathIncluded) + or of enumerating the objects belonging to the collection (see + UsdCollectionAPI::GetIncludedObjects).""" + ) + uniform pathExpression membershipExpression ( + doc = """Specifies a path expression that determines membership in this + collection.""" + ) + uniform opaque __INSTANCE_NAME__ ( + customData = { + string apiName = "Collection" + } + doc = """This property represents the collection for the purpose of + allowing another collection to include it. When this property is + targeted by another collection's includes relationship, the rules + of this collection will be inserted into the rules of the collection + that includes it. + """ + ) +} + +class "ClipsAPI" +( + inherits = + doc = """ UsdClipsAPI is an API schema that provides an interface to + a prim's clip metadata. Clips are a "value resolution" feature that + allows one to specify a sequence of usd files (clips) to be consulted, + over time, as a source of varying overrides for the prims at and + beneath this prim in namespace. + + SetClipAssetPaths() establishes the set of clips that can be consulted. + SetClipActive() specifies the ordering of clip application over time + (clips can be repeated), while SetClipTimes() specifies time-mapping + from stage-time to clip-time for the clip active at a given stage-time, + which allows for time-dilation and repetition of clips. + Finally, SetClipPrimPath() determines the path within each clip that will + map to this prim, i.e. the location within the clip at which we will look + for opinions for this prim. + + The clip asset paths, times and active metadata can also be specified + through template clip metadata. This can be desirable when your set of + assets is very large, as the template metadata is much more concise. + SetClipTemplateAssetPath() establishes the asset identifier pattern of the + set of clips to be consulted. SetClipTemplateStride(), + SetClipTemplateEndTime(), and SetClipTemplateStartTime() specify the range + in which USD will search, based on the template. From the set of resolved + asset paths, times and active will be derived internally. + + A prim may have multiple "clip sets" -- named sets of clips that each + have their own values for the metadata described above. For example, + a prim might have a clip set named "Clips_1" that specifies some group + of clip asset paths, and another clip set named "Clips_2" that uses + an entirely different set of clip asset paths. These clip sets are + composed across composition arcs, so clip sets for a prim may be + defined in multiple sublayers or references, for example. Individual + metadata for a given clip set may be sparsely overridden. + + Important facts about clips: + \\li Within the layerstack in which clips are established, the + opinions within the clips will be \\em weaker than any local opinions + in the layerstack, but \em stronger than varying opinions coming across + references and variants. + \\li We will never look for metadata or default opinions in clips + when performing value resolution on the owning stage, since these + quantities must be time-invariant. + + This leads to the common structure in which we reference a model asset + on a prim, and then author clips at the same site: the asset reference + will provide the topology and unvarying data for the model, while the + clips will provide the time-sampled animation. + + For further information, see \\ref Usd_Page_ValueClips + """ + customData = { + token apiSchemaType = "nonApplied" + dictionary schemaTokens = { + dictionary clips = { + string doc = """ + Dictionary that contains the definition of the clip sets on + this prim. See \\ref UsdClipsAPI::GetClips. + """ + } + + dictionary clipSets = { + string doc = """ + ListOp that may be used to affect how opinions from + clip sets are applied during value resolution. + See \\ref UsdClipsAPI::GetClipSets. + """ + } + } + } +) +{ +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "Imageable" ( + doc = """Base class for all prims that may require rendering or + visualization of some sort. The primary attributes of Imageable + are visibility and purpose, which each provide instructions for + what geometry should be included for processing by rendering and other + computations. + + \\deprecated Imageable also provides API for accessing primvars, which + has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now + be applied on non-Imageable prim types. This API is planned + to be removed, UsdGeomPrimvarsAPI should be used directly instead.""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) +} + +class "VisibilityAPI" ( + doc = ''' + UsdGeomVisibilityAPI introduces properties that can be used to author + visibility opinions. + + \\note + Currently, this schema only introduces the attributes that are used to + control purpose visibility. Later, this schema will define _all_ + visibility-related properties and UsdGeomImageable will no longer define + those properties. + + The purpose visibility attributes added by this schema, + _guideVisibility_, _proxyVisibility_, and _renderVisibility_ can each be + used to control visibility for geometry of the corresponding purpose + values, with the overall _visibility_ attribute acting as an + override. I.e., if _visibility_ evaluates to "invisible", purpose + visibility is invisible; otherwise, purpose visibility is determined by + the corresponding purpose visibility attribute. + + Note that the behavior of _guideVisibility_ is subtly different from the + _proxyVisibility_ and _renderVisibility_ attributes, in that "guide" + purpose visibility always evaluates to either "invisible" or "visible", + whereas the other attributes may yield computed values of "inherited" if + there is no authored opinion on the attribute or inherited from an + ancestor. This is motivated by the fact that, in Pixar"s user workflows, + we have never found a need to have all guides visible in a scene by + default, whereas we do find that flexibility useful for "proxy" and + "render" geometry. + + This schema can only be applied to UsdGeomImageable prims. The + UseGeomImageable schema provides API for computing the purpose visibility + values that result from the attributes introduced by this schema. + ''' +) +{ + uniform token guideVisibility = "invisible" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose "guide". + + Unlike overall _visibility_, _guideVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _guideVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _guideVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "guide" + is determined by the inherited values it receives for the _visibility_ + and _guideVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" and _guideVisibility_ evaluates to "visible", then the + prim is visible. __Otherwise, it is invisible.__ + ''' + ) + uniform token proxyVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose "proxy". + + Unlike overall _visibility_, _proxyVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _proxyVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _proxyVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "proxy" + is determined by the inherited values it receives for the _visibility_ + and _proxyVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _proxyVisibility_ evaluates to "visible", then + the prim is visible; if _proxyVisibility_ evaluates to "invisible", + then the prim is invisible; if _proxyVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + ''' + ) + uniform token renderVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = ''' + This attribute controls visibility for geometry with purpose + "render". + + Unlike overall _visibility_, _renderVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _renderVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _renderVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "render" + is determined by the inherited values it receives for the _visibility_ + and _renderVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _renderVisibility_ evaluates to "visible", then + the prim is visible; if _renderVisibility_ evaluates to "invisible", + then the prim is invisible; if _renderVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + ''' + ) +} + +class "PrimvarsAPI" ( + doc = """UsdGeomPrimvarsAPI encodes geometric \"primitive variables\", + as UsdGeomPrimvar, which interpolate across a primitive's topology, + can override shader inputs, and inherit down namespace. + + Which Method to Use to Retrieve Primvars + + While creating primvars is unambiguous (CreatePrimvar()), there are quite + a few methods available for retrieving primvars, making it potentially + confusing knowing which one to use. Here are some guidelines: + + - If you are populating a GUI with the primvars already available for + authoring values on a prim, use GetPrimvars(). + - If you want all of the \"useful\" (e.g. to a renderer) primvars + available at a prim, including those inherited from ancestor prims, use + FindPrimvarsWithInheritance(). Note that doing so individually for many + prims will be inefficient. + - To find a particular primvar defined directly on a prim, which may + or may not provide a value, use GetPrimvar(). + - To find a particular primvar defined on a prim or inherited from + ancestors, which may or may not provide a value, use + FindPrimvarWithInheritance(). + - To *efficiently* query for primvars using the overloads of + FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one + must first cache the results of FindIncrementallyInheritablePrimvars() for + each non-leaf prim on the stage. """ +) +{ +} + +class "Xformable" ( + doc = """Base class for all transformable prims, which allows arbitrary + sequences of component affine transformations to be encoded. + + \\note + You may find it useful to review while reading + this class description. + + Supported Component Transformation Operations + + UsdGeomXformable currently supports arbitrary sequences of the following + operations, each of which can be encoded in an attribute of the proper + shape in any supported precision: + - translate - 3D + - scale - 3D + - rotateX - 1D angle in degrees + - rotateY - 1D angle in degrees + - rotateZ - 1D angle in degrees + - rotateABC - 3D where ABC can be any combination of the six principle + Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See + \"note on rotation packing order\" + - orient - 4D (quaternion) + - transform - 4x4D + + Creating a Component Transformation + + To add components to a UsdGeomXformable prim, simply call AddXformOp() + with the desired op type, as enumerated in \\ref UsdGeomXformOp::Type, + and the desired precision, which is one of \\ref UsdGeomXformOp::Precision. + Optionally, you can also provide an \"op suffix\" for the operator that + disambiguates it from other components of the same type on the same prim. + Application-specific transform schemas can use the suffixes to fill a role + similar to that played by AbcGeom::XformOp's \"Hint\" enums for their own + round-tripping logic. + + We also provide specific \"Add\" API for each type, for clarity and + conciseness, e.g. AddTranslateOp(), AddRotateXYZOp() etc. + + AddXformOp() will return a UsdGeomXformOp object, which is a schema on a + newly created UsdAttribute that provides convenience API for authoring + and computing the component transformations. The UsdGeomXformOp can then + be used to author any number of timesamples and default for the op. + + Each successive call to AddXformOp() adds an operator that will be applied + \"more locally\" than the preceding operator, just as if we were pushing + transforms onto a transformation stack - which is precisely what should + happen when the operators are consumed by a reader. + + \\note + If you can, please try to use the UsdGeomXformCommonAPI, which wraps + the UsdGeomXformable with an interface in which Op creation is taken + care of for you, and there is a much higher chance that the data you + author will be importable without flattening into other DCC's, as it + conforms to a fixed set of Scale-Rotate-Translate Ops. + + \\sa \"Using the Authoring API\" + + Data Encoding and Op Ordering + + Because there is no \"fixed schema\" of operations, all of the attributes + that encode transform operations are dynamic, and are scoped in + the namespace \"xformOp\". The second component of an attribute's name provides + the type of operation, as listed above. An \"xformOp\" attribute can + have additional namespace components derived from the opSuffix argument + to the AddXformOp() suite of methods, which provides a preferred way of + naming the ops such that we can have multiple \"translate\" ops with unique + attribute names. For example, in the attribute named + \"xformOp:translate:maya:pivot\", \"translate\" is the type of operation and + \"maya:pivot\" is the suffix. + + The following ordered list of attribute declarations in usda + define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the + translation is double-precision, and the remainder of the ops are single, + in which we will: + +
    +
  1. Scale by 2.0 in each dimension +
  2. Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively +
  3. Translate by 100 units in the Y direction +
+ + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:scale\" ] + \\endcode + + The attributes appear in the dictionary order in which USD, by default, + sorts them. To ensure the ops are recovered and evaluated in the correct + order, the schema introduces the **xformOpOrder** attribute, which + contains the names of the op attributes, in the precise sequence in which + they should be pushed onto a transform stack. **Note** that the order is + opposite to what you might expect, given the matrix algebra described in + This also dictates order of op creation, + since each call to AddXformOp() adds a new op to the end of the + \\b xformOpOrder array, as a new \"most-local\" operation. See + \"Example 2 below\" for C++ code that could + have produced this USD. + + If it were important for the prim's rotations to be independently + overridable, we could equivalently (at some performance cost) encode + the transformation also like so: + \\code + float xformOp:rotateX = 30 + float xformOp:rotateY = 60 + float xformOp:rotateZ = 90 + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateZ\", \"xformOp:rotateY\", \"xformOp:rotateX\", \"xformOp:scale\" ] + \\endcode + + Again, note that although we are encoding an XYZ rotation, the three + rotations appear in the **xformOpOrder** in the opposite order, with Z, + followed, by Y, followed by X. + + Were we to add a Maya-style scalePivot to the above example, it might + look like the following: + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + double3 xformOp:translate:scalePivot + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:translate:scalePivot\", \"xformOp:scale\" ] + \\endcode + + Paired \"Inverted\" Ops + + We have been claiming that the ordered list of ops serves as a set + of instructions to a transform stack, but you may have noticed in the last + example that there is a missing operation - the pivot for the scale op + needs to be applied in its inverse-form as a final (most local) op! In the + AbcGeom::Xform schema, we would have encoded an actual \"final\" translation + op whose value was authored by the exporter as the negation of the pivot's + value. However, doing so would be brittle in USD, given that each op can + be independently overridden, and the constraint that one attribute must be + maintained as the negation of the other in order for successful + re-importation of the schema cannot be expressed in USD. + + Our solution leverages the **xformOpOrder** member of the schema, which, + in addition to ordering the ops, may also contain one of two special + tokens that address the paired op and \"stack resetting\" behavior. + + The \"paired op\" behavior is encoded as an \"!invert!\" prefix in + \\b xformOpOrder, as the result of an AddXformOp(isInverseOp=True) call. + The \\b xformOpOrder for the last example would look like: + \\code + uniform token[] xformOpOrder = [ \"xformOp:translate\", \"xformOp:rotateXYZ\", \"xformOp:translate:scalePivot\", \"xformOp:scale\", \"!invert!xformOp:translate:scalePivot\" ] + \\endcode + + When asked for its value via UsdGeomXformOp::GetOpTransform(), an + \"inverted\" Op (i.e. the \"inverted\" half of a set of paired Ops) will fetch + the value of its paired attribute and return its negation. This works for + all op types - an error will be issued if a \"transform\" type op is singular + and cannot be inverted. When getting the authored value of an inverted op + via UsdGeomXformOp::Get(), the raw, uninverted value of the associated + attribute is returned. + + For the sake of robustness, setting a value on an inverted op is disallowed. + Attempting to set a value on an inverted op will result in a coding error + and no value being set. + + Resetting the Transform Stack + + The other special op/token that can appear in xformOpOrder is + \"!resetXformStack!\", which, appearing as the first element of + xformOpOrder, indicates this prim should not inherit the transformation + of its namespace parent. See SetResetXformStack() + + Expected Behavior for \"Missing\" Ops + + If an importer expects Scale-Rotate-Translate operations, but a prim + has only translate and rotate ops authored, the importer should assume + an identity scale. This allows us to optimize the data a bit, if only + a few components of a very rich schema (like Maya's) are authored in the + app. + + \\anchor usdGeom_xformableExamples + Using the C++ API + + #1. Creating a simple transform matrix encoding + \\snippet examples_usdGeom.cpp CreateMatrixWithDefault + + #2. Creating the simple SRT from the example above + \\snippet examples_usdGeom.cpp CreateExampleSRT + + #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI + \\snippet examples_usdGeom.cpp CreateSRTWithDefaults + + #4. Creating a rotate-only pivot transform with animated + rotation and translation + \\snippet examples_usdGeom.cpp CreateAnimatedTransform + +""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Scope "Scope" ( + doc = """Scope is the simplest grouping primitive, and does not carry the + baggage of transformability. Note that transforms should inherit down + through a Scope successfully - it is just a guaranteed no-op from a + transformability perspective.""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) +} + +class Xform "Xform" ( + doc = "Concrete prim schema for a transform, which implements Xformable " +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Boundable" ( + doc = """Boundable introduces the ability for a prim to persistently + cache a rectilinear, local-space, extent. + + Why Extent and not Bounds ? + Boundable introduces the notion of \"extent\", which is a cached computation + of a prim's local-space 3D range for its resolved attributes at the + layer and time in which extent is authored. We have found that with + composed scene description, attempting to cache pre-computed bounds at + interior prims in a scene graph is very fragile, given the ease with which + one can author a single attribute in a stronger layer that can invalidate + many authored caches - or with which a re-published, referenced asset can + do the same. + + Therefore, we limit to precomputing (generally) leaf-prim extent, which + avoids the need to read in large point arrays to compute bounds, and + provides UsdGeomBBoxCache the means to efficiently compute and + (session-only) cache intermediate bounds. You are free to compute and + author intermediate bounds into your scenes, of course, which may work + well if you have sufficient locks on your pipeline to guarantee that once + authored, the geometry and transforms upon which they are based will + remain unchanged, or if accuracy of the bounds is not an ironclad + requisite. + + When intermediate bounds are authored on Boundable parents, the child prims + will be pruned from BBox computation; the authored extent is expected to + incorporate all child bounds.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Gprim" ( + doc = '''Base class for all geometric primitives. + + Gprim encodes basic graphical properties such as doubleSided and + orientation, and provides primvars for "display color" and "display + opacity" that travel with geometry to be used as shader overrides. ''' +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cube "Cube" ( + doc = """Defines a primitive rectilinear cube centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cube only to provide a fallback value. + \\sa UsdGeomGprim::GetExtentAttr().""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double size = 2 ( + doc = """Indicates the length of each edge of the cube. If you + author size you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Sphere "Sphere" ( + doc = """Defines a primitive sphere centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Sphere only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """Indicates the sphere's radius. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cylinder "Cylinder" ( + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cylinder is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The size of the cylinder's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """The radius of the cylinder. If you author radius + you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Capsule "Capsule" ( + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, centered at the origin, whose spine is along the specified + axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the capsule is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-0.5, -0.5, -1), (0.5, 0.5, 1)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 1 ( + doc = """The length of the capsule's spine along the specified + axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author height you must also author extent. + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 0.5 ( + doc = """The radius of the capsule. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cone "Cone" ( + doc = """Defines a primitive cone, centered at the origin, whose spine + is along the specified axis, with the apex of the cone pointing + in the direction of the positive axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cone is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cone only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The length of the cone's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radius = 1 ( + doc = """The radius of the cone. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Cylinder_1 "Cylinder_1" ( + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified axis, with a pair of radii + describing the size of the end points. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the cylinder is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-1, -1, -1), (1, 1, 1)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 2 ( + doc = """The length of the cylinder's spine along the specified + axis. If you author height you must also author extent. + + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radiusBottom = 1 ( + doc = """The radius of the bottom of the cylinder - i.e. the face + point located along the negative axis. If you author + radiusBottom you must also author extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 1 ( + doc = """The radius of the top of the cylinder - i.e. the face located + along the positive axis. If you author radiusTop you must also + author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Capsule_1 "Capsule_1" ( + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, with potentially different radii, centered at the origin, and whose + spine is along the specified axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = "The axis along which the spine of the capsule is aligned" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent = [(-0.5, -0.5, -1), (0.5, 0.5, 1)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double height = 1 ( + doc = """The length of the capsule's spine along the specified + axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author height you must also author extent. + \\sa GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double radiusBottom = 0.5 ( + doc = """The radius of the capping sphere at the bottom of the capsule - + i.e. the sphere located in the direction of the negative axis. If + you author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 0.5 ( + doc = """The radius of the capping sphere at the top of the capsule - + i.e. the sphere in the direction of the positive axis. If you + author radius you must also author extent. + + \\sa GetExtentAttr()""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Plane "Plane" ( + doc = """Defines a primitive plane, centered at the origin, and is defined by + a cardinal axis, width, and length. The plane is double-sided by default. + + The axis of width and length are perpendicular to the plane's axis: + + axis | width | length + ----- | ------ | ------- + X | z-axis | y-axis + Y | x-axis | z-axis + Z | x-axis | y-axis + + """ +) +{ + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the surface of the plane is aligned. When set + to 'Z' the plane is in the xy-plane; when axis is 'X' the plane is in + the yz-plane, and when axis is 'Y' the plane is in the xz-plane. + + \\sa UsdGeomGprim::GetAxisAttr().""" + ) + uniform bool doubleSided = 1 ( + doc = """Planes are double-sided by default. Clients may also support + single-sided planes. + + \\sa UsdGeomGprim::GetDoubleSidedAttr()""" + ) + float3[] extent = [(-1, -1, 0), (1, 1, 0)] ( + doc = """Extent is re-defined on Plane only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) + double length = 2 ( + doc = """The length of the plane, which aligns to the y-axis when axis is + 'Z' or 'X', or to the z-axis when axis is 'Y'. If you author length + you must also author extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + double width = 2 ( + doc = """The width of the plane, which aligns to the x-axis when axis is + 'Z' or 'Y', or to the z-axis when axis is 'X'. If you author width + you must also author extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "PointBased" ( + doc = """Base class for all UsdGeomGprims that possess points, + providing common attributes such as normals and velocities.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Mesh "Mesh" ( + doc = """Encodes a mesh with optional subdivision properties and features. + + As a point-based primitive, meshes are defined in terms of points that + are connected into edges and faces. Many references to meshes use the + term 'vertex' in place of or interchangeably with 'points', while some + use 'vertex' to refer to the 'face-vertices' that define a face. To + avoid confusion, the term 'vertex' is intentionally avoided in favor of + 'points' or 'face-vertices'. + + The connectivity between points, edges and faces is encoded using a + common minimal topological description of the faces of the mesh. Each + face is defined by a set of face-vertices using indices into the Mesh's + _points_ array (inherited from UsdGeomPointBased) and laid out in a + single linear _faceVertexIndices_ array for efficiency. A companion + _faceVertexCounts_ array provides, for each face, the number of + consecutive face-vertices in _faceVertexIndices_ that define the face. + No additional connectivity information is required or constructed, so + no adjacency or neighborhood queries are available. + + A key property of this mesh schema is that it encodes both subdivision + surfaces and simpler polygonal meshes. This is achieved by varying the + _subdivisionScheme_ attribute, which is set to specify Catmull-Clark + subdivision by default, so polygonal meshes must always be explicitly + declared. The available subdivision schemes and additional subdivision + features encoded in optional attributes conform to the feature set of + OpenSubdiv + (https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html). + + \\anchor UsdGeom_Mesh_Primvars + __A Note About Primvars__ + + The following list clarifies the number of elements for and the + interpolation behavior of the different primvar interpolation types + for meshes: + + - __constant__: One element for the entire mesh; no interpolation. + - __uniform__: One element for each face of the mesh; elements are + typically not interpolated but are inherited by other faces derived + from a given face (via subdivision, tessellation, etc.). + - __varying__: One element for each point of the mesh; + interpolation of point data is always linear. + - __vertex__: One element for each point of the mesh; + interpolation of point data is applied according to the + _subdivisionScheme_ attribute. + - __faceVarying__: One element for each of the face-vertices that + define the mesh topology; interpolation of face-vertex data may + be smooth or linear, according to the _subdivisionScheme_ and + _faceVaryingLinearInterpolation_ attributes. + + Primvar interpolation types and related utilities are described more + generally in \\ref Usd_InterpolationVals. + + \\anchor UsdGeom_Mesh_Normals + __A Note About Normals__ + + Normals should not be authored on a subdivision mesh, since subdivision + algorithms define their own normals. They should only be authored for + polygonal meshes (_subdivisionScheme_ = \"none\"). + + The _normals_ attribute inherited from UsdGeomPointBased is not a generic + primvar, but the number of elements in this attribute will be determined by + its _interpolation_. See . + If _normals_ and _primvars:normals_ are both specified, the latter has + precedence. If a polygonal mesh specifies __neither__ _normals_ nor + _primvars:normals_, then it should be treated and rendered as faceted, + with no attempt to compute smooth normals. + + The normals generated for smooth subdivision schemes, e.g. Catmull-Clark + and Loop, will likewise be smooth, but others, e.g. Bilinear, may be + discontinuous between faces and/or within non-planar irregular faces.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] cornerIndices = [] ( + doc = """The indices of points for which a corresponding sharpness + value is specified in _cornerSharpnesses_ (so the size of this array + must match that of _cornerSharpnesses_).""" + ) + float[] cornerSharpnesses = [] ( + doc = """The sharpness values associated with a corresponding set of + points specified in _cornerIndices_ (so the size of this array must + match that of _cornerIndices_). Use the constant `SHARPNESS_INFINITE` + for a perfectly sharp corner.""" + ) + int[] creaseIndices = [] ( + doc = """The indices of points grouped into sets of successive pairs + that identify edges to be creased. The size of this array must be + equal to the sum of all elements of the _creaseLengths_ attribute.""" + ) + int[] creaseLengths = [] ( + doc = """The length of this array specifies the number of creases + (sets of adjacent sharpened edges) on the mesh. Each element gives + the number of points of each crease, whose indices are successively + laid out in the _creaseIndices_ attribute. Since each crease must + be at least one edge long, each element of this array must be at + least two.""" + ) + float[] creaseSharpnesses = [] ( + doc = """The per-crease or per-edge sharpness values for all creases. + Since _creaseLengths_ encodes the number of points in each crease, + the number of elements in this array will be either len(creaseLengths) + or the sum over all X of (creaseLengths[X] - 1). Note that while + the RI spec allows each crease to have either a single sharpness + or a value per-edge, USD will encode either a single sharpness + per crease on a mesh, or sharpnesses for all edges making up + the creases on a mesh. Use the constant `SHARPNESS_INFINITE` for a + perfectly sharp crease.""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + token faceVaryingLinearInterpolation = "cornersPlus1" ( + allowedTokens = ["none", "cornersOnly", "cornersPlus1", "cornersPlus2", "boundaries", "all"] + doc = '''Specifies how elements of a primvar of interpolation type + "faceVarying" are interpolated for subdivision surfaces. Interpolation + can be as smooth as a "vertex" primvar or constrained to be linear at + features specified by several options. Valid values correspond to + choices available in OpenSubdiv: + + - __none__: No linear constraints or sharpening, smooth everywhere + - __cornersOnly__: Sharpen corners of discontinuous boundaries only, + smooth everywhere else + - __cornersPlus1__: The default, same as "cornersOnly" plus additional + sharpening at points where three or more distinct face-varying + values occur + - __cornersPlus2__: Same as "cornersPlus1" plus additional sharpening + at points with at least one discontinuous boundary corner or + only one discontinuous boundary edge (a dart) + - __boundaries__: Piecewise linear along discontinuous boundaries, + smooth interior + - __all__: Piecewise linear everywhere + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules''' + ) + int[] faceVertexCounts ( + doc = """Provides the number of vertices in each face of the mesh, + which is also the number of consecutive indices in _faceVertexIndices_ + that define the face. The length of this attribute is the number of + faces in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + int[] faceVertexIndices ( + doc = """Flat list of the index (into the _points_ attribute) of each + vertex of each face in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + int[] holeIndices = [] ( + doc = """The indices of all faces that should be treated as holes, + i.e. made invisible. This is traditionally a feature of subdivision + surfaces and not generally applied to polygonal meshes.""" + ) + token interpolateBoundary = "edgeAndCorner" ( + allowedTokens = ["none", "edgeOnly", "edgeAndCorner"] + doc = '''Specifies how subdivision is applied for faces adjacent to + boundary edges and boundary points. Valid values correspond to choices + available in OpenSubdiv: + + - __none__: No boundary interpolation is applied and boundary faces are + effectively treated as holes + - __edgeOnly__: A sequence of boundary edges defines a smooth curve to + which the edges of subdivided boundary faces converge + - __edgeAndCorner__: The default, similar to "edgeOnly" but the smooth + boundary curve is made sharp at corner points + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#boundary-interpolation-rules''' + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform token subdivisionScheme = "catmullClark" ( + allowedTokens = ["catmullClark", "loop", "bilinear", "none"] + doc = '''The subdivision scheme to be applied to the surface. + Valid values are: + + - __catmullClark__: The default, Catmull-Clark subdivision; preferred + for quad-dominant meshes (generalizes B-splines); interpolation + of point data is smooth (non-linear) + - __loop__: Loop subdivision; preferred for purely triangular meshes; + interpolation of point data is smooth (non-linear) + - __bilinear__: Subdivision reduces all faces to quads (topologically + similar to "catmullClark"); interpolation of point data is bilinear + - __none__: No subdivision, i.e. a simple polygonal mesh; interpolation + of point data is linear + + Polygonal meshes are typically lighter weight and faster to render, + depending on renderer and render mode. Use of "bilinear" will produce + a similar shape to a polygonal mesh and may offer additional guarantees + of watertightness and additional subdivision features (e.g. holes) but + may also not respect authored normals.''' + ) + token triangleSubdivisionRule = "catmullClark" ( + allowedTokens = ["catmullClark", "smooth"] + doc = '''Specifies an option to the subdivision rules for the + Catmull-Clark scheme to try and improve undesirable artifacts when + subdividing triangles. Valid values are "catmullClark" for the + standard rules (the default) and "smooth" for the improvement. + + See https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle-subdivision-rule''' + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class TetMesh "TetMesh" ( + doc = """Encodes a tetrahedral mesh. A tetrahedral mesh is defined as a set of + tetrahedra. Each tetrahedron is defined by a set of 4 points, with the + triangles of the tetrahedron determined from these 4 points as described in + the tetVertexIndices attribute description. The mesh surface faces + are encoded as triangles. Surface faces must be provided for consumers + that need to do surface calculations, such as renderers or consumers using + physics attachments. Both tetrahedra and surface face definitions use + indices into the TetMesh's points attribute, inherited from + UsdGeomPointBased.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + int3[] surfaceFaceVertexIndices ( + doc = """surfaceFaceVertexIndices defines the triangle + surface faces indices wrt. points of the tetmesh surface. Again + the orientation attribute inherited from UsdGeomPrim should be + set accordingly. The orientation for faces of tetrahedra and + surface faces must match.""" + ) + int4[] tetVertexIndices ( + doc = '''Flat list of the index (into the points attribute) of + each vertex of each tetrahedron in the mesh. Each int4 corresponds to the + indices of a single tetrahedron. Users should set the orientation + attribute of UsdGeomPrim accordingly. That is if the orientation + is "rightHanded", the CCW face ordering of a tetrahedron is + [123],[032],[013],[021] with respect to the int4. This results in the + normals facing outward from the center of the tetrahedron. The following + diagram shows the face ordering of an unwrapped tetrahedron with + "rightHanded" orientation. + + \\image html USDTetMeshRightHanded.svg + + If the orientation attribute is set to "leftHanded" the face + ordering of the tetrahedron is [321],[230],[310],[120] and the + leftHanded CW face normals point outward from the center of the + tetrahedron. The following diagram shows the face ordering of an + unwrapped tetrahedron with "leftHanded" orientation. + + \\image html USDTetMeshLeftHanded.svg + + Setting the orientation attribute to align with the + ordering of the int4 for the tetrahedrons is the responsibility of the + user.''' + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class GeomSubset "GeomSubset" ( + doc = """Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) + as a set of indices. Currently supports encoding subsets of faces, + points, edges, and tetrahedrons. + + To apply to a geometric prim, a GeomSubset prim must be the prim's direct + child in namespace, and possess a concrete defining specifier (i.e. def). + This restriction makes it easy and efficient to discover subsets of a prim. + We might want to relax this restriction if it's common to have multiple + families of subsets on a gprim and if it's useful to be able to + organize subsets belonging to a family under a common scope. See + 'familyName' attribute for more info on defining a family of subsets. + + Note that a GeomSubset isn't an imageable (i.e. doesn't derive from + UsdGeomImageable). So, you can't author visibility for it or + override its purpose. + + Materials are bound to GeomSubsets just as they are for regular + geometry using API available in UsdShade (UsdShadeMaterial::Bind). +""" +) +{ + uniform token elementType = "face" ( + allowedTokens = ["face", "point", "edge", "tetrahedron"] + doc = """The type of element that the indices target. \"elementType\" can + have one of the following values: +
  • face: Identifies faces on a Gprim's surface. For a + UsdGeomMesh, each element of the _indices_ attribute would refer to + an element of the Mesh's _faceCounts_ attribute. For a UsdGeomTetMesh, + each element of the _indices_ attribute would refer to an element of + the Mesh's _surfaceFaceVertexIndices_ attribute.
  • +
  • point: for any UsdGeomPointBased, each + element of the _indices_ attribute would refer to an element of the + Mesh's _points_ attribute
  • +
  • edge: for any UsdGeomMesh, each pair of elements + in the _indices_ attribute would refer to a pair of points of the + Mesh's _points_ attribute that are connected as an implicit edge on the + Mesh. These edges are derived from the Mesh's _faceVertexIndices_ + attribute. Edges are not currently defined for a UsdGeomTetMesh, but + could be derived from all tetrahedron edges or surface face edges only + if a specific use-case arises.
  • +
  • tetrahedron: for any UsdGeomTetMesh, each element of the + _indices_ attribute would refer to an element of the TetMesh's + _tetVertexIndices_ attribute. +
""" + ) + uniform token familyName = "" ( + doc = '''The name of the family of subsets that this subset belongs to. + This is optional and is primarily useful when there are multiple + families of subsets under a geometric prim. In some cases, this could + also be used for achieving proper roundtripping of subset data between + DCC apps. + When multiple subsets belonging to a prim have the same familyName, they + are said to belong to the family. A familyType value can be + encoded on the owner of a family of subsets as a token using the static + method UsdGeomSubset::SetFamilyType(). "familyType" can have one of the + following values: +
  • UsdGeomTokens->partition: implies that every element of + the whole geometry appears exactly once in only one of the subsets + belonging to the family.
  • +
  • UsdGeomTokens->nonOverlapping: an element that appears in one + subset may not appear in any other subset belonging to the family, and + appears only once in the subset in which it appears.
  • +
  • UsdGeomTokens->unrestricted: implies that there are no + restrictions w.r.t. the membership of elements in the subsets. They + could be overlapping and the union of all subsets in the family may + not represent the whole.
  • +
+ \\note The validity of subset data is not enforced by the authoring + APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). + ''' + ) + int[] indices = [] ( + doc = """The set of indices included in this subset. The indices need not + be sorted, but the same index should not appear more than once. Indices + are invalid if outside the range [0, elementCount) for the given time on + the parent geometric prim.""" + ) +} + +class NurbsPatch "NurbsPatch" ( + doc = """Encodes a rational or polynomial non-uniform B-spline + surface, with optional trim curves. + + The encoding mostly follows that of RiNuPatch and RiTrimCurve: + https://renderman.pixar.com/resources/RenderMan_20/geometricPrimitives.html#rinupatch , with some minor renaming and coalescing for clarity. + + The layout of control vertices in the points attribute inherited + from UsdGeomPointBased is row-major with U considered rows, and V columns. + + \\anchor UsdGeom_NurbsPatch_Form + NurbsPatch Form + + The authored points, orders, knots, weights, and ranges are all that is + required to render the nurbs patch. However, the only way to model closed + surfaces with nurbs is to ensure that the first and last control points + along the given axis are coincident. Similarly, to ensure the surface is + not only closed but also C2 continuous, the last order - 1 control + points must be (correspondingly) coincident with the first order - 1 + control points, and also the spacing of the last corresponding knots + must be the same as the first corresponding knots. + + Form is provided as an aid to interchange between modeling and + animation applications so that they can robustly identify the intent with + which the surface was modelled, and take measures (if they are able) to + preserve the continuity/concidence constraints as the surface may be rigged + or deformed. + - An open-form NurbsPatch has no continuity constraints. + - A closed-form NurbsPatch expects the first and last control points + to overlap + - A periodic-form NurbsPatch expects the first and last + order - 1 control points to overlap. + + Nurbs vs Subdivision Surfaces + + Nurbs are an important modeling primitive in CAD/CAM tools and early + computer graphics DCC's. Because they have a natural UV parameterization + they easily support \"trim curves\", which allow smooth shapes to be + carved out of the surface. + + However, the topology of the patch is always rectangular, and joining two + nurbs patches together (especially when they have differing numbers of + spans) is difficult to do smoothly. Also, nurbs are not supported by + the Ptex texturing technology (http://ptex.us). + + Neither of these limitations are shared by subdivision surfaces; therefore, + although they do not subscribe to trim-curve-based shaping, subdivs are + often considered a more flexible modeling primitive. + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + double[] pointWeights ( + doc = """Optionally provides \"w\" components for each control point, + thus must be the same length as the points attribute. If authored, + the patch will be rational. If unauthored, the patch will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the points, but in this schema, + points are not pre-weighted.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + int[] trimCurve:counts ( + doc = '''Each element specifies how many curves are present in each + "loop" of the trimCurve, and the length of the array determines how + many loops the trimCurve contains. The sum of all elements is the + total nuber of curves in the trim, to which we will refer as + nCurves in describing the other trim attributes.''' + ) + double[] trimCurve:knots ( + doc = """Flat list of parametric values for each of the + nCurves curves. There will be as many knots as the sum over + all elements of vertexCounts plus the sum over all elements of + orders.""" + ) + int[] trimCurve:orders ( + doc = "Flat list of orders for each of the nCurves curves." + ) + double3[] trimCurve:points ( + doc = """Flat list of homogeneous 2D points (u, v, w) that comprise + the nCurves curves. The number of points should be equal to the + um over all elements of vertexCounts.""" + ) + double2[] trimCurve:ranges ( + doc = """Flat list of minimum and maximum parametric values + (as defined by knots) for each of the nCurves curves.""" + ) + int[] trimCurve:vertexCounts ( + doc = """Flat list of number of vertices for each of the + nCurves curves.""" + ) + uniform token uForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = '''Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the U dimension. + \\sa "NurbsPatch Form" ''' + ) + double[] uKnots ( + doc = """Knot vector for U direction providing U parameterization. + The length of this array must be ( uVertexCount + uOrder ), and its + entries must take on monotonically increasing values.""" + ) + int uOrder ( + doc = """Order in the U direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + double2 uRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by uKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of uKnots[uOrder-1]. The maxium must be less than or equal + to the last element's value in uKnots.""" + ) + int uVertexCount ( + doc = """Number of vertices in the U direction. Should be at least as + large as uOrder.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + uniform token vForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = '''Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the V dimension. + \\sa "NurbsPatch Form" ''' + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + double[] vKnots ( + doc = """Knot vector for V direction providing U parameterization. + The length of this array must be ( vVertexCount + vOrder ), and its + entries must take on monotonically increasing values.""" + ) + int vOrder ( + doc = """Order in the V direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + double2 vRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by vKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of vKnots[vOrder-1]. The maxium must be less than or equal + to the last element's value in vKnots.""" + ) + int vVertexCount ( + doc = """Number of vertices in the V direction. Should be at least as + large as vOrder.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "Curves" ( + doc = """Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and + UsdGeomHermiteCurves. The BasisCurves schema is designed to be + analagous to offline renderers' notion of batched curves (such as + the classical RIB definition via Basis and Curves statements), + while the NurbsCurve schema is designed to be analgous to the + NURBS curves found in packages like Maya and Houdini while + retaining their consistency with the RenderMan specification for + NURBS Patches. HermiteCurves are useful for the + interchange of animation guides and paths. + + It is safe to use the length of the curve vertex count to derive + the number of curves and the number and layout of curve vertices, + but this schema should NOT be used to derive the number of curve + points. While vertex indices are implicit in all shipped + descendent types of this schema, one should not assume that all + internal or future shipped schemas will follow this pattern. Be + sure to key any indexing behavior off the concrete type, not this + abstract type. + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class BasisCurves "BasisCurves" ( + doc = """BasisCurves are a batched curve representation analogous to the + classic RIB definition via Basis and Curves statements. BasisCurves are + often used to render dense aggregate geometry like hair or grass. + + A 'matrix' and 'vstep' associated with the basis are used to + interpolate the vertices of a cubic BasisCurves. (The basis attribute + is unused for linear BasisCurves.) + + A single prim may have many curves whose count is determined implicitly by + the length of the curveVertexCounts vector. Each individual curve is + composed of one or more segments. Each segment is defined by four vertices + for cubic curves and two vertices for linear curves. See the next section + for more information on how to map curve vertex counts to segment counts. + + Segment Indexing + Interpolating a curve requires knowing how to decompose it into its + individual segments. + + The segments of a cubic curve are determined by the vertex count, + the wrap (periodicity), and the vstep of the basis. For linear + curves, the basis token is ignored and only the vertex count and + wrap are needed. + + cubic basis | vstep + ------------- | ------ + bezier | 3 + catmullRom | 1 + bspline | 1 + + The first segment of a cubic (nonperiodic) curve is always defined by its + first four points. The vstep is the increment used to determine what + vertex indices define the next segment. For a two segment (nonperiodic) + bspline basis curve (vstep = 1), the first segment will be defined by + interpolating vertices [0, 1, 2, 3] and the second segment will be defined + by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the + first segment will be defined by interpolating vertices [0, 1, 2, 3] and + the second segment will be defined by [3, 4, 5, 6]. If the vstep is not + one, then you must take special care to make sure that the number of cvs + properly divides by your vstep. (The indices described are relative to + the initial vertex index for a batched curve.) + + For periodic curves, at least one of the curve's initial vertices are + repeated to close the curve. For cubic curves, the number of vertices + repeated is '4 - vstep'. For linear curves, only one vertex is repeated + to close the loop. + + Pinned curves are a special case of nonperiodic curves that only affects + the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render + pinned curves, a client must effectively add 'phantom points' at the + beginning and end of every curve in a batch. These phantom points + are injected to ensure that the interpolated curve begins at P[0] and + ends at P[n-1]. + + For a curve with initial point P[0] and last point P[n-1], the phantom + points are defined as. + P[-1] = 2 * P[0] - P[1] + P[n] = 2 * P[n-1] - P[n-2] + + Pinned cubic curves will (usually) have to be unpacked into the standard + nonperiodic representation before rendering. This unpacking can add some + additional overhead. However, using pinned curves reduces the amount of + data recorded in a scene and (more importantly) better records the + authors' intent for interchange. + + \\note The additional phantom points mean that the minimum curve vertex + count for cubic bspline and catmullRom curves is 2. + + Linear curve segments are defined by two vertices. + A two segment linear curve's first segment would be defined by + interpolating vertices [0, 1]. The second segment would be defined by + vertices [1, 2]. (Again, for a batched curve, indices are relative to + the initial vertex index.) + + When validating curve topology, each renderable entry in the + curveVertexCounts vector must pass this check. + + type | wrap | validitity + ------- | --------------------------- | ---------------- + linear | nonperiodic | curveVertexCounts[i] > 2 + linear | periodic | curveVertexCounts[i] > 3 + cubic | nonperiodic | (curveVertexCounts[i] - 4) % vstep == 0 + cubic | periodic | (curveVertexCounts[i]) % vstep == 0 + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) >= 0 + + Cubic Vertex Interpolation + + \\image html USDCurveBasisMatrix.png width=750 + + Linear Vertex Interpolation + + Linear interpolation is always used on curves of type linear. + 't' with domain [0, 1], the curve is defined by the equation + P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes + the end point. + + Primvar Interpolation + + For cubic curves, primvar data can be either interpolated cubically between + vertices or linearly across segments. The corresponding token + for cubic interpolation is 'vertex' and for linear interpolation is + 'varying'. Per vertex data should be the same size as the number + of vertices in your curve. Segment varying data is dependent on the + wrap (periodicity) and number of segments in your curve. For linear curves, + varying and vertex data would be interpolated the same way. By convention + varying is the preferred interpolation because of the association of + varying with linear interpolation. + + \\image html USDCurvePrimvars.png + + To convert an entry in the curveVertexCounts vector into a segment count + for an individual curve, apply these rules. Sum up all the results in + order to compute how many total segments all curves have. + + The following tables describe the expected segment count for the 'i'th + curve in a curve batch as well as the entire batch. Python syntax + like '[:]' (to describe all members of an array) and 'len(...)' + (to describe the length of an array) are used. + + type | wrap | curve segment count | batch segment count + ------- | --------------------------- | -------------------------------------- | -------------------------- + linear | nonperiodic | curveVertexCounts[i] - 1 | sum(curveVertexCounts[:]) - len(curveVertexCounts) + linear | periodic | curveVertexCounts[i] | sum(curveVertexCounts[:]) + cubic | nonperiodic | (curveVertexCounts[i] - 4) / vstep + 1 | sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) + cubic | periodic | curveVertexCounts[i] / vstep | sum(curveVertexCounts[:]) / vstep + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) + 1 | sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) + + The following table descrives the expected size of varying + (linearly interpolated) data, derived from the segment counts computed + above. + + wrap | curve varying count | batch varying count + ------------------- | ---------------------------- | ------------------------------------------------ + nonperiodic/pinned | segmentCounts[i] + 1 | sum(segmentCounts[:]) + len(curveVertexCounts) + periodic | segmentCounts[i] | sum(segmentCounts[:]) + + Both curve types additionally define 'constant' interpolation for the + entire prim and 'uniform' interpolation as per curve data. + + + \\note Take care when providing support for linearly interpolated data for + cubic curves. Its shape doesn't provide a one to one mapping with either + the number of curves (like 'uniform') or the number of vertices (like + 'vertex') and so it is often overlooked. This is the only primitive in + UsdGeom (as of this writing) where this is true. For meshes, while they + use different interpolation methods, 'varying' and 'vertex' are both + specified per point. It's common to assume that curves follow a similar + pattern and build in structures and language for per primitive, per + element, and per point data only to come upon these arrays that don't + quite fit into either of those categories. It is + also common to conflate 'varying' with being per segment data and use the + segmentCount rules table instead of its neighboring varying data table + rules. We suspect that this is because for the common case of + nonperiodic cubic curves, both the provided segment count and varying data + size formula end with '+ 1'. While debugging, users may look at the double + '+ 1' as a mistake and try to remove it. We take this time to enumerate + these issues because we've fallen into them before and hope that we save + others time in their own implementations. + + As an example of deriving per curve segment and varying primvar data counts from + the wrap, type, basis, and curveVertexCount, the following table is provided. + + wrap | type | basis | curveVertexCount | curveSegmentCount | varyingDataCount + ------------- | ------- | ------- | ----------------- | ------------------ | ------------------------- + nonperiodic | linear | N/A | [2 3 2 5] | [1 2 1 4] | [2 3 2 5] + nonperiodic | cubic | bezier | [4 7 10 4 7] | [1 2 3 1 2] | [2 3 4 2 3] + nonperiodic | cubic | bspline | [5 4 6 7] | [2 1 3 4] | [3 2 4 5] + periodic | cubic | bezier | [6 9 6] | [2 3 2] | [2 3 2] + periodic | linear | N/A | [3 7] | [3 7] | [3 7] + + Tubes and Ribbons + + The strictest definition of a curve as an infinitely thin wire is not + particularly useful for describing production scenes. The additional + widths and normals attributes can be used to describe cylindrical + tubes and or flat oriented ribbons. + + Curves with only widths defined are imaged as tubes with radius + 'width / 2'. Curves with both widths and normals are imaged as ribbons + oriented in the direction of the interpolated normal vectors. + + While not technically UsdGeomPrimvars, widths and normals + also have interpolation metadata. It's common for authored widths to have + constant, varying, or vertex interpolation + (see UsdGeomCurves::GetWidthsInterpolation()). It's common for + authored normals to have varying interpolation + (see UsdGeomPointBased::GetNormalsInterpolation()). + + \\image html USDCurveHydra.png + + The file used to generate these curves can be found in + extras/usd/examples/usdGeomExamples/basisCurves.usda. It's provided + as a reference on how to properly image both tubes and ribbons. The first + row of curves are linear; the second are cubic bezier. (We aim in future + releases of HdSt to fix the discontinuity seen with broken tangents to + better match offline renderers like RenderMan.) The yellow and violet + cubic curves represent cubic vertex width interpolation for which there is + no equivalent for linear curves. + + \\note How did this prim type get its name? This prim is a portmanteau of + two different statements in the original RenderMan specification: + 'Basis' and 'Curves'. +""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform token basis = "bezier" ( + allowedTokens = ["bezier", "bspline", "catmullRom"] + doc = """The basis specifies the vstep and matrix used for cubic + interpolation. \\note The 'hermite' and 'power' tokens have been + removed. We've provided UsdGeomHermiteCurves + as an alternative for the 'hermite' basis.""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform token type = "cubic" ( + allowedTokens = ["linear", "cubic"] + doc = """Linear curves interpolate linearly between two vertices. + Cubic curves use a basis matrix with four vertices to interpolate a segment.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token wrap = "nonperiodic" ( + allowedTokens = ["nonperiodic", "periodic", "pinned"] + doc = """If wrap is set to periodic, the curve when rendered will + repeat the initial vertices (dependent on the vstep) to close the + curve. If wrap is set to 'pinned', phantom points may be created + to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. + """ + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class NurbsCurves "NurbsCurves" ( + doc = """This schema is analagous to NURBS Curves in packages like Maya + and Houdini, often used for interchange of rigging and modeling curves. + Unlike Maya, this curve spec supports batching of multiple curves into a + single prim, widths, and normals in the schema. Additionally, we require + 'numSegments + 2 * degree + 1' knots (2 more than maya does). This is to + be more consistent with RenderMan's NURBS patch specification. + + To express a periodic curve: + - knot[0] = knot[1] - (knots[-2] - knots[-3]; + - knot[-1] = knot[-2] + (knot[2] - knots[1]); + + To express a nonperiodic curve: + - knot[0] = knot[1]; + - knot[-1] = knot[-2]; + + In spite of these slight differences in the spec, curves generated in Maya + should be preserved when roundtripping. + + order and range, when representing a batched NurbsCurve should be + authored one value per curve. knots should be the concatentation of + all batched curves.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + double[] knots ( + doc = """Knot vector providing curve parameterization. + The length of the slice of the array for the ith curve + must be ( curveVertexCount[i] + order[i] ), and its + entries must take on monotonically increasing values.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + int[] order = [] ( + doc = """Order of the curve. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1. + Its value for the 'i'th curve must be less than or equal to + curveVertexCount[i]""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + double[] pointWeights ( + doc = """Optionally provides \"w\" components for each control point, + thus must be the same length as the points attribute. If authored, + the curve will be rational. If unauthored, the curve will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the points, but in this schema, + points are not pre-weighted.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double2[] ranges ( + doc = """Provides the minimum and maximum parametric values (as defined + by knots) over which the curve is actually defined. The minimum must + be less than the maximum, and greater than or equal to the value of the + knots['i'th curve slice][order[i]-1]. The maxium must be less + than or equal to the last element's value in knots['i'th curve slice]. +\tRange maps to (vmin, vmax) in the RenderMan spec.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Points "Points" ( + doc = """Points are analogous to the RiPoints spec. + + Points can be an efficient means of storing and rendering particle + effects comprised of thousands or millions of small particles. Points + generally receive a single shading sample each, which should take + normals into account, if present. + + While not technically UsdGeomPrimvars, the widths and normals also + have interpolation metadata. It's common for authored widths and normals + to have constant or varying interpolation.""" +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the points array, specifying (at each timesample if + point identities are changing) the id of each point. The + type is signed intentionally, so that clients can encode some + binary state on Id'd points without adding a separate + primvar.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Widths are defined as the diameter of the points, in + object space. 'widths' is not a generic Primvar, but + the number of elements in this attribute will be determined by + its 'interpolation'. See . If + 'widths' and 'primvars:widths' are both specified, the latter + has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PointInstancer "PointInstancer" ( + doc = """Encodes vectorized instancing of multiple, potentially + animated, prototypes (object/instance masters), which can be arbitrary + prims/subtrees on a UsdStage. + + PointInstancer is a \"multi instancer\", as it allows multiple prototypes + to be scattered among its \"points\". We use a UsdRelationship + prototypes to identify and order all of the possible prototypes, by + targeting the root prim of each prototype. The ordering imparted by + relationships associates a zero-based integer with each prototype, and + it is these integers we use to identify the prototype of each instance, + compactly, and allowing prototypes to be swapped out without needing to + reauthor all of the per-instance data. + + The PointInstancer schema is designed to scale to billions of instances, + which motivates the choice to split the per-instance transformation into + position, (quaternion) orientation, and scales, rather than a + 4x4 matrix per-instance. In addition to requiring fewer bytes even if + all elements are authored (32 bytes vs 64 for a single-precision 4x4 + matrix), we can also be selective about which attributes need to animate + over time, for substantial data reduction in many cases. + + Note that PointInstancer is not a Gprim, since it is not a graphical + primitive by any stretch of the imagination. It is, however, + Boundable, since we will sometimes want to treat the entire PointInstancer + similarly to a procedural, from the perspective of inclusion or framing. + + Varying Instance Identity over Time + + PointInstancers originating from simulations often have the characteristic + that points/instances are \"born\", move around for some time period, and then + die (or leave the area of interest). In such cases, billions of instances + may be birthed over time, while at any specific time, only a much + smaller number are actually alive. To encode this situation efficiently, + the simulator may re-use indices in the instance arrays, when a particle + dies, its index will be taken over by a new particle that may be birthed in + a much different location. This presents challenges both for + identity-tracking, and for motion-blur. + + We facilitate identity tracking by providing an optional, animatable + ids attribute, that specifies the 64 bit integer ID of the particle + at each index, at each point in time. If the simulator keeps monotonically + increasing a particle-count each time a new particle is birthed, it will + serve perfectly as particle ids. + + We facilitate motion blur for varying-topology particle streams by + optionally allowing per-instance velocities and angularVelocities + to be authored. If instance transforms are requested at a time between + samples and either of the velocity attributes is authored, then we will + not attempt to interpolate samples of positions or orientations. + If not authored, and the bracketing samples have the same length, then we + will interpolate. + + Computing an Instance Transform + + Each instance's transformation is a combination of the SRT affine transform + described by its scale, orientation, and position, applied after + (i.e. less locally than) the local to parent transformation computed at + the root of the prototype it is instancing. + + If your processing of prototype geometry naturally takes into account the + transform of the prototype root, then this term can be omitted from the + computation of each instance transform, and this can be controlled when + computing instance transformation matrices using the + UsdGeomPointInstancer::PrototypeXformInclusion enumeration. + + To understand the computation of the instance transform, in order to put + an instance of a PointInstancer into the space of the PointInstancer's + parent prim we do the following: + + 1. Apply (most locally) the authored local to parent transformation for + prototypes[protoIndices[i]] + 2. If *scales* is authored, next apply the scaling matrix from *scales[i]* + 3. If *orientations* is authored: **if *angularVelocities* is authored**, + first multiply *orientations[i]* by the unit quaternion derived by scaling + *angularVelocities[i]* by the \"time differential\" + from the left-bracketing timeSample for *orientation* to the requested + evaluation time *t*, storing the result in *R*, **else** assign *R* + directly from *orientations[i]*. Apply the rotation matrix derived + from *R*. + 4. Apply the translation derived from *positions[i]*. If *velocities* is + authored, apply the translation deriving from *velocities[i]* scaled by + the time differential from the left-bracketing timeSample for *positions* + to the requested evaluation time *t*. + 5. Least locally, apply the transformation authored on the PointInstancer + prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the + PointInstancer to put the instance directly into world space) + + If neither *velocities* nor *angularVelocities* are authored, we fallback to + standard position and orientation computation logic (using linear + interpolation between timeSamples) as described by + . + + \\anchor UsdGeom_PITimeScaling + Scaling Velocities for Interpolation + + When computing time-differentials by which to apply velocity or + angularVelocity to positions or orientations, we must scale by + ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded + in units/second, while we are interpolating in UsdTimeCode ordinates. + + We provide both high and low-level API's for dealing with the + transformation as a matrix, both will compute the instance matrices using + multiple threads; the low-level API allows the client to cache unvarying + inputs so that they need not be read duplicately when computing over + time. + + See also . + + Primvars on PointInstancer + + \"Primvars\" authored on a PointInstancer prim should + always be applied to each instance with constant interpolation at + the root of the instance. When you are authoring primvars on a + PointInstancer, think about it as if you were authoring them on a + point-cloud (e.g. a UsdGeomPoints gprim). The same + interpolation rules for points apply here, substituting + \"instance\" for \"point\". + + In other words, the (constant) value extracted for each instance + from the authored primvar value depends on the authored interpolation + and elementSize of the primvar, as follows: + - constant or uniform : the entire authored value of the + primvar should be applied exactly to each instance. + - varying, vertex, or faceVarying: the first + elementSize elements of the authored primvar array should be assigned to + instance zero, the second elementSize elements should be assigned to + instance one, and so forth. + + + Masking Instances: \"Deactivating\" and Invising + + Often a PointInstancer is created \"upstream\" in a graphics pipeline, and + the needs of \"downstream\" clients necessitate eliminating some of the + instances from further consideration. Accomplishing this pruning by + re-authoring all of the per-instance attributes is not very attractive, + since it may mean destructively editing a large quantity of data. We + therefore provide means of \"masking\" instances by ID, such that the + instance data is unmolested, but per-instance transform and primvar data + can be retrieved with the no-longer-desired instances eliminated from the + (smaller) arrays. PointInstancer allows two independent means of masking + instances by ID, each with different features that meet the needs of + various clients in a pipeline. Both pruning features' lists of ID's are + combined to produce the mask returned by ComputeMaskAtTime(). + + \\note If a PointInstancer has no authored ids attribute, the masking + features will still be available, with the integers specifying element + position in the protoIndices array rather than ID. + + \\subsection UsdGeomPointInstancer_inactiveIds InactiveIds: List-edited, Unvarying Masking + + The first masking feature encodes a list of IDs in a list-editable metadatum + called inactiveIds, which, although it does not have any similar + impact to stage population as \"prim activation\", + it shares with that feature that its application is uniform over all time. + Because it is list-editable, we can sparsely add and remove instances + from it in many layers. + + This sparse application pattern makes inactiveIds a good choice when + further downstream clients may need to reverse masking decisions made + upstream, in a manner that is robust to many kinds of future changes to + the upstream data. + + See ActivateId(), ActivateIds(), DeactivateId(), DeactivateIds(), + ActivateAllIds() + + \\subsection UsdGeomPointInstancer_invisibleIds invisibleIds: Animatable Masking + + The second masking feature encodes a list of IDs in a time-varying + Int64Array-valued UsdAttribute called invisibleIds , since it shares + with \"Imageable visibility\" + the ability to animate object visibility. + + Unlike inactiveIds, overriding a set of opinions for invisibleIds + is not at all straightforward, because one will, in general need to + reauthor (in the overriding layer) **all** timeSamples for the attribute + just to change one Id's visibility state, so it cannot be authored + sparsely. But it can be a very useful tool for situations like encoding + pre-computed camera-frustum culling of geometry when either or both of + the instances or the camera is animated. + + See VisId(), VisIds(), InvisId(), InvisIds(), VisAllIds() + + Processing and Not Processing Prototypes + + Any prim in the scenegraph can be targeted as a prototype by the + prototypes relationship. We do not, however, provide a specific + mechanism for identifying prototypes as geometry that should not be drawn + (or processed) in their own, local spaces in the scenegraph. We + encourage organizing all prototypes as children of the PointInstancer + prim that consumes them, and pruning \"raw\" processing and drawing + traversals when they encounter a PointInstancer prim; this is what the + UsdGeomBBoxCache and UsdImaging engines do. + + There is a pattern one can deploy for organizing the prototypes + such that they will automatically be skipped by basic UsdPrim::GetChildren() + or UsdPrimRange traversals. Usd prims each have a + \"specifier\" of \"def\", \"over\", or \"class\". The + default traversals skip over prims that are \"pure overs\" or classes. So + to protect prototypes from all generic traversals and processing, place + them under a prim that is just an \"over\". For example, + \\code + 01 def PointInstancer \"Crowd_Mid\" + 02 { + 03 rel prototypes = [ , ] + 04 + 05 over \"Prototypes\" + 06 { + 07 def \"MaleThin_Business\" ( + 08 references = [@MaleGroupA/usd/MaleGroupA.usd@] + 09 variants = { + 10 string modelingVariant = \"Thin\" + 11 string costumeVariant = \"BusinessAttire\" + 12 } + 13 ) + 14 { ... } + 15 + 16 def \"MaleThin_Casual\" + 17 ... + 18 } + 19 } + \\endcode + """ +) +{ + vector3f[] accelerations ( + doc = """If authored, per-instance 'accelerations' will be used with + velocities to compute positions between samples for the 'positions' + attribute rather than interpolating between neighboring 'positions' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + vector3f[] angularVelocities ( + doc = """If authored, per-instance angular velocity vector to be used for + interoplating orientations. Angular velocities should be considered + mandatory if both protoIndices and orientations are animated. + Angular velocity is measured in degrees per second. To convert + to degrees per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the protoIndices array, specifying (at each timeSample if + instance identities are changing) the id of each instance. The + type is signed intentionally, so that clients can encode some + binary state on Id'd instances without adding a separate primvar. + See also \\ref UsdGeomPointInstancer_varyingTopo""" + ) + int64[] invisibleIds = [] ( + doc = """A list of id's to make invisible at the evaluation time. + See .""" + ) + quath[] orientations ( + doc = """If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, which + allows us to encode it with sufficient precision in a compact GfQuath. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the \"better (for interpolation + with respect to neighboring samples)\" of the two possible quaternions + that encode the rotation. + + See also .""" + ) + quatf[] orientationsf ( + doc = """If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, encoded + as a GfQuatf to support higher precision computations. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the \"better (for interpolation + with respect to neighboring samples)\" of the two possible quaternions + that encode the rotation. Note that if the earliest time sample (or + default value if there are no time samples) of orientationsf is not empty + orientationsf will be preferred over orientations if both are authored. + + See also .""" + ) + point3f[] positions ( + doc = """Required property. Per-instance position. See also + .""" + ) + int[] protoIndices ( + doc = """Required property. Per-instance index into + prototypes relationship that identifies what geometry should be + drawn for each instance. Topology attribute - can be animated, + but at a potential performance impact for streaming.""" + ) + rel prototypes ( + doc = """Required property. Orders and targets the prototype root + prims, which can be located anywhere in the scenegraph that is convenient, + although we promote organizing prototypes as children of the + PointInstancer. The position of a prototype in this relationship defines + the value an instance would specify in the protoIndices attribute to + instance that prototype. Since relationships are uniform, this property + cannot be animated.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + float3[] scales ( + doc = """If authored, per-instance scale to be applied to + each instance, before any rotation is applied. + + See also .""" + ) + vector3f[] velocities ( + doc = """If provided, per-instance 'velocities' will be used to + compute positions between samples for the 'positions' attribute, + rather than interpolating between neighboring 'positions' samples. + Velocities should be considered mandatory if both protoIndices + and positions are animated. Velocity is measured in position + units per second, as per most simulation software. To convert to + position units per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also + .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Camera "Camera" ( + doc = """Transformable camera. + + Describes optical properties of a camera via a common set of attributes + that provide control over the camera's frustum as well as its depth of + field. For stereo, the left and right camera are individual prims tagged + through the \"stereoRole attribute\". + + There is a corresponding class GfCamera, which can hold the state of a + camera (at a particular time). and + convert between a USD camera prim and + a GfCamera. + + To obtain the camera's location in world space, call the following on a + UsdGeomCamera 'camera': + \\code + GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); + \\endcode + \\note + Cameras in USD are always \"Y up\", regardless of the stage's orientation + (i.e. UsdGeomGetStageUpAxis()). This means that the inverse of + 'camXform' (the VIEW half of the MODELVIEW transform in OpenGL parlance) + will transform the world such that the camera is at the origin, looking + down the -Z axis, with +Y as the up axis, and +X pointing to the right. + This describes a __right handed coordinate system__. + + Units of Measure for Camera Properties + + Despite the familiarity of millimeters for specifying some physical + camera properties, UsdGeomCamera opts for greater consistency with all + other UsdGeom schemas, which measure geometric properties in scene units, + as determined by UsdGeomGetStageMetersPerUnit(). We do make a + concession, however, in that lens and filmback properties are measured in + __tenths of a scene unit__ rather than \"raw\" scene units. This means + that with the fallback value of .01 for _metersPerUnit_ - i.e. scene unit + of centimeters - then these \"tenth of scene unit\" properties are + effectively millimeters. + + \\note If one adds a Camera prim to a UsdStage whose scene unit is not + centimeters, the fallback values for filmback properties will be + incorrect (or at the least, unexpected) in an absolute sense; however, + proper imaging through a \"default camera\" with focusing disabled depends + only on ratios of the other properties, so the camera is still usable. + However, it follows that if even one property is authored in the correct + scene units, then they all must be. + + + \\sa \\ref UsdGeom_LinAlgBasics + """ +) +{ + float4[] clippingPlanes = [] ( + doc = """Additional, arbitrarily oriented clipping planes. + A vector (a,b,c,d) encodes a clipping plane that cuts off + (x,y,z) with a * x + b * y + c * z + d * 1 < 0 where (x,y,z) + are the coordinates in the camera's space.""" + ) + float2 clippingRange = (1, 1000000) ( + doc = """Near and far clipping distances in scene units; see + .""" + ) + float exposure = 0 ( + doc = """Exposure adjustment, as a log base-2 value. The default + of 0.0 has no effect. A value of 1.0 will double the + image-plane intensities in a rendered image; a value of + -1.0 will halve them.""" + ) + float focalLength = 50 ( + doc = """Perspective focal length in tenths of a scene unit; see + .""" + ) + float focusDistance = 0 ( + doc = """Distance from the camera to the focus plane in scene units; see + .""" + ) + float fStop = 0 ( + doc = "Lens aperture. Defaults to 0.0, which turns off focusing." + ) + float horizontalAperture = 20.955 ( + doc = """Horizontal aperture in tenths of a scene unit; see + . Default is the equivalent of + the standard 35mm spherical projector aperture.""" + ) + float horizontalApertureOffset = 0 ( + doc = """Horizontal aperture offset in the same units as + horizontalAperture. Defaults to 0.""" + ) + token projection = "perspective" ( + allowedTokens = ["perspective", "orthographic"] + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + double shutter:close = 0 ( + doc = """Frame relative shutter close time, analogous comments from + shutter:open apply. A value greater or equal to shutter:open + should be authored, otherwise there is no exposure and a + renderer should produce a black image.""" + ) + double shutter:open = 0 ( + doc = """Frame relative shutter open time in UsdTimeCode units (negative + value indicates that the shutter opens before the current + frame time). Used for motion blur.""" + ) + uniform token stereoRole = "mono" ( + allowedTokens = ["mono", "left", "right"] + doc = """If different from mono, the camera is intended to be the left + or right camera of a stereo setup.""" + ) + float verticalAperture = 15.2908 ( + doc = """Vertical aperture in tenths of a scene unit; see + . Default is the equivalent of + the standard 35mm spherical projector aperture.""" + ) + float verticalApertureOffset = 0 ( + doc = """Vertical aperture offset in the same units as + verticalAperture. Defaults to 0.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "GeomModelAPI" ( + doc = """UsdGeomModelAPI extends the generic UsdModelAPI schema with + geometry specific concepts such as cached extents for the entire model, + constraint targets, and geometry-inspired extensions to the payload + lofting process. + + As described in GetExtentsHint() below, it is useful to cache extents + at the model level. UsdGeomModelAPI provides schema for computing and + storing these cached extents, which can be consumed by UsdGeomBBoxCache to + provide fast access to precomputed extents that will be used as the model's + bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). + + Draw Modes + + Draw modes provide optional alternate imaging behavior for USD subtrees with + kind model. model:drawMode (which is inheritable) and + model:applyDrawMode (which is not) are resolved into a decision to stop + traversing the scene graph at a certain point, and replace a USD subtree + with proxy geometry. + + The value of model:drawMode determines the type of proxy geometry: + - origin - Draw the model-space basis vectors of the replaced prim. + - bounds - Draw the model-space bounding box of the replaced prim. + - cards - Draw textured quads as a placeholder for the replaced prim. + - default - An explicit opinion to draw the USD subtree as normal. + - inherited - Defer to the parent opinion. + + model:drawMode falls back to _inherited_ so that a whole scene, + a large group, or all prototypes of a model hierarchy PointInstancer can + be assigned a draw mode with a single attribute edit. If no draw mode is + explicitly set in a hierarchy, the resolved value is _default_. + + model:applyDrawMode is meant to be written when an asset is authored, + and provides flexibility for different asset types. For example, + a character assembly (composed of character, clothes, etc) might have + model:applyDrawMode set at the top of the subtree so the whole group + can be drawn as a single card object. An effects subtree might have + model:applyDrawMode set at a lower level so each particle + group draws individually. + + Models of kind component are automatically treated as if + model:applyDrawMode were true if model:applyDrawMode is not + authored on the component prim. A component prim will be drawn drawn with a + simplified representation when the prim has kind component, + model:applyDrawMode is not authored (or authored to be true), and the + resolved (i.e. inherited down namespace) value for model:drawMode is + not _default_. If you don't want component prims to use the resolved + non-default drawMode, you must apply the UsdGeomModelAPI schema on the prim + and explicitly set model:applyDrawMode to false. + + Cards Geometry + + The specific geometry used in cards mode is controlled by the + model:cardGeometry attribute: + - cross - Generate a quad normal to each basis direction and negative. + Locate each quad so that it bisects the model extents. + - box - Generate a quad normal to each basis direction and negative. + Locate each quad on a face of the model extents, facing out. + - fromTexture - Generate a quad for each supplied texture from + attributes stored in that texture's metadata. + + For cross and box mode, the extents are calculated for purposes + default, proxy, and render, at their earliest authored time. + If the model has no textures, all six card faces are rendered using + model:drawModeColor. If one or more textures are present, only axes + with one or more textures assigned are drawn. For each axis, if both + textures (positive and negative) are specified, they'll be used on the + corresponding card faces; if only one texture is specified, it will be + mapped to the opposite card face after being flipped on the texture's + s-axis. Any card faces with invalid asset paths will be drawn with + model:drawModeColor. + + Both model:cardGeometry and model:drawModeColor should be + authored on the prim where the draw mode takes effect, since these + attributes are not inherited. + + For fromTexture mode, only card faces with valid textures assigned + are drawn. The geometry is generated by pulling the worldtoscreen + attribute out of texture metadata. This is expected to be a 4x4 matrix + mapping the model-space position of the card quad to the clip-space quad + with corners (-1,-1,0) and (1,1,0). The card vertices are generated by + transforming the clip-space corners by the inverse of worldtoscreen. + Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. + If the metadata cannot be read in the right format, or the matrix can't + be inverted, the card face is not drawn. + + All card faces are drawn and textured as single-sided. + + \\todo CreatePayload() """ +) +{ + uniform bool model:applyDrawMode = 0 ( + doc = """If true, and the resolved value of model:drawMode is + non-default, apply an alternate imaging mode to this prim. See + \\ref UsdGeomModelAPI_drawMode.""" + ) + uniform token model:cardGeometry = "cross" ( + allowedTokens = ["cross", "box", "fromTexture"] + doc = """The geometry to generate for imaging prims inserted for \\em + cards imaging mode. See for + geometry descriptions.""" + ) + asset model:cardTextureXNeg ( + doc = """In cards imaging mode, the texture applied to the X- quad. + The texture axes (s,t) are mapped to model-space axes (y, -z).""" + ) + asset model:cardTextureXPos ( + doc = """In cards imaging mode, the texture applied to the X+ quad. + The texture axes (s,t) are mapped to model-space axes (-y, -z).""" + ) + asset model:cardTextureYNeg ( + doc = """In cards imaging mode, the texture applied to the Y- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -z).""" + ) + asset model:cardTextureYPos ( + doc = """In cards imaging mode, the texture applied to the Y+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -z).""" + ) + asset model:cardTextureZNeg ( + doc = """In cards imaging mode, the texture applied to the Z- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -y).""" + ) + asset model:cardTextureZPos ( + doc = """In cards imaging mode, the texture applied to the Z+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -y).""" + ) + uniform token model:drawMode = "inherited" ( + allowedTokens = ["origin", "bounds", "cards", "default", "inherited"] + doc = """Alternate imaging mode; applied to this prim or child prims + where model:applyDrawMode is true, or where the prim + has kind component and model:applyDrawMode is not + authored. See \\ref UsdGeomModelAPI_drawMode + for mode descriptions.""" + ) + uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ( + doc = """The base color of imaging prims inserted for alternate + imaging modes. For origin and bounds modes, this + controls line color; for cards mode, this controls the + fallback quad color.""" + ) +} + +class "MotionAPI" ( + doc = '''UsdGeomMotionAPI encodes data that can live on any prim that + may affect computations involving: + - computed motion for motion blur + - sampling for motion blur + + The "motion:blurScale" attribute allows + artists to scale the __amount__ of motion blur to be rendered for parts + of the scene without changing the recorded animation. See + for use and implementation details. + + ''' +) +{ + float motion:blurScale = 1 ( + doc = """BlurScale is an __inherited__ float attribute that stipulates + the rendered motion blur (as typically specified via UsdGeomCamera's + _shutter:open_ and _shutter:close_ properties) should be scaled for + __all objects__ at and beneath the prim in namespace on which the + _motion:blurScale_ value is specified. + + Without changing any other data in the scene, _blurScale_ allows artists to + \"dial in\" the amount of blur on a per-object basis. A _blurScale_ + value of zero removes all blur, a value of 0.5 reduces blur by half, + and a value of 2.0 doubles the blur. The legal range for _blurScale_ + is [0, inf), although very high values may result in extremely expensive + renders, and may exceed the capabilities of some renderers. + + Although renderers are free to implement this feature however they see + fit, see for our guidance on implementing + the feature universally and efficiently. + + \\sa ComputeMotionBlurScale() + """ + ) + int motion:nonlinearSampleCount = 3 ( + doc = """Determines the number of position or transformation samples + created when motion is described by attributes contributing non-linear + terms. + + To give an example, imagine an application (such as a + renderer) consuming 'points' and the USD document also + contains 'accelerations' for the same prim. Unless the + application can consume these 'accelerations' itself, an + intermediate layer has to compute samples within the sampling + interval for the point positions based on the value of + 'points', 'velocities' and 'accelerations'. The number of these + samples is given by 'nonlinearSampleCount'. The samples are + equally spaced within the sampling interval. + + Another example involves the PointInstancer where + 'nonlinearSampleCount' is relevant when 'angularVelocities' + or 'accelerations' are authored. + + 'nonlinearSampleCount' is an **inherited** attribute, also + see ComputeNonlinearSampleCount()""" + ) + float motion:velocityScale = 1 ( + doc = """\\deprecated + + VelocityScale is an **inherited** float attribute that + velocity-based schemas (e.g. PointBased, PointInstancer) can consume + to compute interpolated positions and orientations by applying + velocity and angularVelocity, which is required for interpolating + between samples when topology is varying over time. Although these + quantities are generally physically computed by a simulator, sometimes + we require more or less motion-blur to achieve the desired look. + VelocityScale allows artists to dial-in, as a post-sim correction, + a scale factor to be applied to the velocity prior to computing + interpolated positions from it.""" + ) +} + +class "XformCommonAPI" ( + doc = """This class provides API for authoring and retrieving a standard set + of component transformations which include a scale, a rotation, a + scale-rotate pivot and a translation. The goal of the API is to enhance + component-wise interchange. It achieves this by limiting the set of allowed + basic ops and by specifying the order in which they are applied. In addition + to the basic set of ops, the 'resetXformStack' bit can also be set to + indicate whether the underlying xformable resets the parent transformation + (i.e. does not inherit it's parent's transformation). + + \\sa UsdGeomXformCommonAPI::GetResetXformStack() + \\sa UsdGeomXformCommonAPI::SetResetXformStack() + + The operator-bool for the class will inform you whether an existing + xformable is compatible with this API. + + The scale-rotate pivot is represented by a pair of (translate, + inverse-translate) xformOps around the scale and rotate operations. + The rotation operation can be any of the six allowed Euler angle sets. + \\sa UsdGeomXformOp::Type. + + The xformOpOrder of an xformable that has all of the supported basic ops + is as follows: + [\"xformOp:translate\", \"xformOp:translate:pivot\", \"xformOp:rotateXYZ\", + \"xformOp:scale\", \"!invert!xformOp:translate:pivot\"]. + + It is worth noting that all of the ops are optional. For example, an + xformable may have only a translate or a rotate. It would still be + considered as compatible with this API. Individual SetTranslate(), + SetRotate(), SetScale() and SetPivot() methods are provided by this API + to allow such sparse authoring.""" +) +{ +} + +class HermiteCurves "HermiteCurves" ( + doc = """This schema specifies a cubic hermite interpolated curve batch as + sometimes used for defining guides for animation. While hermite curves can + be useful because they interpolate through their control points, they are + not well supported by high-end renderers for imaging. Therefore, while we + include this schema for interchange, we strongly recommend the use of + UsdGeomBasisCurves as the representation of curves intended to be rendered + (ie. hair or grass). Hermite curves can be converted to a Bezier + representation (though not from Bezier back to Hermite in general). + + Point Interpolation + + The initial cubic curve segment is defined by the first two points and + first two tangents. Additional segments are defined by additional + point / tangent pairs. The number of segments for each non-batched hermite + curve would be len(curve.points) - 1. The total number of segments + for the batched UsdGeomHermiteCurves representation is + len(points) - len(curveVertexCounts). + + Primvar, Width, and Normal Interpolation + + Primvar interpolation is not well specified for this type as it is not + intended as a rendering representation. We suggest that per point + primvars would be linearly interpolated across each segment and should + be tagged as 'varying'. + + It is not immediately clear how to specify cubic or 'vertex' interpolation + for this type, as we lack a specification for primvar tangents. This + also means that width and normal interpolation should be restricted to + varying (linear), uniform (per curve element), or constant (per prim). + """ +) +{ + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + vector3f[] tangents = [] ( + doc = """Defines the outgoing trajectory tangent for each point. + Tangents should be the same size as the points attribute.""" + ) + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also .""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are \"ribbon width\", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "constraintTargetIdentifier": { + "appliesTo": [ + "attributes" + ], + "default": "", + "documentation": "Unique identifier within a model's namespace for an matrix-valued attribute representing a constraint target", + "type": "token" + }, + "elementSize": { + "appliesTo": [ + "attributes" + ], + "default": 1, + "displayGroup": "Primvars", + "documentation": "The number of values in a primvar's value array that must be aggregated for each element on the primitive.", + "type": "int" + }, + "inactiveIds": { + "appliesTo": [ + "prims" + ], + "type": "int64listop" + }, + "interpolation": { + "appliesTo": [ + "attributes" + ], + "default": "constant", + "displayGroup": "Primvars", + "documentation": "How a primvar interpolates across a primitive; equivalent to RenderMan's 'class specifier'", + "type": "token" + }, + "metersPerUnit": { + "appliesTo": [ + "layers" + ], + "default": 0.01, + "displayGroup": "Stage", + "type": "double" + }, + "unauthoredValuesIndex": { + "appliesTo": [ + "attributes" + ], + "default": -1, + "displayGroup": "Primvars", + "documentation": "The index that represents unauthored values in the indices array of an indexed primvar.", + "type": "int" + }, + "upAxis": { + "appliesTo": [ + "layers" + ], + "default": "Y", + "displayGroup": "Stage", + "type": "token" + } + }, + "Types": { + "UsdGeomBasisCurves": { + "alias": { + "UsdSchemaBase": "BasisCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomBoundable": { + "alias": { + "UsdSchemaBase": "Boundable" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomCamera": { + "alias": { + "UsdSchemaBase": "Camera" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomCapsule": { + "alias": { + "UsdSchemaBase": "Capsule" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCapsule_1": { + "alias": { + "UsdSchemaBase": "Capsule_1" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCone": { + "alias": { + "UsdSchemaBase": "Cone" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCube": { + "alias": { + "UsdSchemaBase": "Cube" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCurves": { + "alias": { + "UsdSchemaBase": "Curves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "implementsComputeExtent": true, + "schemaKind": "abstractTyped" + }, + "UsdGeomCylinder": { + "alias": { + "UsdSchemaBase": "Cylinder" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomCylinder_1": { + "alias": { + "UsdSchemaBase": "Cylinder_1" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomGprim": { + "alias": { + "UsdSchemaBase": "Gprim" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomHermiteCurves": { + "alias": { + "UsdSchemaBase": "HermiteCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomImageable": { + "alias": { + "UsdSchemaBase": "Imageable" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "abstractTyped" + }, + "UsdGeomMesh": { + "alias": { + "UsdSchemaBase": "Mesh" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomModelAPI": { + "alias": { + "UsdSchemaBase": "GeomModelAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomMotionAPI": { + "alias": { + "UsdSchemaBase": "MotionAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomNurbsCurves": { + "alias": { + "UsdSchemaBase": "NurbsCurves" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomCurves" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomNurbsPatch": { + "alias": { + "UsdSchemaBase": "NurbsPatch" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomPlane": { + "alias": { + "UsdSchemaBase": "Plane" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPointBased": { + "alias": { + "UsdSchemaBase": "PointBased" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "abstractTyped" + }, + "UsdGeomPointInstancer": { + "alias": { + "UsdSchemaBase": "PointInstancer" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPoints": { + "alias": { + "UsdSchemaBase": "Points" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomPrimvarsAPI": { + "alias": { + "UsdSchemaBase": "PrimvarsAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdGeomScope": { + "alias": { + "UsdSchemaBase": "Scope" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomImageable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomSphere": { + "alias": { + "UsdSchemaBase": "Sphere" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdGeomSubset": { + "alias": { + "UsdSchemaBase": "GeomSubset" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomTetMesh": { + "alias": { + "UsdSchemaBase": "TetMesh" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomPointBased" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomVisibilityAPI": { + "alias": { + "UsdSchemaBase": "VisibilityAPI" + }, + "apiSchemaCanOnlyApplyTo": [ + "Imageable" + ], + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdGeomXform": { + "alias": { + "UsdSchemaBase": "Xform" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdGeomXformCommonAPI": { + "alias": { + "UsdSchemaBase": "XformCommonAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdGeomXformable": { + "alias": { + "UsdSchemaBase": "Xformable" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomImageable" + ], + "schemaKind": "abstractTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdGeom", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Geometric schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdGeom" + string libraryPath = "pxr/usd/usdGeom" + # string libraryPrefix = "UsdGeom" + # string tokensPrefix = "UsdGeom" + bool useLiteralIdentifier = 0 + dictionary libraryTokens = { + dictionary interpolation = { + string doc = """UsdGeomPrimvar - How a Primvar interpolates + across a primitive; equivalent to RenderMan's \\ref Usd_InterpolationVals "class specifier" """ + } + dictionary elementSize = { + string doc = """UsdGeomPrimvar - The number of values in the + value array that must be aggregated for each element on the + primitive.""" + } + dictionary unauthoredValuesIndex = { + string doc = """UsdGeomPrimvar - The index that represents + unauthored values in the indices array of an indexed primvar.""" + } + dictionary constant ={ + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Default value for UsdGeomPrimvar::GetInterpolation. One value + remains constant over the entire surface primitive.""" + } + dictionary uniform = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + One value remains constant for each uv patch segment of the + surface primitive (which is a \\em face for meshes).""" + } + dictionary varying = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Four values are interpolated over each uv patch segment of the + surface. Bilinear interpolation is used for interpolation + between the four values.""" + } + dictionary vertex = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + Values are interpolated between each vertex in the surface + primitive. The basis function of the surface is used for + interpolation between vertices.""" + } + dictionary faceVarying = { + string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. + For polygons and subdivision surfaces, four values are + interpolated over each face of the mesh. Bilinear interpolation + is used for interpolation between the four values.""" + } + dictionary upAxis = { + string doc = """Stage-level metadata that encodes a scene's + orientation as a token whose value can be "Y" or "Z".""" + } + dictionary metersPerUnit = { + string doc = """Stage-level metadata that encodes a scene's + linear unit of measure as meters per encoded unit.""" + } + dictionary partition = { + string doc = """A type of family of GeomSubsets. It implies + that every element appears exacly once in only one of the + subsets in the family.""" + } + dictionary nonOverlapping = { + string doc = """A type of family of GeomSubsets. It implies that + the elements in the various subsets belonging to the family are + mutually exclusive, i.e., an element that appears in one + subset may not belong to any other subset in the family.""" + } + dictionary unrestricted = { + string doc = """A type of family of GeomSubsets. It implies that + there are no restrictions w.r.t. the membership of elements in + the subsets. There could be overlapping members in subsets + belonging to the family and the union of all subsets in the + family may not contain all the elements.""" + } + dictionary hermite = { + string doc = """A deprecated basis token for + UsdGeomBasisCurves. Consumers of USD should transition + to using the UsdGeomHermiteCurves schema.""" + } + dictionary power = { + string doc = """A deprecated basis token for + UsdGeomBasisCurves.""" + } + } + } +) +{ +} + +class "Imageable" ( + inherits = + doc = """Base class for all prims that may require rendering or + visualization of some sort. The primary attributes of Imageable + are \\em visibility and \\em purpose, which each provide instructions for + what geometry should be included for processing by rendering and other + computations. + + \\deprecated Imageable also provides API for accessing primvars, which + has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now + be applied on non-Imageable prim types. This API is planned + to be removed, UsdGeomPrimvarsAPI should be used directly instead.""" + customData = { + string extraIncludes = """ +#include "pxr/base/gf/bbox3d.h" +#include "pxr/usd/usdGeom/primvar.h" """ + } +) { + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = """Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.""" + ) + + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See \\ref UsdGeom_ImageablePurpose for more detail about how + \\em purpose is computed and used.""" + ) + rel proxyPrim ( + doc = """The \\em proxyPrim relationship allows us to link a + prim whose \\em purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + \\li In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + \\li DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + \\li With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".""" + ) +} + +class "VisibilityAPI" +( + inherits = + customData = { + token[] apiSchemaCanOnlyApplyTo = [ + "Imageable" + ] + } + doc = """ + UsdGeomVisibilityAPI introduces properties that can be used to author + visibility opinions. + + \\note + Currently, this schema only introduces the attributes that are used to + control purpose visibility. Later, this schema will define _all_ + visibility-related properties and UsdGeomImageable will no longer define + those properties. + + The purpose visibility attributes added by this schema, + _guideVisibility_, _proxyVisibility_, and _renderVisibility_ can each be + used to control visibility for geometry of the corresponding purpose + values, with the overall _visibility_ attribute acting as an + override. I.e., if _visibility_ evaluates to "invisible", purpose + visibility is invisible; otherwise, purpose visibility is determined by + the corresponding purpose visibility attribute. + + Note that the behavior of _guideVisibility_ is subtly different from the + _proxyVisibility_ and _renderVisibility_ attributes, in that "guide" + purpose visibility always evaluates to either "invisible" or "visible", + whereas the other attributes may yield computed values of "inherited" if + there is no authored opinion on the attribute or inherited from an + ancestor. This is motivated by the fact that, in Pixar"s user workflows, + we have never found a need to have all guides visible in a scene by + default, whereas we do find that flexibility useful for "proxy" and + "render" geometry. + + This schema can only be applied to UsdGeomImageable prims. The + UseGeomImageable schema provides API for computing the purpose visibility + values that result from the attributes introduced by this schema. + """ +) +{ + uniform token guideVisibility = "invisible" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose "guide". + + Unlike overall _visibility_, _guideVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _guideVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _guideVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "guide" + is determined by the inherited values it receives for the _visibility_ + and _guideVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" and _guideVisibility_ evaluates to "visible", then the + prim is visible. __Otherwise, it is invisible.__ + """ + ) + + uniform token proxyVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose "proxy". + + Unlike overall _visibility_, _proxyVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _proxyVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _proxyVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "proxy" + is determined by the inherited values it receives for the _visibility_ + and _proxyVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _proxyVisibility_ evaluates to "visible", then + the prim is visible; if _proxyVisibility_ evaluates to "invisible", + then the prim is invisible; if _proxyVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + """ + ) + + uniform token renderVisibility = "inherited" ( + allowedTokens = ["inherited", "invisible", "visible"] + doc = """ + This attribute controls visibility for geometry with purpose + "render". + + Unlike overall _visibility_, _renderVisibility_ is uniform, and + therefore cannot be animated. + + Also unlike overall _visibility_, _renderVisibility_ is tri-state, in + that a descendant with an opinion of "visible" overrides an ancestor + opinion of "invisible". + + The _renderVisibility_ attribute works in concert with the overall + _visibility_ attribute: The visibility of a prim with purpose "render" + is determined by the inherited values it receives for the _visibility_ + and _renderVisibility_ attributes. If _visibility_ evaluates to + "invisible", the prim is invisible. If _visibility_ evaluates to + "inherited" then: If _renderVisibility_ evaluates to "visible", then + the prim is visible; if _renderVisibility_ evaluates to "invisible", + then the prim is invisible; if _renderVisibility_ evaluates to + "inherited", then the prim may either be visible or invisible, + depending on a fallback value determined by the calling context. + """ + ) +} + +class "PrimvarsAPI" ( + inherits = + doc = """UsdGeomPrimvarsAPI encodes geometric "primitive variables", + as UsdGeomPrimvar, which interpolate across a primitive's topology, + can override shader inputs, and inherit down namespace. + + \\section usdGeom_PrimvarFetchingAPI Which Method to Use to Retrieve Primvars + + While creating primvars is unambiguous (CreatePrimvar()), there are quite + a few methods available for retrieving primvars, making it potentially + confusing knowing which one to use. Here are some guidelines: + + \\li If you are populating a GUI with the primvars already available for + authoring values on a prim, use GetPrimvars(). + \\li If you want all of the "useful" (e.g. to a renderer) primvars + available at a prim, including those inherited from ancestor prims, use + FindPrimvarsWithInheritance(). Note that doing so individually for many + prims will be inefficient. + \\li To find a particular primvar defined directly on a prim, which may + or may not provide a value, use GetPrimvar(). + \\li To find a particular primvar defined on a prim or inherited from + ancestors, which may or may not provide a value, use + FindPrimvarWithInheritance(). + \\li To *efficiently* query for primvars using the overloads of + FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one + must first cache the results of FindIncrementallyInheritablePrimvars() for + each non-leaf prim on the stage. """ + customData = { + token apiSchemaType = "nonApplied" + string extraIncludes = """ +#include "pxr/usd/usdGeom/primvar.h" """ + } +) { +} + +class "Xformable" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usdGeom/xformOp.h" +#include """ + } + doc = """Base class for all transformable prims, which allows arbitrary + sequences of component affine transformations to be encoded. + + \\note + You may find it useful to review \\ref UsdGeom_LinAlgBasics while reading + this class description. + + Supported Component Transformation Operations + + UsdGeomXformable currently supports arbitrary sequences of the following + operations, each of which can be encoded in an attribute of the proper + shape in any supported precision: + \\li translate - 3D + \\li scale - 3D + \\li rotateX - 1D angle in degrees + \\li rotateY - 1D angle in degrees + \\li rotateZ - 1D angle in degrees + \\li rotateABC - 3D where ABC can be any combination of the six principle + Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See + \\ref usdGeom_rotationPackingOrder "note on rotation packing order" + \\li orient - 4D (quaternion) + \\li transform - 4x4D + + Creating a Component Transformation + + To add components to a UsdGeomXformable prim, simply call AddXformOp() + with the desired op type, as enumerated in \\ref UsdGeomXformOp::Type, + and the desired precision, which is one of \\ref UsdGeomXformOp::Precision. + Optionally, you can also provide an "op suffix" for the operator that + disambiguates it from other components of the same type on the same prim. + Application-specific transform schemas can use the suffixes to fill a role + similar to that played by AbcGeom::XformOp's "Hint" enums for their own + round-tripping logic. + + We also provide specific "Add" API for each type, for clarity and + conciseness, e.g. AddTranslateOp(), AddRotateXYZOp() etc. + + AddXformOp() will return a UsdGeomXformOp object, which is a schema on a + newly created UsdAttribute that provides convenience API for authoring + and computing the component transformations. The UsdGeomXformOp can then + be used to author any number of timesamples and default for the op. + + Each successive call to AddXformOp() adds an operator that will be applied + "more locally" than the preceding operator, just as if we were pushing + transforms onto a transformation stack - which is precisely what should + happen when the operators are consumed by a reader. + + \\note + If you can, please try to use the UsdGeomXformCommonAPI, which wraps + the UsdGeomXformable with an interface in which Op creation is taken + care of for you, and there is a much higher chance that the data you + author will be importable without flattening into other DCC's, as it + conforms to a fixed set of Scale-Rotate-Translate Ops. + + \\sa \\ref usdGeom_xformableExamples "Using the Authoring API" + + Data Encoding and Op Ordering + + Because there is no "fixed schema" of operations, all of the attributes + that encode transform operations are dynamic, and are scoped in + the namespace "xformOp". The second component of an attribute's name provides + the \\em type of operation, as listed above. An "xformOp" attribute can + have additional namespace components derived from the \\em opSuffix argument + to the AddXformOp() suite of methods, which provides a preferred way of + naming the ops such that we can have multiple "translate" ops with unique + attribute names. For example, in the attribute named + "xformOp:translate:maya:pivot", "translate" is the type of operation and + "maya:pivot" is the suffix. + + The following ordered list of attribute declarations in usda + define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the + translation is double-precision, and the remainder of the ops are single, + in which we will: + +
    +
  1. Scale by 2.0 in each dimension +
  2. Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively +
  3. Translate by 100 units in the Y direction +
+ + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale" ] + \\endcode + + The attributes appear in the dictionary order in which USD, by default, + sorts them. To ensure the ops are recovered and evaluated in the correct + order, the schema introduces the **xformOpOrder** attribute, which + contains the names of the op attributes, in the precise sequence in which + they should be pushed onto a transform stack. **Note** that the order is + opposite to what you might expect, given the matrix algebra described in + \\ref UsdGeom_LinAlgBasics. This also dictates order of op creation, + since each call to AddXformOp() adds a new op to the end of the + \\b xformOpOrder array, as a new "most-local" operation. See + \\ref usdGeom_xformableExamples "Example 2 below" for C++ code that could + have produced this USD. + + If it were important for the prim's rotations to be independently + overridable, we could equivalently (at some performance cost) encode + the transformation also like so: + \\code + float xformOp:rotateX = 30 + float xformOp:rotateY = 60 + float xformOp:rotateZ = 90 + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateZ", "xformOp:rotateY", "xformOp:rotateX", "xformOp:scale" ] + \\endcode + + Again, note that although we are encoding an XYZ rotation, the three + rotations appear in the **xformOpOrder** in the opposite order, with Z, + followed, by Y, followed by X. + + Were we to add a Maya-style scalePivot to the above example, it might + look like the following: + \\code + float3 xformOp:rotateXYZ = (30, 60, 90) + float3 xformOp:scale = (2, 2, 2) + double3 xformOp:translate = (0, 100, 0) + double3 xformOp:translate:scalePivot + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale" ] + \\endcode + + Paired "Inverted" Ops + + We have been claiming that the ordered list of ops serves as a set + of instructions to a transform stack, but you may have noticed in the last + example that there is a missing operation - the pivot for the scale op + needs to be applied in its inverse-form as a final (most local) op! In the + AbcGeom::Xform schema, we would have encoded an actual "final" translation + op whose value was authored by the exporter as the negation of the pivot's + value. However, doing so would be brittle in USD, given that each op can + be independently overridden, and the constraint that one attribute must be + maintained as the negation of the other in order for successful + re-importation of the schema cannot be expressed in USD. + + Our solution leverages the **xformOpOrder** member of the schema, which, + in addition to ordering the ops, may also contain one of two special + tokens that address the paired op and "stack resetting" behavior. + + The "paired op" behavior is encoded as an "!invert!" prefix in + \\b xformOpOrder, as the result of an AddXformOp(isInverseOp=True) call. + The \\b xformOpOrder for the last example would look like: + \\code + uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale", "!invert!xformOp:translate:scalePivot" ] + \\endcode + + When asked for its value via UsdGeomXformOp::GetOpTransform(), an + "inverted" Op (i.e. the "inverted" half of a set of paired Ops) will fetch + the value of its paired attribute and return its negation. This works for + all op types - an error will be issued if a "transform" type op is singular + and cannot be inverted. When getting the authored value of an inverted op + via UsdGeomXformOp::Get(), the raw, uninverted value of the associated + attribute is returned. + + For the sake of robustness, setting a value on an inverted op is disallowed. + Attempting to set a value on an inverted op will result in a coding error + and no value being set. + + Resetting the Transform Stack + + The other special op/token that can appear in \\em xformOpOrder is + \\em "!resetXformStack!", which, appearing as the first element of + \\em xformOpOrder, indicates this prim should not inherit the transformation + of its namespace parent. See SetResetXformStack() + + Expected Behavior for "Missing" Ops + + If an importer expects Scale-Rotate-Translate operations, but a prim + has only translate and rotate ops authored, the importer should assume + an identity scale. This allows us to optimize the data a bit, if only + a few components of a very rich schema (like Maya's) are authored in the + app. + + \\anchor usdGeom_xformableExamples + Using the C++ API + + #1. Creating a simple transform matrix encoding + \\snippet examples_usdGeom.cpp CreateMatrixWithDefault + + #2. Creating the simple SRT from the example above + \\snippet examples_usdGeom.cpp CreateExampleSRT + + #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI + \\snippet examples_usdGeom.cpp CreateSRTWithDefaults + + #4. Creating a rotate-only pivot transform with animated + rotation and translation + \\snippet examples_usdGeom.cpp CreateAnimatedTransform + +""" +) { + + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Scope "Scope" ( + inherits = + doc = """Scope is the simplest grouping primitive, and does not carry the + baggage of transformability. Note that transforms should inherit down + through a Scope successfully - it is just a guaranteed no-op from a + transformability perspective.""" +) { +} + +class Xform "Xform" ( + inherits = + doc = """Concrete prim schema for a transform, which implements Xformable """ +) { +} + +class "Boundable" ( + inherits = + doc = """Boundable introduces the ability for a prim to persistently + cache a rectilinear, local-space, extent. + + \\section UsdGeom_Boundable_Extent Why Extent and not Bounds ? + Boundable introduces the notion of "extent", which is a cached computation + of a prim's local-space 3D range for its resolved attributes at the + layer and time in which extent is authored. We have found that with + composed scene description, attempting to cache pre-computed bounds at + interior prims in a scene graph is very fragile, given the ease with which + one can author a single attribute in a stronger layer that can invalidate + many authored caches - or with which a re-published, referenced asset can + do the same. + + Therefore, we limit to precomputing (generally) leaf-prim extent, which + avoids the need to read in large point arrays to compute bounds, and + provides UsdGeomBBoxCache the means to efficiently compute and + (session-only) cache intermediate bounds. You are free to compute and + author intermediate bounds into your scenes, of course, which may work + well if you have sufficient locks on your pipeline to guarantee that once + authored, the geometry and transforms upon which they are based will + remain unchanged, or if accuracy of the bounds is not an ironclad + requisite. + + When intermediate bounds are authored on Boundable parents, the child prims + will be pruned from BBox computation; the authored extent is expected to + incorporate all child bounds.""" +) +{ + # XXX: Note this is really a GfRange3f, which is not fully supported + # in Vt I/O. + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), \\em without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) +} + +class "Gprim" ( + inherits = + doc = """Base class for all geometric primitives. + + Gprim encodes basic graphical properties such as \\em doubleSided and + \\em orientation, and provides primvars for "display color" and "display + opacity" that travel with geometry to be used as shader overrides. """ + +) { + color3f[] primvars:displayColor ( + customData = { + string apiName = "displayColor" + } + doc = """It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a \\em displayColor parameter.""" + ) + + float[] primvars:displayOpacity ( + customData = { + string apiName = "displayOpacity" + } + doc = """Companion to \\em displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + + uniform bool doubleSided = false ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + \\em orientation. By doing so they can perform "backface culling" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's \\em doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see \\ref UsdGeom_WindingOrder for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) +} + +class Cube "Cube" ( + inherits = + doc = """Defines a primitive rectilinear cube centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double size = 2.0 ( + doc = """Indicates the length of each edge of the cube. If you + author \\em size you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cube only to provide a fallback value. + \\sa UsdGeomGprim::GetExtentAttr().""" + ) + +} + +class Sphere "Sphere" ( + inherits = + doc = """Defines a primitive sphere centered at the origin. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double radius = 1.0 ( + doc = """Indicates the sphere's radius. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Sphere only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cylinder "Cylinder" ( + inherits = + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified \\em axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2 ( + doc = """The size of the cylinder's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radius = 1.0 ( + doc = """The radius of the cylinder. If you author \\em radius + you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cylinder is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Capsule "Capsule" ( + inherits = + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, centered at the origin, whose spine is along the specified + \\em axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 1.0 ( + doc = """The length of the capsule's spine along the specified + \\em axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author \\em height you must also author \\em extent. + \\sa GetExtentAttr()""" + ) + double radius = 0.5 ( + doc = """The radius of the capsule. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the capsule is aligned""" + ) + + float3[] extent = [(-0.5, -0.5, -1.0), (0.5, 0.5, 1.0)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cone "Cone" ( + inherits = + doc = """Defines a primitive cone, centered at the origin, whose spine + is along the specified \\em axis, with the apex of the cone pointing + in the direction of the positive axis. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2.0 ( + doc = """The length of the cone's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radius = 1.0 ( + doc = """The radius of the cone. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cone is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cone only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Cylinder_1 "Cylinder_1" ( + inherits = + doc = """Defines a primitive cylinder with closed ends, centered at the + origin, whose spine is along the specified \\em axis, with a pair of radii + describing the size of the end points. + + The fallback values for Cube, Sphere, Cone, and Cylinder are set so that + they all pack into the same volume/bounds.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 2 ( + doc = """The length of the cylinder's spine along the specified + \\em axis. If you author \\em height you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusTop = 1.0 ( + doc = """The radius of the top of the cylinder - i.e. the face located + along the positive \\em axis. If you author \\em radiusTop you must also + author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusBottom = 1.0 ( + doc = """The radius of the bottom of the cylinder - i.e. the face + point located along the negative \\em axis. If you author + \\em radiusBottom you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the cylinder is aligned""" + ) + + float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( + doc = """Extent is re-defined on Cylinder only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Capsule_1 "Capsule_1" ( + inherits = + doc = """Defines a primitive capsule, i.e. a cylinder capped by two half + spheres, with potentially different radii, centered at the origin, and whose + spine is along the specified \\em axis. + The spherical cap heights (sagitta) of the two endcaps are a function of + the relative radii of the endcaps, such that cylinder tangent and sphere + tangent are coincident and maintain C1 continuity.""" + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + double height = 1.0 ( + doc = """The length of the capsule's spine along the specified + \\em axis excluding the size of the two half spheres, i.e. + the length of the cylinder portion of the capsule. + If you author \\em height you must also author \\em extent. + \\sa GetExtentAttr()""" + ) + double radiusTop = 0.5 ( + doc = """The radius of the capping sphere at the top of the capsule - + i.e. the sphere in the direction of the positive \\em axis. If you + author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + double radiusBottom = 0.5 ( + doc = """The radius of the capping sphere at the bottom of the capsule - + i.e. the sphere located in the direction of the negative \\em axis. If + you author \\em radius you must also author \\em extent. + + \\sa GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the spine of the capsule is aligned""" + ) + + float3[] extent = [(-0.5, -0.5, -1.0), (0.5, 0.5, 1.0)] ( + doc = """Extent is re-defined on Capsule only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class Plane "Plane" ( + inherits = + doc = """Defines a primitive plane, centered at the origin, and is defined by + a cardinal axis, width, and length. The plane is double-sided by default. + + The axis of width and length are perpendicular to the plane's \\em axis: + + axis | width | length + ----- | ------ | ------- + X | z-axis | y-axis + Y | x-axis | z-axis + Z | x-axis | y-axis + + """ + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + uniform bool doubleSided = true ( + doc = """Planes are double-sided by default. Clients may also support + single-sided planes. + + \\sa UsdGeomGprim::GetDoubleSidedAttr()""" + ) + double width = 2.0 ( + doc = """The width of the plane, which aligns to the x-axis when \\em axis is + 'Z' or 'Y', or to the z-axis when \\em axis is 'X'. If you author \\em width + you must also author \\em extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + double length = 2.0 ( + doc = """The length of the plane, which aligns to the y-axis when \\em axis is + 'Z' or 'X', or to the z-axis when \\em axis is 'Y'. If you author \\em length + you must also author \\em extent. + + \\sa UsdGeomGprim::GetExtentAttr()""" + ) + uniform token axis = "Z" ( + allowedTokens = ["X", "Y", "Z"] + doc = """The axis along which the surface of the plane is aligned. When set + to 'Z' the plane is in the xy-plane; when \\em axis is 'X' the plane is in + the yz-plane, and when \\em axis is 'Y' the plane is in the xz-plane. + + \\sa UsdGeomGprim::GetAxisAttr().""" + ) + float3[] extent = [(-1.0, -1.0, 0.0), (1.0, 1.0, 0.0)] ( + doc = """Extent is re-defined on Plane only to provide a fallback + value. \\sa UsdGeomGprim::GetExtentAttr().""" + ) +} + +class "PointBased" ( + doc = """Base class for all UsdGeomGprims that possess points, + providing common attributes such as normals and velocities.""" + + inherits = + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { + # positional + point3f[] points ( + doc = """The primary geometry attribute for all PointBased + primitives, describes points in (local) space.""" + ) + + vector3f[] velocities ( + doc = """If provided, 'velocities' should be used by renderers to + + compute positions between samples for the 'points' attribute, rather + than interpolating between neighboring 'points' samples. This is the + only reasonable means of computing motion blur for topologically + varying PointBased primitives. It follows that the length of each + 'velocities' sample must match the length of the corresponding + 'points' sample. Velocity is measured in position units per second, + as per most simulation software. To convert to position units per + UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeom_VelocityInterpolation .""" + ) + + vector3f[] accelerations ( + doc = """If provided, 'accelerations' should be used with + velocities to compute positions between samples for the 'points' + attribute rather than interpolating between neighboring 'points' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + + # shaping + normal3f[] normals ( + doc = """Provide an object-space orientation for individual points, + which, depending on subclass, may define a surface, curve, or free + points. Note that 'normals' should not be authored on any Mesh that + is subdivided, since the subdivision algorithm will define its own + normals. 'normals' is not a generic primvar, but the number of elements + in this attribute will be determined by its 'interpolation'. See + \\ref SetNormalsInterpolation() . If 'normals' and 'primvars:normals' + are both specified, the latter has precedence.""" + ) +} + +class Mesh "Mesh" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/timeCode.h" """ + } + doc="""Encodes a mesh with optional subdivision properties and features. + + As a point-based primitive, meshes are defined in terms of points that + are connected into edges and faces. Many references to meshes use the + term 'vertex' in place of or interchangeably with 'points', while some + use 'vertex' to refer to the 'face-vertices' that define a face. To + avoid confusion, the term 'vertex' is intentionally avoided in favor of + 'points' or 'face-vertices'. + + The connectivity between points, edges and faces is encoded using a + common minimal topological description of the faces of the mesh. Each + face is defined by a set of face-vertices using indices into the Mesh's + _points_ array (inherited from UsdGeomPointBased) and laid out in a + single linear _faceVertexIndices_ array for efficiency. A companion + _faceVertexCounts_ array provides, for each face, the number of + consecutive face-vertices in _faceVertexIndices_ that define the face. + No additional connectivity information is required or constructed, so + no adjacency or neighborhood queries are available. + + A key property of this mesh schema is that it encodes both subdivision + surfaces and simpler polygonal meshes. This is achieved by varying the + _subdivisionScheme_ attribute, which is set to specify Catmull-Clark + subdivision by default, so polygonal meshes must always be explicitly + declared. The available subdivision schemes and additional subdivision + features encoded in optional attributes conform to the feature set of + OpenSubdiv + (https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html). + + \\anchor UsdGeom_Mesh_Primvars + __A Note About Primvars__ + + The following list clarifies the number of elements for and the + interpolation behavior of the different primvar interpolation types + for meshes: + + - __constant__: One element for the entire mesh; no interpolation. + - __uniform__: One element for each face of the mesh; elements are + typically not interpolated but are inherited by other faces derived + from a given face (via subdivision, tessellation, etc.). + - __varying__: One element for each point of the mesh; + interpolation of point data is always linear. + - __vertex__: One element for each point of the mesh; + interpolation of point data is applied according to the + _subdivisionScheme_ attribute. + - __faceVarying__: One element for each of the face-vertices that + define the mesh topology; interpolation of face-vertex data may + be smooth or linear, according to the _subdivisionScheme_ and + _faceVaryingLinearInterpolation_ attributes. + + Primvar interpolation types and related utilities are described more + generally in \\ref Usd_InterpolationVals. + + \\anchor UsdGeom_Mesh_Normals + __A Note About Normals__ + + Normals should not be authored on a subdivision mesh, since subdivision + algorithms define their own normals. They should only be authored for + polygonal meshes (_subdivisionScheme_ = "none"). + + The _normals_ attribute inherited from UsdGeomPointBased is not a generic + primvar, but the number of elements in this attribute will be determined by + its _interpolation_. See \\ref UsdGeomPointBased::GetNormalsInterpolation() . + If _normals_ and _primvars:normals_ are both specified, the latter has + precedence. If a polygonal mesh specifies __neither__ _normals_ nor + _primvars:normals_, then it should be treated and rendered as faceted, + with no attempt to compute smooth normals. + + The normals generated for smooth subdivision schemes, e.g. Catmull-Clark + and Loop, will likewise be smooth, but others, e.g. Bilinear, may be + discontinuous between faces and/or within non-planar irregular faces.""" +) { + # + # Common Properties + # + int[] faceVertexIndices ( + doc = """Flat list of the index (into the _points_ attribute) of each + vertex of each face in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + + int[] faceVertexCounts ( + doc = """Provides the number of vertices in each face of the mesh, + which is also the number of consecutive indices in _faceVertexIndices_ + that define the face. The length of this attribute is the number of + faces in the mesh. If this attribute has more than + one timeSample, the mesh is considered to be topologically varying.""" + ) + + # + # Subdiv Properties + # + + uniform token subdivisionScheme = "catmullClark" ( + allowedTokens = ["catmullClark", "loop", "bilinear", "none"] + doc = """The subdivision scheme to be applied to the surface. + Valid values are: + + - __catmullClark__: The default, Catmull-Clark subdivision; preferred + for quad-dominant meshes (generalizes B-splines); interpolation + of point data is smooth (non-linear) + - __loop__: Loop subdivision; preferred for purely triangular meshes; + interpolation of point data is smooth (non-linear) + - __bilinear__: Subdivision reduces all faces to quads (topologically + similar to "catmullClark"); interpolation of point data is bilinear + - __none__: No subdivision, i.e. a simple polygonal mesh; interpolation + of point data is linear + + Polygonal meshes are typically lighter weight and faster to render, + depending on renderer and render mode. Use of "bilinear" will produce + a similar shape to a polygonal mesh and may offer additional guarantees + of watertightness and additional subdivision features (e.g. holes) but + may also not respect authored normals.""") + + token interpolateBoundary = "edgeAndCorner" ( + allowedTokens = ["none", "edgeOnly", "edgeAndCorner"] + doc = """Specifies how subdivision is applied for faces adjacent to + boundary edges and boundary points. Valid values correspond to choices + available in OpenSubdiv: + + - __none__: No boundary interpolation is applied and boundary faces are + effectively treated as holes + - __edgeOnly__: A sequence of boundary edges defines a smooth curve to + which the edges of subdivided boundary faces converge + - __edgeAndCorner__: The default, similar to "edgeOnly" but the smooth + boundary curve is made sharp at corner points + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#boundary-interpolation-rules""") + + token faceVaryingLinearInterpolation = "cornersPlus1" ( + allowedTokens = ["none", "cornersOnly", "cornersPlus1", + "cornersPlus2", "boundaries", "all"] + doc = """Specifies how elements of a primvar of interpolation type + "faceVarying" are interpolated for subdivision surfaces. Interpolation + can be as smooth as a "vertex" primvar or constrained to be linear at + features specified by several options. Valid values correspond to + choices available in OpenSubdiv: + + - __none__: No linear constraints or sharpening, smooth everywhere + - __cornersOnly__: Sharpen corners of discontinuous boundaries only, + smooth everywhere else + - __cornersPlus1__: The default, same as "cornersOnly" plus additional + sharpening at points where three or more distinct face-varying + values occur + - __cornersPlus2__: Same as "cornersPlus1" plus additional sharpening + at points with at least one discontinuous boundary corner or + only one discontinuous boundary edge (a dart) + - __boundaries__: Piecewise linear along discontinuous boundaries, + smooth interior + - __all__: Piecewise linear everywhere + + These are illustrated and described in more detail in the OpenSubdiv + documentation: + https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules""") + + token triangleSubdivisionRule = "catmullClark" ( + allowedTokens = ["catmullClark", "smooth"] + doc = """Specifies an option to the subdivision rules for the + Catmull-Clark scheme to try and improve undesirable artifacts when + subdividing triangles. Valid values are "catmullClark" for the + standard rules (the default) and "smooth" for the improvement. + + See https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle-subdivision-rule""") + + int[] holeIndices = [] ( + doc = """The indices of all faces that should be treated as holes, + i.e. made invisible. This is traditionally a feature of subdivision + surfaces and not generally applied to polygonal meshes.""") + + int[] cornerIndices = [] ( + doc = """The indices of points for which a corresponding sharpness + value is specified in _cornerSharpnesses_ (so the size of this array + must match that of _cornerSharpnesses_).""") + + float[] cornerSharpnesses = [] ( + doc = """The sharpness values associated with a corresponding set of + points specified in _cornerIndices_ (so the size of this array must + match that of _cornerIndices_). Use the constant `SHARPNESS_INFINITE` + for a perfectly sharp corner.""") + + int[] creaseIndices = [] ( + doc = """The indices of points grouped into sets of successive pairs + that identify edges to be creased. The size of this array must be + equal to the sum of all elements of the _creaseLengths_ attribute.""") + + int[] creaseLengths = [] ( + doc = """The length of this array specifies the number of creases + (sets of adjacent sharpened edges) on the mesh. Each element gives + the number of points of each crease, whose indices are successively + laid out in the _creaseIndices_ attribute. Since each crease must + be at least one edge long, each element of this array must be at + least two.""") + + float[] creaseSharpnesses = [] ( + doc = """The per-crease or per-edge sharpness values for all creases. + Since _creaseLengths_ encodes the number of points in each crease, + the number of elements in this array will be either len(creaseLengths) + or the sum over all X of (creaseLengths[X] - 1). Note that while + the RI spec allows each crease to have either a single sharpness + or a value per-edge, USD will encode either a single sharpness + per crease on a mesh, or sharpnesses for all edges making up + the creases on a mesh. Use the constant `SHARPNESS_INFINITE` for a + perfectly sharp crease.""") +} + +class TetMesh "TetMesh" ( + inherits = + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/timeCode.h" """ + } + doc="""Encodes a tetrahedral mesh. A tetrahedral mesh is defined as a set of + tetrahedra. Each tetrahedron is defined by a set of 4 points, with the + triangles of the tetrahedron determined from these 4 points as described in + the tetVertexIndices attribute description. The mesh surface faces + are encoded as triangles. Surface faces must be provided for consumers + that need to do surface calculations, such as renderers or consumers using + physics attachments. Both tetrahedra and surface face definitions use + indices into the TetMesh's points attribute, inherited from + UsdGeomPointBased.""" +) { + # + # Common Properties + # + int4[] tetVertexIndices ( + doc = """Flat list of the index (into the points attribute) of + each vertex of each tetrahedron in the mesh. Each int4 corresponds to the + indices of a single tetrahedron. Users should set the orientation + attribute of UsdGeomPrim accordingly. That is if the orientation + is "rightHanded", the CCW face ordering of a tetrahedron is + [123],[032],[013],[021] with respect to the int4. This results in the + normals facing outward from the center of the tetrahedron. The following + diagram shows the face ordering of an unwrapped tetrahedron with + "rightHanded" orientation. + + \\image html USDTetMeshRightHanded.svg + + If the orientation attribute is set to "leftHanded" the face + ordering of the tetrahedron is [321],[230],[310],[120] and the + leftHanded CW face normals point outward from the center of the + tetrahedron. The following diagram shows the face ordering of an + unwrapped tetrahedron with "leftHanded" orientation. + + \\image html USDTetMeshLeftHanded.svg + + Setting the orientation attribute to align with the + ordering of the int4 for the tetrahedrons is the responsibility of the + user.""" + ) + + int3[] surfaceFaceVertexIndices ( + doc = """surfaceFaceVertexIndices defines the triangle + surface faces indices wrt. points of the tetmesh surface. Again + the orientation attribute inherited from UsdGeomPrim should be + set accordingly. The orientation for faces of tetrahedra and + surface faces must match.""" + ) +} + +class GeomSubset "GeomSubset" ( + inherits = + doc = """Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) + as a set of indices. Currently supports encoding subsets of faces, + points, edges, and tetrahedrons. + + To apply to a geometric prim, a GeomSubset prim must be the prim's direct + child in namespace, and possess a concrete defining specifier (i.e. def). + This restriction makes it easy and efficient to discover subsets of a prim. + We might want to relax this restriction if it's common to have multiple + families of subsets on a gprim and if it's useful to be able to + organize subsets belonging to a family under a common scope. See + 'familyName' attribute for more info on defining a family of subsets. + + Note that a GeomSubset isn't an imageable (i.e. doesn't derive from + UsdGeomImageable). So, you can't author visibility for it or + override its purpose. + + Materials are bound to GeomSubsets just as they are for regular + geometry using API available in UsdShade (UsdShadeMaterial::Bind). +""" + customData = { + string className = "Subset" + string extraIncludes = """ +#include "pxr/base/tf/token.h" +#include "pxr/usd/usdGeom/imageable.h" +#include "pxr/usd/usdGeom/mesh.h" +#include "pxr/usd/usdGeom/tetMesh.h" +""" + } +) +{ + uniform token elementType = "face" ( + allowedTokens = ["face", "point", "edge", "tetrahedron"] + doc = """The type of element that the indices target. "elementType" can + have one of the following values: +
  • face: Identifies faces on a Gprim's surface. For a + UsdGeomMesh, each element of the _indices_ attribute would refer to + an element of the Mesh's _faceCounts_ attribute. For a UsdGeomTetMesh, + each element of the _indices_ attribute would refer to an element of + the Mesh's _surfaceFaceVertexIndices_ attribute.
  • +
  • point: for any UsdGeomPointBased, each + element of the _indices_ attribute would refer to an element of the + Mesh's _points_ attribute
  • +
  • edge: for any UsdGeomMesh, each pair of elements + in the _indices_ attribute would refer to a pair of points of the + Mesh's _points_ attribute that are connected as an implicit edge on the + Mesh. These edges are derived from the Mesh's _faceVertexIndices_ + attribute. Edges are not currently defined for a UsdGeomTetMesh, but + could be derived from all tetrahedron edges or surface face edges only + if a specific use-case arises.
  • +
  • tetrahedron: for any UsdGeomTetMesh, each element of the + _indices_ attribute would refer to an element of the TetMesh's + _tetVertexIndices_ attribute. +
""" + ) + int[] indices = [] ( + doc = """The set of indices included in this subset. The indices need not + be sorted, but the same index should not appear more than once. Indices + are invalid if outside the range [0, elementCount) for the given time on + the parent geometric prim.""" + ) + uniform token familyName = "" ( + doc = """The name of the family of subsets that this subset belongs to. + This is optional and is primarily useful when there are multiple + families of subsets under a geometric prim. In some cases, this could + also be used for achieving proper roundtripping of subset data between + DCC apps. + When multiple subsets belonging to a prim have the same familyName, they + are said to belong to the family. A familyType value can be + encoded on the owner of a family of subsets as a token using the static + method UsdGeomSubset::SetFamilyType(). "familyType" can have one of the + following values: +
  • UsdGeomTokens->partition: implies that every element of + the whole geometry appears exactly once in only one of the subsets + belonging to the family.
  • +
  • UsdGeomTokens->nonOverlapping: an element that appears in one + subset may not appear in any other subset belonging to the family, and + appears only once in the subset in which it appears.
  • +
  • UsdGeomTokens->unrestricted: implies that there are no + restrictions w.r.t. the membership of elements in the subsets. They + could be overlapping and the union of all subsets in the family may + not represent the whole.
  • +
+ \\note The validity of subset data is not enforced by the authoring + APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). + """ + ) +} + +class NurbsPatch "NurbsPatch" ( + inherits = + doc = """Encodes a rational or polynomial non-uniform B-spline + surface, with optional trim curves. + + The encoding mostly follows that of RiNuPatch and RiTrimCurve: + https://renderman.pixar.com/resources/RenderMan_20/geometricPrimitives.html#rinupatch , with some minor renaming and coalescing for clarity. + + The layout of control vertices in the \\em points attribute inherited + from UsdGeomPointBased is row-major with U considered rows, and V columns. + + \\anchor UsdGeom_NurbsPatch_Form + NurbsPatch Form + + The authored points, orders, knots, weights, and ranges are all that is + required to render the nurbs patch. However, the only way to model closed + surfaces with nurbs is to ensure that the first and last control points + along the given axis are coincident. Similarly, to ensure the surface is + not only closed but also C2 continuous, the last \\em order - 1 control + points must be (correspondingly) coincident with the first \\em order - 1 + control points, and also the spacing of the last corresponding knots + must be the same as the first corresponding knots. + + Form is provided as an aid to interchange between modeling and + animation applications so that they can robustly identify the intent with + which the surface was modelled, and take measures (if they are able) to + preserve the continuity/concidence constraints as the surface may be rigged + or deformed. + \\li An \\em open-form NurbsPatch has no continuity constraints. + \\li A \\em closed-form NurbsPatch expects the first and last control points + to overlap + \\li A \\em periodic-form NurbsPatch expects the first and last + \\em order - 1 control points to overlap. + + Nurbs vs Subdivision Surfaces + + Nurbs are an important modeling primitive in CAD/CAM tools and early + computer graphics DCC's. Because they have a natural UV parameterization + they easily support "trim curves", which allow smooth shapes to be + carved out of the surface. + + However, the topology of the patch is always rectangular, and joining two + nurbs patches together (especially when they have differing numbers of + spans) is difficult to do smoothly. Also, nurbs are not supported by + the Ptex texturing technology (http://ptex.us). + + Neither of these limitations are shared by subdivision surfaces; therefore, + although they do not subscribe to trim-curve-based shaping, subdivs are + often considered a more flexible modeling primitive. + """ +) { + int uVertexCount ( + doc = """Number of vertices in the U direction. Should be at least as + large as uOrder.""" + ) + + int vVertexCount ( + doc = """Number of vertices in the V direction. Should be at least as + large as vOrder.""" + ) + + int uOrder ( + doc = """Order in the U direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + + int vOrder ( + doc = """Order in the V direction. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1.""" + ) + + double[] uKnots ( + doc = """Knot vector for U direction providing U parameterization. + The length of this array must be ( uVertexCount + uOrder ), and its + entries must take on monotonically increasing values.""" + ) + + double[] vKnots ( + doc = """Knot vector for V direction providing U parameterization. + The length of this array must be ( vVertexCount + vOrder ), and its + entries must take on monotonically increasing values.""" + ) + + uniform token uForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = """Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the U dimension. + \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ + ) + + uniform token vForm = "open" ( + allowedTokens = ["open", "closed", "periodic"] + doc = """Interpret the control grid and knot vectors as representing + an open, geometrically closed, or geometrically closed and C2 continuous + surface along the V dimension. + \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ + ) + + # Alembic's NuPatch does not encode these... wonder how they + # get away with that? Just assume it's the full range, presumably. + double2 uRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by uKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of uKnots[uOrder-1]. The maxium must be less than or equal + to the last element's value in uKnots.""" + ) + + double2 vRange ( + doc = """Provides the minimum and maximum parametric values (as defined + by vKnots) over which the surface is actually defined. The minimum + must be less than the maximum, and greater than or equal to the + value of vKnots[vOrder-1]. The maxium must be less than or equal + to the last element's value in vKnots.""" + ) + + double[] pointWeights ( + doc = """Optionally provides "w" components for each control point, + thus must be the same length as the points attribute. If authored, + the patch will be rational. If unauthored, the patch will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the \\em points, but in this schema, + \\em points are not pre-weighted.""" + ) + + int[] trimCurve:counts ( + doc = """Each element specifies how many curves are present in each + "loop" of the trimCurve, and the length of the array determines how + many loops the trimCurve contains. The sum of all elements is the + total nuber of curves in the trim, to which we will refer as + \\em nCurves in describing the other trim attributes.""" + ) + + int[] trimCurve:orders ( + doc = """Flat list of orders for each of the \\em nCurves curves.""" + ) + + int[] trimCurve:vertexCounts ( + doc = """Flat list of number of vertices for each of the + \\em nCurves curves.""" + ) + + double[] trimCurve:knots ( + doc = """Flat list of parametric values for each of the + \\em nCurves curves. There will be as many knots as the sum over + all elements of \\em vertexCounts plus the sum over all elements of + \\em orders.""" + ) + + double2[] trimCurve:ranges ( + doc = """Flat list of minimum and maximum parametric values + (as defined by \\em knots) for each of the \\em nCurves curves.""" + ) + + double3[] trimCurve:points ( + doc = """Flat list of homogeneous 2D points (u, v, w) that comprise + the \\em nCurves curves. The number of points should be equal to the + um over all elements of \\em vertexCounts.""" + ) + +} + +class "Curves" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } + inherits = + doc = """Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and + UsdGeomHermiteCurves. The BasisCurves schema is designed to be + analagous to offline renderers' notion of batched curves (such as + the classical RIB definition via Basis and Curves statements), + while the NurbsCurve schema is designed to be analgous to the + NURBS curves found in packages like Maya and Houdini while + retaining their consistency with the RenderMan specification for + NURBS Patches. HermiteCurves are useful for the + interchange of animation guides and paths. + + It is safe to use the length of the curve vertex count to derive + the number of curves and the number and layout of curve vertices, + but this schema should NOT be used to derive the number of curve + points. While vertex indices are implicit in all shipped + descendent types of this schema, one should not assume that all + internal or future shipped schemas will follow this pattern. Be + sure to key any indexing behavior off the concrete type, not this + abstract type. + """ +) { + # topology attributes + int[] curveVertexCounts ( + doc = """Curves-derived primitives can represent multiple distinct, + potentially disconnected curves. The length of 'curveVertexCounts' + gives the number of such curves, and each element describes the + number of vertices in the corresponding curve""" + ) + + # shaping attributes + float[] widths ( + doc = """Provides width specification for the curves, whose application + will depend on whether the curve is oriented (normals are defined for + it), in which case widths are "ribbon width", or unoriented, in which + case widths are cylinder width. 'widths' is not a generic Primvar, + but the number of elements in this attribute will be determined by + its 'interpolation'. See \\ref SetWidthsInterpolation() . If 'widths' + and 'primvars:widths' are both specified, the latter has precedence.""" + ) +} + +class BasisCurves "BasisCurves" ( + inherits = + doc = """BasisCurves are a batched curve representation analogous to the + classic RIB definition via Basis and Curves statements. BasisCurves are + often used to render dense aggregate geometry like hair or grass. + + A 'matrix' and 'vstep' associated with the \\em basis are used to + interpolate the vertices of a cubic BasisCurves. (The basis attribute + is unused for linear BasisCurves.) + + A single prim may have many curves whose count is determined implicitly by + the length of the \\em curveVertexCounts vector. Each individual curve is + composed of one or more segments. Each segment is defined by four vertices + for cubic curves and two vertices for linear curves. See the next section + for more information on how to map curve vertex counts to segment counts. + + \\section UsdGeomBasisCurves_Segment Segment Indexing + Interpolating a curve requires knowing how to decompose it into its + individual segments. + + The segments of a cubic curve are determined by the vertex count, + the \\em wrap (periodicity), and the vstep of the basis. For linear + curves, the basis token is ignored and only the vertex count and + wrap are needed. + + cubic basis | vstep + ------------- | ------ + bezier | 3 + catmullRom | 1 + bspline | 1 + + The first segment of a cubic (nonperiodic) curve is always defined by its + first four points. The vstep is the increment used to determine what + vertex indices define the next segment. For a two segment (nonperiodic) + bspline basis curve (vstep = 1), the first segment will be defined by + interpolating vertices [0, 1, 2, 3] and the second segment will be defined + by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the + first segment will be defined by interpolating vertices [0, 1, 2, 3] and + the second segment will be defined by [3, 4, 5, 6]. If the vstep is not + one, then you must take special care to make sure that the number of cvs + properly divides by your vstep. (The indices described are relative to + the initial vertex index for a batched curve.) + + For periodic curves, at least one of the curve's initial vertices are + repeated to close the curve. For cubic curves, the number of vertices + repeated is '4 - vstep'. For linear curves, only one vertex is repeated + to close the loop. + + Pinned curves are a special case of nonperiodic curves that only affects + the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render + pinned curves, a client must effectively add 'phantom points' at the + beginning and end of every curve in a batch. These phantom points + are injected to ensure that the interpolated curve begins at P[0] and + ends at P[n-1]. + + For a curve with initial point P[0] and last point P[n-1], the phantom + points are defined as. + P[-1] = 2 * P[0] - P[1] + P[n] = 2 * P[n-1] - P[n-2] + + Pinned cubic curves will (usually) have to be unpacked into the standard + nonperiodic representation before rendering. This unpacking can add some + additional overhead. However, using pinned curves reduces the amount of + data recorded in a scene and (more importantly) better records the + authors' intent for interchange. + + \\note The additional phantom points mean that the minimum curve vertex + count for cubic bspline and catmullRom curves is 2. + + Linear curve segments are defined by two vertices. + A two segment linear curve's first segment would be defined by + interpolating vertices [0, 1]. The second segment would be defined by + vertices [1, 2]. (Again, for a batched curve, indices are relative to + the initial vertex index.) + + When validating curve topology, each renderable entry in the + curveVertexCounts vector must pass this check. + + type | wrap | validitity + ------- | --------------------------- | ---------------- + linear | nonperiodic | curveVertexCounts[i] > 2 + linear | periodic | curveVertexCounts[i] > 3 + cubic | nonperiodic | (curveVertexCounts[i] - 4) % vstep == 0 + cubic | periodic | (curveVertexCounts[i]) % vstep == 0 + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) >= 0 + + \\section UsdGeomBasisCurves_BasisMatrix Cubic Vertex Interpolation + + \\image html USDCurveBasisMatrix.png width=750 + + \\section UsdGeomBasisCurves_Linear Linear Vertex Interpolation + + Linear interpolation is always used on curves of type linear. + 't' with domain [0, 1], the curve is defined by the equation + P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes + the end point. + + \\section UsdGeomBasisCurves_PrimvarInterpolation Primvar Interpolation + + For cubic curves, primvar data can be either interpolated cubically between + vertices or linearly across segments. The corresponding token + for cubic interpolation is 'vertex' and for linear interpolation is + 'varying'. Per vertex data should be the same size as the number + of vertices in your curve. Segment varying data is dependent on the + wrap (periodicity) and number of segments in your curve. For linear curves, + varying and vertex data would be interpolated the same way. By convention + varying is the preferred interpolation because of the association of + varying with linear interpolation. + + \\image html USDCurvePrimvars.png + + To convert an entry in the curveVertexCounts vector into a segment count + for an individual curve, apply these rules. Sum up all the results in + order to compute how many total segments all curves have. + + The following tables describe the expected segment count for the 'i'th + curve in a curve batch as well as the entire batch. Python syntax + like '[:]' (to describe all members of an array) and 'len(...)' + (to describe the length of an array) are used. + + type | wrap | curve segment count | batch segment count + ------- | --------------------------- | -------------------------------------- | -------------------------- + linear | nonperiodic | curveVertexCounts[i] - 1 | sum(curveVertexCounts[:]) - len(curveVertexCounts) + linear | periodic | curveVertexCounts[i] | sum(curveVertexCounts[:]) + cubic | nonperiodic | (curveVertexCounts[i] - 4) / vstep + 1 | sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) + cubic | periodic | curveVertexCounts[i] / vstep | sum(curveVertexCounts[:]) / vstep + cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) + 1 | sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) + + The following table descrives the expected size of varying + (linearly interpolated) data, derived from the segment counts computed + above. + + wrap | curve varying count | batch varying count + ------------------- | ---------------------------- | ------------------------------------------------ + nonperiodic/pinned | segmentCounts[i] + 1 | sum(segmentCounts[:]) + len(curveVertexCounts) + periodic | segmentCounts[i] | sum(segmentCounts[:]) + + Both curve types additionally define 'constant' interpolation for the + entire prim and 'uniform' interpolation as per curve data. + + + \\note Take care when providing support for linearly interpolated data for + cubic curves. Its shape doesn't provide a one to one mapping with either + the number of curves (like 'uniform') or the number of vertices (like + 'vertex') and so it is often overlooked. This is the only primitive in + UsdGeom (as of this writing) where this is true. For meshes, while they + use different interpolation methods, 'varying' and 'vertex' are both + specified per point. It's common to assume that curves follow a similar + pattern and build in structures and language for per primitive, per + element, and per point data only to come upon these arrays that don't + quite fit into either of those categories. It is + also common to conflate 'varying' with being per segment data and use the + segmentCount rules table instead of its neighboring varying data table + rules. We suspect that this is because for the common case of + nonperiodic cubic curves, both the provided segment count and varying data + size formula end with '+ 1'. While debugging, users may look at the double + '+ 1' as a mistake and try to remove it. We take this time to enumerate + these issues because we've fallen into them before and hope that we save + others time in their own implementations. + + As an example of deriving per curve segment and varying primvar data counts from + the wrap, type, basis, and curveVertexCount, the following table is provided. + + wrap | type | basis | curveVertexCount | curveSegmentCount | varyingDataCount + ------------- | ------- | ------- | ----------------- | ------------------ | ------------------------- + nonperiodic | linear | N/A | [2 3 2 5] | [1 2 1 4] | [2 3 2 5] + nonperiodic | cubic | bezier | [4 7 10 4 7] | [1 2 3 1 2] | [2 3 4 2 3] + nonperiodic | cubic | bspline | [5 4 6 7] | [2 1 3 4] | [3 2 4 5] + periodic | cubic | bezier | [6 9 6] | [2 3 2] | [2 3 2] + periodic | linear | N/A | [3 7] | [3 7] | [3 7] + + \\section UsdGeomBasisCurves_TubesAndRibbons Tubes and Ribbons + + The strictest definition of a curve as an infinitely thin wire is not + particularly useful for describing production scenes. The additional + \\em widths and \\em normals attributes can be used to describe cylindrical + tubes and or flat oriented ribbons. + + Curves with only widths defined are imaged as tubes with radius + 'width / 2'. Curves with both widths and normals are imaged as ribbons + oriented in the direction of the interpolated normal vectors. + + While not technically UsdGeomPrimvars, widths and normals + also have interpolation metadata. It's common for authored widths to have + constant, varying, or vertex interpolation + (see UsdGeomCurves::GetWidthsInterpolation()). It's common for + authored normals to have varying interpolation + (see UsdGeomPointBased::GetNormalsInterpolation()). + + \\image html USDCurveHydra.png + + The file used to generate these curves can be found in + extras/usd/examples/usdGeomExamples/basisCurves.usda. It's provided + as a reference on how to properly image both tubes and ribbons. The first + row of curves are linear; the second are cubic bezier. (We aim in future + releases of HdSt to fix the discontinuity seen with broken tangents to + better match offline renderers like RenderMan.) The yellow and violet + cubic curves represent cubic vertex width interpolation for which there is + no equivalent for linear curves. + + \\note How did this prim type get its name? This prim is a portmanteau of + two different statements in the original RenderMan specification: + 'Basis' and 'Curves'. +""" +) { + # interpolation attributes + uniform token type = "cubic" ( + allowedTokens = ["linear", "cubic"] + doc = """Linear curves interpolate linearly between two vertices. + Cubic curves use a basis matrix with four vertices to interpolate a segment.""") + + uniform token basis = "bezier" ( + allowedTokens = ["bezier", "bspline", "catmullRom"] + doc = """The basis specifies the vstep and matrix used for cubic + interpolation. \\note The 'hermite' and 'power' tokens have been + removed. We've provided UsdGeomHermiteCurves + as an alternative for the 'hermite' basis.""") + + uniform token wrap = "nonperiodic" ( + allowedTokens = ["nonperiodic", "periodic", "pinned"] + doc = """If wrap is set to periodic, the curve when rendered will + repeat the initial vertices (dependent on the vstep) to close the + curve. If wrap is set to 'pinned', phantom points may be created + to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. + """) +} + +class NurbsCurves "NurbsCurves" ( + inherits = + doc = """This schema is analagous to NURBS Curves in packages like Maya + and Houdini, often used for interchange of rigging and modeling curves. + Unlike Maya, this curve spec supports batching of multiple curves into a + single prim, widths, and normals in the schema. Additionally, we require + 'numSegments + 2 * degree + 1' knots (2 more than maya does). This is to + be more consistent with RenderMan's NURBS patch specification. + + To express a periodic curve: + - knot[0] = knot[1] - (knots[-2] - knots[-3]; + - knot[-1] = knot[-2] + (knot[2] - knots[1]); + + To express a nonperiodic curve: + - knot[0] = knot[1]; + - knot[-1] = knot[-2]; + + In spite of these slight differences in the spec, curves generated in Maya + should be preserved when roundtripping. + + \\em order and \\em range, when representing a batched NurbsCurve should be + authored one value per curve. \\em knots should be the concatentation of + all batched curves.""" +) { + # topology attributes + int[] order = [] ( + doc = """Order of the curve. Order must be positive and is + equal to the degree of the polynomial basis to be evaluated, plus 1. + Its value for the 'i'th curve must be less than or equal to + curveVertexCount[i]""") + + # interpolation attributes + double[] knots ( + doc = """Knot vector providing curve parameterization. + The length of the slice of the array for the ith curve + must be ( curveVertexCount[i] + order[i] ), and its + entries must take on monotonically increasing values.""") + + double2[] ranges ( + doc = """Provides the minimum and maximum parametric values (as defined + by knots) over which the curve is actually defined. The minimum must + be less than the maximum, and greater than or equal to the value of the + knots['i'th curve slice][order[i]-1]. The maxium must be less + than or equal to the last element's value in knots['i'th curve slice]. + Range maps to (vmin, vmax) in the RenderMan spec.""") + + double[] pointWeights ( + doc = """Optionally provides "w" components for each control point, + thus must be the same length as the points attribute. If authored, + the curve will be rational. If unauthored, the curve will be + polynomial, i.e. weight for all points is 1.0. + \\note Some DCC's pre-weight the \\em points, but in this schema, + \\em points are not pre-weighted.""" + ) +} + +class Points "Points" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } + inherits = + doc = """Points are analogous to the RiPoints spec. + + Points can be an efficient means of storing and rendering particle + effects comprised of thousands or millions of small particles. Points + generally receive a single shading sample each, which should take + \\em normals into account, if present. + + While not technically UsdGeomPrimvars, the widths and normals also + have interpolation metadata. It's common for authored widths and normals + to have constant or varying interpolation.""" + +) { + # shaping attributes + float[] widths ( + doc = """Widths are defined as the \\em diameter of the points, in + object space. 'widths' is not a generic Primvar, but + the number of elements in this attribute will be determined by + its 'interpolation'. See \\ref SetWidthsInterpolation() . If + 'widths' and 'primvars:widths' are both specified, the latter + has precedence.""" + ) + + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the points array, specifying (at each timesample if + point identities are changing) the id of each point. The + type is signed intentionally, so that clients can encode some + binary state on Id'd points without adding a separate + primvar.""" + ) +} + +class PointInstancer "PointInstancer" ( + doc = """Encodes vectorized instancing of multiple, potentially + animated, prototypes (object/instance masters), which can be arbitrary + prims/subtrees on a UsdStage. + + PointInstancer is a "multi instancer", as it allows multiple prototypes + to be scattered among its "points". We use a UsdRelationship + \\em prototypes to identify and order all of the possible prototypes, by + targeting the root prim of each prototype. The ordering imparted by + relationships associates a zero-based integer with each prototype, and + it is these integers we use to identify the prototype of each instance, + compactly, and allowing prototypes to be swapped out without needing to + reauthor all of the per-instance data. + + The PointInstancer schema is designed to scale to billions of instances, + which motivates the choice to split the per-instance transformation into + position, (quaternion) orientation, and scales, rather than a + 4x4 matrix per-instance. In addition to requiring fewer bytes even if + all elements are authored (32 bytes vs 64 for a single-precision 4x4 + matrix), we can also be selective about which attributes need to animate + over time, for substantial data reduction in many cases. + + Note that PointInstancer is \\em not a Gprim, since it is not a graphical + primitive by any stretch of the imagination. It \\em is, however, + Boundable, since we will sometimes want to treat the entire PointInstancer + similarly to a procedural, from the perspective of inclusion or framing. + + \\section UsdGeomPointInstancer_varyingTopo Varying Instance Identity over Time + + PointInstancers originating from simulations often have the characteristic + that points/instances are "born", move around for some time period, and then + die (or leave the area of interest). In such cases, billions of instances + may be birthed over time, while at any \\em specific time, only a much + smaller number are actually alive. To encode this situation efficiently, + the simulator may re-use indices in the instance arrays, when a particle + dies, its index will be taken over by a new particle that may be birthed in + a much different location. This presents challenges both for + identity-tracking, and for motion-blur. + + We facilitate identity tracking by providing an optional, animatable + \\em ids attribute, that specifies the 64 bit integer ID of the particle + at each index, at each point in time. If the simulator keeps monotonically + increasing a particle-count each time a new particle is birthed, it will + serve perfectly as particle \\em ids. + + We facilitate motion blur for varying-topology particle streams by + optionally allowing per-instance \\em velocities and \\em angularVelocities + to be authored. If instance transforms are requested at a time between + samples and either of the velocity attributes is authored, then we will + not attempt to interpolate samples of \\em positions or \\em orientations. + If not authored, and the bracketing samples have the same length, then we + will interpolate. + + \\section UsdGeomPointInstancer_transform Computing an Instance Transform + + Each instance's transformation is a combination of the SRT affine transform + described by its scale, orientation, and position, applied \\em after + (i.e. less locally than) the local to parent transformation computed at + the root of the prototype it is instancing. + + If your processing of prototype geometry naturally takes into account the + transform of the prototype root, then this term can be omitted from the + computation of each instance transform, and this can be controlled when + computing instance transformation matrices using the + UsdGeomPointInstancer::PrototypeXformInclusion enumeration. + + To understand the computation of the instance transform, in order to put + an instance of a PointInstancer into the space of the PointInstancer's + parent prim we do the following: + + 1. Apply (most locally) the authored local to parent transformation for + prototypes[protoIndices[i]] + 2. If *scales* is authored, next apply the scaling matrix from *scales[i]* + 3. If *orientations* is authored: **if *angularVelocities* is authored**, + first multiply *orientations[i]* by the unit quaternion derived by scaling + *angularVelocities[i]* by the \\ref UsdGeom_PITimeScaling "time differential" + from the left-bracketing timeSample for *orientation* to the requested + evaluation time *t*, storing the result in *R*, **else** assign *R* + directly from *orientations[i]*. Apply the rotation matrix derived + from *R*. + 4. Apply the translation derived from *positions[i]*. If *velocities* is + authored, apply the translation deriving from *velocities[i]* scaled by + the time differential from the left-bracketing timeSample for *positions* + to the requested evaluation time *t*. + 5. Least locally, apply the transformation authored on the PointInstancer + prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the + PointInstancer to put the instance directly into world space) + + If neither *velocities* nor *angularVelocities* are authored, we fallback to + standard position and orientation computation logic (using linear + interpolation between timeSamples) as described by + \\ref UsdGeom_VelocityInterpolation . + + \\anchor UsdGeom_PITimeScaling + Scaling Velocities for Interpolation + + When computing time-differentials by which to apply velocity or + angularVelocity to positions or orientations, we must scale by + ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded + in units/second, while we are interpolating in UsdTimeCode ordinates. + + We provide both high and low-level API's for dealing with the + transformation as a matrix, both will compute the instance matrices using + multiple threads; the low-level API allows the client to cache unvarying + inputs so that they need not be read duplicately when computing over + time. + + See also \\ref UsdGeom_VelocityInterpolation . + + \\section UsdGeomPointInstancer_primvars Primvars on PointInstancer + + \\ref UsdGeomPrimvar "Primvars" authored on a PointInstancer prim should + always be applied to each instance with \\em constant interpolation at + the root of the instance. When you are authoring primvars on a + PointInstancer, think about it as if you were authoring them on a + point-cloud (e.g. a UsdGeomPoints gprim). The same + interpolation rules for points apply here, substituting + "instance" for "point". + + In other words, the (constant) value extracted for each instance + from the authored primvar value depends on the authored \\em interpolation + and \\em elementSize of the primvar, as follows: + \\li constant or uniform : the entire authored value of the + primvar should be applied exactly to each instance. + \\li varying, vertex, or faceVarying: the first + \\em elementSize elements of the authored primvar array should be assigned to + instance zero, the second \\em elementSize elements should be assigned to + instance one, and so forth. + + + \\section UsdGeomPointInstancer_masking Masking Instances: "Deactivating" and Invising + + Often a PointInstancer is created "upstream" in a graphics pipeline, and + the needs of "downstream" clients necessitate eliminating some of the + instances from further consideration. Accomplishing this pruning by + re-authoring all of the per-instance attributes is not very attractive, + since it may mean destructively editing a large quantity of data. We + therefore provide means of "masking" instances by ID, such that the + instance data is unmolested, but per-instance transform and primvar data + can be retrieved with the no-longer-desired instances eliminated from the + (smaller) arrays. PointInstancer allows two independent means of masking + instances by ID, each with different features that meet the needs of + various clients in a pipeline. Both pruning features' lists of ID's are + combined to produce the mask returned by ComputeMaskAtTime(). + + \\note If a PointInstancer has no authored \\em ids attribute, the masking + features will still be available, with the integers specifying element + position in the \\em protoIndices array rather than ID. + + \\subsection UsdGeomPointInstancer_inactiveIds InactiveIds: List-edited, Unvarying Masking + + The first masking feature encodes a list of IDs in a list-editable metadatum + called \\em inactiveIds, which, although it does not have any similar + impact to stage population as \\ref UsdPrim::SetActive() "prim activation", + it shares with that feature that its application is uniform over all time. + Because it is list-editable, we can \\em sparsely add and remove instances + from it in many layers. + + This sparse application pattern makes \\em inactiveIds a good choice when + further downstream clients may need to reverse masking decisions made + upstream, in a manner that is robust to many kinds of future changes to + the upstream data. + + See ActivateId(), ActivateIds(), DeactivateId(), DeactivateIds(), + ActivateAllIds() + + \\subsection UsdGeomPointInstancer_invisibleIds invisibleIds: Animatable Masking + + The second masking feature encodes a list of IDs in a time-varying + Int64Array-valued UsdAttribute called \\em invisibleIds , since it shares + with \\ref UsdGeomImageable::GetVisibilityAttr() "Imageable visibility" + the ability to animate object visibility. + + Unlike \\em inactiveIds, overriding a set of opinions for \\em invisibleIds + is not at all straightforward, because one will, in general need to + reauthor (in the overriding layer) **all** timeSamples for the attribute + just to change one Id's visibility state, so it cannot be authored + sparsely. But it can be a very useful tool for situations like encoding + pre-computed camera-frustum culling of geometry when either or both of + the instances or the camera is animated. + + See VisId(), VisIds(), InvisId(), InvisIds(), VisAllIds() + + \\section UsdGeomPointInstancer_protoProcessing Processing and Not Processing Prototypes + + Any prim in the scenegraph can be targeted as a prototype by the + \\em prototypes relationship. We do not, however, provide a specific + mechanism for identifying prototypes as geometry that should not be drawn + (or processed) in their own, local spaces in the scenegraph. We + encourage organizing all prototypes as children of the PointInstancer + prim that consumes them, and pruning "raw" processing and drawing + traversals when they encounter a PointInstancer prim; this is what the + UsdGeomBBoxCache and UsdImaging engines do. + + There \\em is a pattern one can deploy for organizing the prototypes + such that they will automatically be skipped by basic UsdPrim::GetChildren() + or UsdPrimRange traversals. Usd prims each have a + \\ref Usd_PrimSpecifiers "specifier" of "def", "over", or "class". The + default traversals skip over prims that are "pure overs" or classes. So + to protect prototypes from all generic traversals and processing, place + them under a prim that is just an "over". For example, + \\code + 01 def PointInstancer "Crowd_Mid" + 02 { + 03 rel prototypes = [ , ] + 04 + 05 over "Prototypes" + 06 { + 07 def "MaleThin_Business" ( + 08 references = [@MaleGroupA/usd/MaleGroupA.usd@] + 09 variants = { + 10 string modelingVariant = "Thin" + 11 string costumeVariant = "BusinessAttire" + 12 } + 13 ) + 14 { ... } + 15 + 16 def "MaleThin_Casual" + 17 ... + 18 } + 19 } + \\endcode + """ + + inherits = + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + dictionary schemaTokens = { + dictionary inactiveIds = { + string doc = """int64listop prim metadata that specifies + the PointInstancer ids that should be masked (unrenderable) + over all time.""" + } + } + } +) { + rel prototypes ( + doc = """Required property. Orders and targets the prototype root + prims, which can be located anywhere in the scenegraph that is convenient, + although we promote organizing prototypes as children of the + PointInstancer. The position of a prototype in this relationship defines + the value an instance would specify in the \\em protoIndices attribute to + instance that prototype. Since relationships are uniform, this property + cannot be animated.""" + ) + + int[] protoIndices ( + doc = """Required property. Per-instance index into + \\em prototypes relationship that identifies what geometry should be + drawn for each instance. Topology attribute - can be animated, + but at a potential performance impact for streaming.""" + ) + + int64[] ids ( + doc = """Ids are optional; if authored, the ids array should be the same + length as the \\em protoIndices array, specifying (at each timeSample if + instance identities are changing) the id of each instance. The + type is signed intentionally, so that clients can encode some + binary state on Id'd instances without adding a separate primvar. + See also \\ref UsdGeomPointInstancer_varyingTopo""" + ) + + point3f[] positions ( + doc = """Required property. Per-instance position. See also + \\ref UsdGeomPointInstancer_transform .""" + ) + + quath[] orientations ( + doc="""If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, which + allows us to encode it with sufficient precision in a compact GfQuath. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the "better (for interpolation + with respect to neighboring samples)" of the two possible quaternions + that encode the rotation. + + See also \\ref UsdGeomPointInstancer_transform .""" ) + + quatf[] orientationsf ( + doc="""If authored, per-instance orientation of each instance about its + prototype's origin, represented as a unit length quaternion, encoded + as a GfQuatf to support higher precision computations. + + It is client's responsibility to ensure that authored quaternions are + unit length; the convenience API below for authoring orientations from + rotation matrices will ensure that quaternions are unit length, though + it will not make any attempt to select the "better (for interpolation + with respect to neighboring samples)" of the two possible quaternions + that encode the rotation. Note that if the earliest time sample (or + default value if there are no time samples) of orientationsf is not empty + orientationsf will be preferred over orientations if both are authored. + + See also \\ref UsdGeomPointInstancer_transform .""" ) + + float3[] scales ( + doc="""If authored, per-instance scale to be applied to + each instance, before any rotation is applied. + + See also \\ref UsdGeomPointInstancer_transform .""" + ) + + vector3f[] velocities ( + doc = """If provided, per-instance 'velocities' will be used to + compute positions between samples for the 'positions' attribute, + rather than interpolating between neighboring 'positions' samples. + Velocities should be considered mandatory if both \\em protoIndices + and \\em positions are animated. Velocity is measured in position + units per second, as per most simulation software. To convert to + position units per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeomPointInstancer_transform, + \\ref UsdGeom_VelocityInterpolation .""" + ) + + vector3f[] accelerations ( + doc = """If authored, per-instance 'accelerations' will be used with + velocities to compute positions between samples for the 'positions' + attribute rather than interpolating between neighboring 'positions' + samples. Acceleration is measured in position units per second-squared. + To convert to position units per squared UsdTimeCode, divide by the + square of UsdStage::GetTimeCodesPerSecond().""" + ) + + vector3f[] angularVelocities ( + doc="""If authored, per-instance angular velocity vector to be used for + interoplating orientations. Angular velocities should be considered + mandatory if both \\em protoIndices and \\em orientations are animated. + Angular velocity is measured in degrees per second. To convert + to degrees per UsdTimeCode, divide by + UsdStage::GetTimeCodesPerSecond(). + + See also \\ref UsdGeomPointInstancer_transform .""" + ) + + int64[] invisibleIds = [] ( + doc="""A list of id's to make invisible at the evaluation time. + See \\ref UsdGeomPointInstancer_invisibleIds .""" + ) +} + + +class Camera "Camera" ( + doc = """Transformable camera. + + Describes optical properties of a camera via a common set of attributes + that provide control over the camera's frustum as well as its depth of + field. For stereo, the left and right camera are individual prims tagged + through the \\ref UsdGeomCamera::GetStereoRoleAttr() "stereoRole attribute". + + There is a corresponding class GfCamera, which can hold the state of a + camera (at a particular time). \\ref UsdGeomCamera::GetCamera() and + \\ref UsdGeomCamera::SetFromCamera() convert between a USD camera prim and + a GfCamera. + + To obtain the camera's location in world space, call the following on a + UsdGeomCamera 'camera': + \\code + GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); + \\endcode + \\note + Cameras in USD are always "Y up", regardless of the stage's orientation + (i.e. UsdGeomGetStageUpAxis()). This means that the inverse of + 'camXform' (the VIEW half of the MODELVIEW transform in OpenGL parlance) + will transform the world such that the camera is at the origin, looking + down the -Z axis, with +Y as the up axis, and +X pointing to the right. + This describes a __right handed coordinate system__. + + \\section UsdGeom_CameraUnits Units of Measure for Camera Properties + + Despite the familiarity of millimeters for specifying some physical + camera properties, UsdGeomCamera opts for greater consistency with all + other UsdGeom schemas, which measure geometric properties in scene units, + as determined by UsdGeomGetStageMetersPerUnit(). We do make a + concession, however, in that lens and filmback properties are measured in + __tenths of a scene unit__ rather than "raw" scene units. This means + that with the fallback value of .01 for _metersPerUnit_ - i.e. scene unit + of centimeters - then these "tenth of scene unit" properties are + effectively millimeters. + + \\note If one adds a Camera prim to a UsdStage whose scene unit is not + centimeters, the fallback values for filmback properties will be + incorrect (or at the least, unexpected) in an absolute sense; however, + proper imaging through a "default camera" with focusing disabled depends + only on ratios of the other properties, so the camera is still usable. + However, it follows that if even one property is authored in the correct + scene units, then they all must be. + + + \\sa \\ref UsdGeom_LinAlgBasics + """ + inherits = + customData = { + string extraIncludes = """ +#include "pxr/base/gf/camera.h" """ + } +) { + # viewing frustum + token projection = "perspective" ( + allowedTokens = ["perspective", "orthographic"]) + float horizontalAperture = 20.9550 ( + doc = """Horizontal aperture in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits . Default is the equivalent of + the standard 35mm spherical projector aperture.""") + float verticalAperture = 15.2908 ( + doc = """Vertical aperture in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits . Default is the equivalent of + the standard 35mm spherical projector aperture.""") + float horizontalApertureOffset = 0.0 ( + doc = """Horizontal aperture offset in the same units as + horizontalAperture. Defaults to 0.""") + float verticalApertureOffset = 0.0 ( + doc = """Vertical aperture offset in the same units as + verticalAperture. Defaults to 0.""") + float focalLength = 50.0 ( + doc = """Perspective focal length in tenths of a scene unit; see + \\ref UsdGeom_CameraUnits .""") + float2 clippingRange = (1, 1000000) ( + doc = """Near and far clipping distances in scene units; see + \\ref UsdGeom_CameraUnits .""") + float4[] clippingPlanes = [] ( + doc = """Additional, arbitrarily oriented clipping planes. + A vector (a,b,c,d) encodes a clipping plane that cuts off + (x,y,z) with a * x + b * y + c * z + d * 1 < 0 where (x,y,z) + are the coordinates in the camera's space.""") + + # depth of field + float fStop = 0.0 ( + doc = """Lens aperture. Defaults to 0.0, which turns off focusing.""") + float focusDistance = 0.0 ( + doc = """Distance from the camera to the focus plane in scene units; see + \\ref UsdGeom_CameraUnits .""") + + # stereoscopic 3D + uniform token stereoRole = "mono" ( + allowedTokens = ["mono", "left", "right"] + doc = """If different from mono, the camera is intended to be the left + or right camera of a stereo setup.""") + + # Parameters for motion blur + double shutter:open = 0.0 ( + doc = """Frame relative shutter open time in UsdTimeCode units (negative + value indicates that the shutter opens before the current + frame time). Used for motion blur.""" + ) + double shutter:close = 0.0 ( + doc = """Frame relative shutter close time, analogous comments from + shutter:open apply. A value greater or equal to shutter:open + should be authored, otherwise there is no exposure and a + renderer should produce a black image.""" + ) + + # exposure adjustment + float exposure = 0.0 ( + doc = """Exposure adjustment, as a log base-2 value. The default + of 0.0 has no effect. A value of 1.0 will double the + image-plane intensities in a rendered image; a value of + -1.0 will halve them.""" + ) +} + +class "GeomModelAPI" +( + inherits = + customData = { + string className = "ModelAPI" + string extraIncludes = """ +#include "pxr/usd/usdGeom/bboxCache.h" +#include "pxr/usd/usdGeom/constraintTarget.h" +#include "pxr/usd/usdGeom/imageable.h" """ + dictionary schemaTokens = { + dictionary extentsHint = { + string doc = """Name of the attribute used to author extents + hints at the root of leaf models. Extents hints are stored by purpose + as a vector of GfVec3f values. They are ordered based on the order + of purpose tokens returned by + UsdGeomImageable::GetOrderedPurposeTokens.""" + } + } + } + doc = """UsdGeomModelAPI extends the generic UsdModelAPI schema with + geometry specific concepts such as cached extents for the entire model, + constraint targets, and geometry-inspired extensions to the payload + lofting process. + + As described in GetExtentsHint() below, it is useful to cache extents + at the model level. UsdGeomModelAPI provides schema for computing and + storing these cached extents, which can be consumed by UsdGeomBBoxCache to + provide fast access to precomputed extents that will be used as the model's + bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). + + \\section UsdGeomModelAPI_drawMode Draw Modes + + Draw modes provide optional alternate imaging behavior for USD subtrees with + kind model. \\em model:drawMode (which is inheritable) and + \\em model:applyDrawMode (which is not) are resolved into a decision to stop + traversing the scene graph at a certain point, and replace a USD subtree + with proxy geometry. + + The value of \\em model:drawMode determines the type of proxy geometry: + - \\em origin - Draw the model-space basis vectors of the replaced prim. + - \\em bounds - Draw the model-space bounding box of the replaced prim. + - \\em cards - Draw textured quads as a placeholder for the replaced prim. + - \\em default - An explicit opinion to draw the USD subtree as normal. + - \\em inherited - Defer to the parent opinion. + + \\em model:drawMode falls back to _inherited_ so that a whole scene, + a large group, or all prototypes of a model hierarchy PointInstancer can + be assigned a draw mode with a single attribute edit. If no draw mode is + explicitly set in a hierarchy, the resolved value is _default_. + + \\em model:applyDrawMode is meant to be written when an asset is authored, + and provides flexibility for different asset types. For example, + a character assembly (composed of character, clothes, etc) might have + \\em model:applyDrawMode set at the top of the subtree so the whole group + can be drawn as a single card object. An effects subtree might have + \\em model:applyDrawMode set at a lower level so each particle + group draws individually. + + Models of kind component are automatically treated as if + \\em model:applyDrawMode were true if \\em model:applyDrawMode is not + authored on the component prim. A component prim will be drawn drawn with a + simplified representation when the prim has kind component, + \\em model:applyDrawMode is not authored (or authored to be true), and the + resolved (i.e. inherited down namespace) value for \\em model:drawMode is + not _default_. If you don't want component prims to use the resolved + non-default drawMode, you must apply the UsdGeomModelAPI schema on the prim + and explicitly set \\em model:applyDrawMode to false. + + \\section UsdGeomModelAPI_cardGeometry Cards Geometry + + The specific geometry used in cards mode is controlled by the + \\em model:cardGeometry attribute: + - \\em cross - Generate a quad normal to each basis direction and negative. + Locate each quad so that it bisects the model extents. + - \\em box - Generate a quad normal to each basis direction and negative. + Locate each quad on a face of the model extents, facing out. + - \\em fromTexture - Generate a quad for each supplied texture from + attributes stored in that texture's metadata. + + For \\em cross and \\em box mode, the extents are calculated for purposes + \\em default, \\em proxy, and \\em render, at their earliest authored time. + If the model has no textures, all six card faces are rendered using + \\em model:drawModeColor. If one or more textures are present, only axes + with one or more textures assigned are drawn. For each axis, if both + textures (positive and negative) are specified, they'll be used on the + corresponding card faces; if only one texture is specified, it will be + mapped to the opposite card face after being flipped on the texture's + s-axis. Any card faces with invalid asset paths will be drawn with + \\em model:drawModeColor. + + Both \\em model:cardGeometry and \\em model:drawModeColor should be + authored on the prim where the draw mode takes effect, since these + attributes are not inherited. + + For \\em fromTexture mode, only card faces with valid textures assigned + are drawn. The geometry is generated by pulling the \\em worldtoscreen + attribute out of texture metadata. This is expected to be a 4x4 matrix + mapping the model-space position of the card quad to the clip-space quad + with corners (-1,-1,0) and (1,1,0). The card vertices are generated by + transforming the clip-space corners by the inverse of \\em worldtoscreen. + Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. + If the metadata cannot be read in the right format, or the matrix can't + be inverted, the card face is not drawn. + + All card faces are drawn and textured as single-sided. + + \\todo CreatePayload() """ +) +{ + uniform token model:drawMode = "inherited" ( + allowedTokens = ["origin", "bounds", "cards", "default", "inherited"] + doc = """Alternate imaging mode; applied to this prim or child prims + where \\em model:applyDrawMode is true, or where the prim + has kind \\em component and \\em model:applyDrawMode is not + authored. See \\ref UsdGeomModelAPI_drawMode + for mode descriptions.""" + ) + uniform bool model:applyDrawMode = false ( + doc = """If true, and the resolved value of \\em model:drawMode is + non-default, apply an alternate imaging mode to this prim. See + \\ref UsdGeomModelAPI_drawMode.""" + ) + uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ( + doc = """The base color of imaging prims inserted for alternate + imaging modes. For \\em origin and \\em bounds modes, this + controls line color; for \\em cards mode, this controls the + fallback quad color.""" + ) + uniform token model:cardGeometry = "cross" ( + allowedTokens = ["cross", "box", "fromTexture"] + doc = """The geometry to generate for imaging prims inserted for \\em + cards imaging mode. See \\ref UsdGeomModelAPI_cardGeometry for + geometry descriptions.""" + ) + asset model:cardTextureXPos ( + doc = """In \\em cards imaging mode, the texture applied to the X+ quad. + The texture axes (s,t) are mapped to model-space axes (-y, -z).""" + ) + asset model:cardTextureYPos ( + doc = """In \\em cards imaging mode, the texture applied to the Y+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -z).""" + ) + asset model:cardTextureZPos ( + doc = """In \\em cards imaging mode, the texture applied to the Z+ quad. + The texture axes (s,t) are mapped to model-space axes (x, -y).""" + ) + asset model:cardTextureXNeg ( + doc = """In \\em cards imaging mode, the texture applied to the X- quad. + The texture axes (s,t) are mapped to model-space axes (y, -z).""" + ) + asset model:cardTextureYNeg ( + doc = """In \\em cards imaging mode, the texture applied to the Y- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -z).""" + ) + asset model:cardTextureZNeg ( + doc = """In \\em cards imaging mode, the texture applied to the Z- quad. + The texture axes (s,t) are mapped to model-space axes (-x, -y).""" + ) +} + +class "MotionAPI" +( + inherits = + doc = """UsdGeomMotionAPI encodes data that can live on any prim that + may affect computations involving: + - computed motion for motion blur + - sampling for motion blur + + The \\ref GetMotionBlurScaleAttr() "motion:blurScale" attribute allows + artists to scale the __amount__ of motion blur to be rendered for parts + of the scene without changing the recorded animation. See + \\ref UsdGeomMotionAPI_blurScale for use and implementation details. + + """ +) +{ + float motion:blurScale = 1.0 ( + doc = """BlurScale is an __inherited__ float attribute that stipulates + the rendered motion blur (as typically specified via UsdGeomCamera's + _shutter:open_ and _shutter:close_ properties) should be scaled for + __all objects__ at and beneath the prim in namespace on which the + _motion:blurScale_ value is specified. + + Without changing any other data in the scene, _blurScale_ allows artists to + "dial in" the amount of blur on a per-object basis. A _blurScale_ + value of zero removes all blur, a value of 0.5 reduces blur by half, + and a value of 2.0 doubles the blur. The legal range for _blurScale_ + is [0, inf), although very high values may result in extremely expensive + renders, and may exceed the capabilities of some renderers. + + Although renderers are free to implement this feature however they see + fit, see \\ref UsdGeomMotionAPI_blurScale for our guidance on implementing + the feature universally and efficiently. + + \\sa ComputeMotionBlurScale() + """ + ) + + float motion:velocityScale = 1.0 ( + customData = { + string apiName = "velocityScale" + } + doc = """\\deprecated + + VelocityScale is an **inherited** float attribute that + velocity-based schemas (e.g. PointBased, PointInstancer) can consume + to compute interpolated positions and orientations by applying + velocity and angularVelocity, which is required for interpolating + between samples when topology is varying over time. Although these + quantities are generally physically computed by a simulator, sometimes + we require more or less motion-blur to achieve the desired look. + VelocityScale allows artists to dial-in, as a post-sim correction, + a scale factor to be applied to the velocity prior to computing + interpolated positions from it.""" + ) + + int motion:nonlinearSampleCount = 3 ( + customData = { + string apiName = "nonlinearSampleCount" + } + doc = """Determines the number of position or transformation samples + created when motion is described by attributes contributing non-linear + terms. + + To give an example, imagine an application (such as a + renderer) consuming 'points' and the USD document also + contains 'accelerations' for the same prim. Unless the + application can consume these 'accelerations' itself, an + intermediate layer has to compute samples within the sampling + interval for the point positions based on the value of + 'points', 'velocities' and 'accelerations'. The number of these + samples is given by 'nonlinearSampleCount'. The samples are + equally spaced within the sampling interval. + + Another example involves the PointInstancer where + 'nonlinearSampleCount' is relevant when 'angularVelocities' + or 'accelerations' are authored. + + 'nonlinearSampleCount' is an **inherited** attribute, also + see ComputeNonlinearSampleCount()""" + ) +} + +class "XformCommonAPI" +( + inherits = + doc = """This class provides API for authoring and retrieving a standard set + of component transformations which include a scale, a rotation, a + scale-rotate pivot and a translation. The goal of the API is to enhance + component-wise interchange. It achieves this by limiting the set of allowed + basic ops and by specifying the order in which they are applied. In addition + to the basic set of ops, the 'resetXformStack' bit can also be set to + indicate whether the underlying xformable resets the parent transformation + (i.e. does not inherit it's parent's transformation). + + \\sa UsdGeomXformCommonAPI::GetResetXformStack() + \\sa UsdGeomXformCommonAPI::SetResetXformStack() + + The operator-bool for the class will inform you whether an existing + xformable is compatible with this API. + + The scale-rotate pivot is represented by a pair of (translate, + inverse-translate) xformOps around the scale and rotate operations. + The rotation operation can be any of the six allowed Euler angle sets. + \\sa UsdGeomXformOp::Type. + + The xformOpOrder of an xformable that has all of the supported basic ops + is as follows: + ["xformOp:translate", "xformOp:translate:pivot", "xformOp:rotateXYZ", + "xformOp:scale", "!invert!xformOp:translate:pivot"]. + + It is worth noting that all of the ops are optional. For example, an + xformable may have only a translate or a rotate. It would still be + considered as compatible with this API. Individual SetTranslate(), + SetRotate(), SetScale() and SetPivot() methods are provided by this API + to allow such sparse authoring.""" + customData = { + string apiSchemaType = "nonApplied" + string extraIncludes = """ +#include "pxr/usd/usdGeom/xformable.h" +#include "pxr/usd/usdGeom/xformOp.h" """ + dictionary schemaTokens = { + dictionary pivot = { + string doc = """Op suffix for the standard scale-rotate pivot + on a UsdGeomXformCommonAPI-compatible prim. + """ + } + } + } +) +{ +} + +class HermiteCurves "HermiteCurves" ( + inherits = + doc = """This schema specifies a cubic hermite interpolated curve batch as + sometimes used for defining guides for animation. While hermite curves can + be useful because they interpolate through their control points, they are + not well supported by high-end renderers for imaging. Therefore, while we + include this schema for interchange, we strongly recommend the use of + UsdGeomBasisCurves as the representation of curves intended to be rendered + (ie. hair or grass). Hermite curves can be converted to a Bezier + representation (though not from Bezier back to Hermite in general). + + \\section UsdGeomHermiteCurves_Interpolation Point Interpolation + + The initial cubic curve segment is defined by the first two points and + first two tangents. Additional segments are defined by additional + point / tangent pairs. The number of segments for each non-batched hermite + curve would be len(curve.points) - 1. The total number of segments + for the batched UsdGeomHermiteCurves representation is + len(points) - len(curveVertexCounts). + + \\section UsdGeomHermiteCurves_Primvars Primvar, Width, and Normal Interpolation + + Primvar interpolation is not well specified for this type as it is not + intended as a rendering representation. We suggest that per point + primvars would be linearly interpolated across each segment and should + be tagged as 'varying'. + + It is not immediately clear how to specify cubic or 'vertex' interpolation + for this type, as we lack a specification for primvar tangents. This + also means that width and normal interpolation should be restricted to + varying (linear), uniform (per curve element), or constant (per prim). + """ +) { + vector3f[] tangents = [] ( + doc = """Defines the outgoing trajectory tangent for each point. + Tangents should be the same size as the points attribute.""") +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "HydraGenerativeProceduralAPI" ( + doc = """ + This API extends and configures the core UsdProcGenerativeProcedural schema + defined within usdProc for use with hydra generative procedurals as defined + within hdGp. + """ +) +{ + token primvars:hdGp:proceduralType ( + doc = """The registered name of a HdGpGenerativeProceduralPlugin to + be executed.""" + ) + token proceduralSystem = "hydraGenerativeProcedural" ( + doc = ''' + This value should correspond to a configured instance of + HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the + procedural. The default value of "hydraGenerativeProcedural" matches + the equivalent default of HdGpGenerativeProceduralResolvingSceneIndex. + Multiple instances of the scene index can be used to determine where + within a scene index chain a given procedural will be evaluated. + ''' + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdHydraDiscoveryPlugin": { + "bases": [ + "NdrDiscoveryPlugin" + ], + "displayName": "Discovery plugin for deprecated hydra shaders." + }, + "UsdHydraGenerativeProceduralAPI": { + "alias": { + "UsdSchemaBase": "HydraGenerativeProceduralAPI" + }, + "apiSchemaCanOnlyApplyTo": [ + "GenerativeProcedural" + ], + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + } + } + }, + "LibraryPath": "", + "Name": "usdHydra", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 + +def Shader "HwPtexTexture_1" ( + sdrMetadata = { + token role = "texture" + token isPtex = "1" + } +) +{ + uniform token info:id = "HwPtexTexture_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + token inputs:faceIndexPrimvar = "ptexFaceIndex" ( + sdrMetadata = { + token primvarProperty = "1" + } + ) + + token inputs:faceOffsetPrimvar = "ptexFaceOffset" ( + sdrMetadata = { + token primvarProperty = "1" + } + ) + + asset inputs:file = @@ ( + doc = "Asset path to the file containg the image data." + ) + + float inputs:frame ( + doc = "The frame offset for animated textures." + ) + + float inputs:textureMemory ( + doc = """Amount of memory used to store the texture (in Mb). A value of + zero specifies the native resolution.""" + ) + + int inputs:faceIndex ( + doc = """The Ptex face index from which to sample. By default, this + parameter will be bound to the ptexFaceIndex primvar.""" + ) + + int inputs:faceOffset ( + doc = """The Ptex face offset to be applied to the face index. By + default, this parameter will be bound to the ptexFaceOffset primvar.""" + ) + + float outputs:r ( + doc = "Outputs the red channel." + sdrMetadata = { + token swizzle = "x" + } + ) + + float outputs:g ( + doc = "Outputs the green channel." + sdrMetadata = { + token swizzle = "y" + } + ) + + float outputs:b ( + doc = "Outputs the blue channnel." + sdrMetadata = { + token swizzle = "z" + } + ) + + float outputs:a ( + doc = "Outputs the alpha channnel." + sdrMetadata = { + token swizzle = "w" + } + ) + + float3 outputs:rgb ( + doc = "Outputs the red, green and blue channels." + sdrMetadata = { + token swizzle = "xyz" + } + ) + + float4 outputs:rgba ( + doc = "Outputs all 4 channels (red, green, blue and alpha)." + sdrMetadata = { + token swizzle = "xyzw" + } + ) +} + +def Shader "HwUvTexture_1" ( + sdrMetadata = { + token role = "texture" + token primvars = "uv" + } +) +{ + uniform token info:id = "HwUvTexture_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + asset inputs:file = @@ ( + doc = "Asset path to the file containg the image data." + ) + + float inputs:frame ( + doc = "The frame offset for animated textures." + ) + + float inputs:textureMemory ( + doc = """Amount of memory used to store the texture (in Mb). A value of + zero specifies the native resolution.""" + ) + + float2 inputs:uv ( + doc = "The uv coordinates at which to sample the texture." + ) + + token inputs:wrapS ( + allowedTokens = ["clamp", "repeat", "mirror", "black"] + doc = "Specifies the wrap mode for this texture." + ) + + token inputs:wrapT ( + allowedTokens = ["clamp", "repeat", "mirror", "black"] + doc = "Specifies the wrap mode for this texture." + ) + + token inputs:minFilter ( + allowedTokens = ["nearest", "linear", + "linearMipmapLinear", "linearMipmapNearest", + "nearestMipmapLinear", "nearestMipmapNearest" ] + doc = "Specifies the minification filter mode for this texture." + ) + + token inputs:magFilter ( + allowedTokens = ["nearest", "linear"] + doc = "Specifies the magnification filter mode for this texture." + ) + + float4 inputs:fallback = (0.0, 0.0, 0.0, 1.0) ( + doc = """Fallback value to be used when no texture is connected.""" + sdrMetadata = { + token defaultInput = "1" + } + ) +} + +def Shader "HwFieldReader_1" ( + sdrMetadata = { + token role = "field" + } + doc = """Samples from a usdVol FieldAsset.""" +) +{ + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + uniform token info:implementationSource = "sourceAsset" + token inputs:fieldname = "" ( + connectability = "interfaceOnly" + doc = """Name of the field to be fetched from volume + (e.g., FOO if the relationship from the volume to field is called field::FOO).""" + sdrMetadata = { + token fieldProperty = "1" + } + ) +} + +def Shader "HwFieldReader_float" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float" + float inputs:fallback = 0 ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float outputs:result ( + sdrMetadata = { + token swizzle = "x" + } + ) +} + +def Shader "HwFieldReader_float2" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float2" + float2 inputs:fallback = (0, 0) ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float2 outputs:result ( + sdrMetadata = { + token swizzle = "xy" + } + ) +} + +def Shader "HwFieldReader_float3" ( + inherits = +) +{ + uniform token info:id = "HwFieldReader_float3" + float3 inputs:fallback = (0, 0, 0) ( + doc = "Fallback value to be returned when fetch failed." + sdrMetadata = { + token defaultInput = "1" + } + ) + float3 outputs:result ( + sdrMetadata = { + token swizzle = "xyz" + } + ) +} + +def Shader "HwPrimvar_1" ( + sdrMetadata = { + token role = "primvar" + } +) +{ + uniform token info:id = "HwPrimvar_1" + uniform token info:implementationSource = "sourceAsset" + + # Add a dummy sourceAsset attribute with sourceType="glslfx", so that + # an entry gets created for this deprecated shader in the registry. + uniform asset info:glslfx:sourceAsset = @./empty.glslfx@ + + token inputs:varname = "" ( + sdrMetadata = { + bool primvarProperty = 1 + } + doc = """The name of the primvar. Note that on the gprim, this primvar + must follow the standard UsdGeom primvar declaration. + Further note that this name should not contain the UsdGeom primvar + namespace prefix. + """ + ) +} +#usda 1.0 +( + "This file describes the Pixar-specific USD Geometric schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdHydra" + string libraryPath = "pxr/usd/usdHydra" + dictionary libraryTokens = { + + dictionary HwPrimvar_1 = { + string doc = """The id value of a Primvar shader.""" + } + + dictionary HwPtexTexture_1 = { + string doc = """The id value of a PtexTexture shader.""" + } + + dictionary HwUvTexture_1 = { + string doc = """The id value of a UvTexture shader.""" + } + + dictionary displayLookBxdf = { + string value = "displayLook:bxdf" + string doc = """\deprecated This has been deprecated in favor of + the glslfx:surface output. + + Relationship on a material that targets the "bxdf" or the + surface shader prim.""" + } + + dictionary infoFilename = { + string value = "inputs:file" + string doc = """ The special "info:filename" property of a hydra + Texture shader, which points to a resolvable texture asset.""" + } + + + dictionary infoVarname = { + string value = "inputs:varname" + string doc = """ + """ + } + + dictionary textureMemory = { + string doc = """A shader input on a hydra Texture shader.""" + } + + dictionary frame = { + string doc = """A shader input on a "Texture" shader.""" + } + + dictionary uv = { + string doc = """A shader input on a hydra UvTexture shader.""" + } + + dictionary wrapS = { + string doc = """A shader input on a hydra UvTexture shader which + defines the behavior of texture coordinates that are outside the + bounds of the texture.""" + } + + + dictionary wrapT = { + string doc = """A shader input on a hydra UvTexture shader which + defines the behavior of texture coordinates that are outside the + bounds of the texture.""" + } + + dictionary black = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes black to be returned when sampling outside the bounds of + the texture.""" + } + + dictionary clamp = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the the texture coordinate to be clamped to [0,1].""" + } + + dictionary mirror = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the texture coordinate to wrap around like a mirror. -0.2 + becomes 0.2, -1.2 becomes 0.8, etc. ,""" + } + + dictionary repeat = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the texture coordinate to wrap around the texture. So a + texture coordinate of -0.2 becomes the equivalent of 0.8.""" + } + + dictionary useMetadata = { + string doc = """Possible value for "wrapT" and "wrapS" inputs on + a "UvTexture" shader prim. + Causes the wrap value to be loaded from the texture file instead + of being specified in the prim. If the texture file doesn't + support metadata or the metadata doesn't contain a wrap mode, + the "black" wrap mode is used.""" + } + + dictionary magFilter = { + string doc = """An input on a UvTexture shader.""" + } + + dictionary minFilter = { + string doc = """An input on a UvTexture shader.""" + } + + dictionary linearMipmapLinear = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object , + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary linearMipmapNearest = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary nearestMipmapNearest = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for the "minFilter" input on a UvTexture shader. + """ + } + + dictionary linear = { + string doc = """A weighted linear blend of nearest adjacent + samples. + Possible value for "minFilter" and "magFilter" inputs on a + UvTextureshader.""" + } + + dictionary nearest = { + string doc = """Selects the nearest sample for the given + coordinate + Possible value for "minFilter" and "magFilter" inputs on a + UvTexture shader.""" + } + + dictionary nearestMipmapLinear = { + string doc = """See https://www.opengl.org/wiki/Sampler_Object + Possible value for "minFilter" and "magFilter" inputs on a + UvTexture shader.""" + } + + dictionary faceIndex = { + string doc = """The "faceIndex" shader input on a hydra + "PtexTexture" shader.""" + } + + dictionary faceOffset = { + string doc = """The "faceOffset" shader input on a hydra + "PtexTexture" shader.""" + } + } + } +){ +} + +class "HydraGenerativeProceduralAPI" ( + inherits = + doc = """ + This API extends and configures the core UsdProcGenerativeProcedural schema + defined within usdProc for use with hydra generative procedurals as defined + within hdGp. + """ + customData = { + string className = "GenerativeProceduralAPI" + token[] apiSchemaCanOnlyApplyTo = ["GenerativeProcedural"] + } +){ + token primvars:hdGp:proceduralType ( + doc = """The registered name of a HdGpGenerativeProceduralPlugin to + be executed.""" + + customData = { + string apiName = "proceduralType" + } + ) + + token proceduralSystem = "hydraGenerativeProcedural" ( + doc = """ + This value should correspond to a configured instance of + HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the + procedural. The default value of "hydraGenerativeProcedural" matches + the equivalent default of HdGpGenerativeProceduralResolvingSceneIndex. + Multiple instances of the scene index can be used to determine where + within a scene index chain a given procedural will be evaluated. + """ + ) +} +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "faceIndexPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "ptexFaceIndex", + "documentation": "Specifies an array of face indices used for ptex mapping", + "type": "token" + }, + "faceOffsetPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "ptexFaceOffset", + "documentation": "Specifies the ptex face index offset for aggregated ptex files", + "type": "token" + }, + "uvPrimvar": { + "appliesTo": [ + "attributes" + ], + "default": "", + "documentation": "Specifies the UV primvar for texture mapping", + "type": "token" + } + }, + "Types": { + "UsdImagingBasisCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "BasisCurves" + }, + "UsdImagingCameraAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "Camera" + }, + "UsdImagingCapsuleAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "includeSchemaFamily": true, + "primTypeName": "Capsule" + }, + "UsdImagingCollectionAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "CollectionAPI" + }, + "UsdImagingConeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Cone" + }, + "UsdImagingCoordSysAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "coordSys" + }, + "UsdImagingCoordSysAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "CoordSysAPI" + }, + "UsdImagingCubeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Cube" + }, + "UsdImagingCylinderAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "includeSchemaFamily": true, + "primTypeName": "Cylinder" + }, + "UsdImagingDrawModeAdapter" : { + "bases": ["UsdImagingInstanceablePrimAdapter"], + "isInternal": true, + "primTypeName": "__drawModeAdapter" + }, + "UsdImagingGeomSubsetAdapter" : { + "bases": ["UsdImagingPrimAdapter"], + "isInternal": true, + "primTypeName": "GeomSubset" + }, + "UsdImagingHermiteCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "HermiteCurves" + }, + "UsdImagingMaterialAdapter" : { + "bases": ["UsdImagingPrimAdapter"], + "isInternal": true, + "primTypeName": "Material" + }, + + "UsdImagingShaderAdapter" : { + "bases": ["UsdImagingRepresentedByAncestorPrimAdapter"], + "isInternal": true, + "primTypeName": "Shader" + }, + + "UsdImagingNodeGraphAdapter" : { + "bases": ["UsdImagingRepresentedByAncestorPrimAdapter"], + "isInternal": true, + "primTypeName": "NodeGraph" + }, + + "UsdImagingMaterialBindingAPIAdapter" : { + "bases": ["UsdImagingAPISchemaAdapter"], + "isInternal": true, + "apiSchemaName": "MaterialBindingAPI" + }, + "UsdImagingMeshAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Mesh" + }, + "UsdImagingTetMeshAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "TetMesh" + }, + "UsdImagingNurbsCurvesAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "NurbsCurves" + }, + "UsdImagingNurbsPatchAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "NurbsPatch" + }, + "UsdImagingPlaneAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Plane" + }, + "UsdImagingPointsAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Points" + }, + "UsdImagingPointInstancerAdapter": { + "bases": [ + "UsdImagingInstanceablePrimAdapter" + ], + "isInternal": true, + "primTypeName": "PointInstancer" + }, + "UsdImagingSphereAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Sphere" + }, + "UsdImagingRenderSettingsAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderSettings" + }, + "UsdImagingRenderProductAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderProduct" + }, + "UsdImagingRenderVarAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "RenderVar" + }, + "UsdImagingVolumeAdapter": { + "bases": [ + "UsdImagingGprimAdapter" + ], + "isInternal": true, + "primTypeName": "Volume" + }, + "UsdImagingLightAdapter": { + "bases": [ + "UsdImagingInstanceablePrimAdapter" + ], + "isInternal": true, + "primTypeName": "LightAPI", + "includeDerivedPrimTypes" : true + }, + "UsdImagingLightAPIAdapter": { + "bases": [ + "UsdImagingAPISchemaAdapter" + ], + "isInternal": true, + "apiSchemaName": "LightAPI" + }, + "UsdImagingLightFilterAdapter": { + "bases": [ + "UsdImagingPrimAdapter" + ], + "isInternal": true, + "primTypeName": "LightFilter", + "includeDerivedPrimTypes" : true + }, + "UsdImagingDomeLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DomeLight" + }, + "UsdImagingDomeLight_1Adapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DomeLight_1" + }, + "UsdImagingRectLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "RectLight" + }, + "UsdImagingSphereLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "SphereLight" + }, + "UsdImagingCylinderLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "CylinderLight" + }, + "UsdImagingDiskLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DiskLight" + }, + "UsdImagingDistantLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "DistantLight" + }, + "UsdImagingPluginLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "PluginLight" + }, + "UsdImagingGeometryLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "GeometryLight" + }, + "UsdImagingPortalLightAdapter": { + "bases": [ + "UsdImagingLightAdapter" + ], + "isInternal": true, + "primTypeName": "PortalLight" + }, + "UsdImagingPluginLightFilterAdapter": { + "bases": [ + "UsdImagingLightFilterAdapter" + ], + "isInternal": true, + "primTypeName": "PluginLightFilter" + }, + "UsdImagingGeomModelAPIAdapter": { + "bases": [ + "UsdImagingAPISchemaAdapter" + ], + "isInternal": true, + "apiSchemaName": "GeomModelAPI" + } + } + }, + "LibraryPath": "", + "Name": "usdImaging", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "LightAPI" ( + apiSchemas = ["CollectionAPI:lightLink", "CollectionAPI:shadowLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:lightLink:includeRoot", "collection:shadowLink:includeRoot"] + } + doc = """API schema that imparts the quality of being a light onto a prim. + + A light is any prim that has this schema applied to it. This is true + regardless of whether LightAPI is included as a built-in API of the prim + type (e.g. RectLight or DistantLight) or is applied directly to a Gprim + that should be treated as a light. + + Linking + + Lights can be linked to geometry. Linking controls which geometry + a light illuminates, and which geometry casts shadows from the light. + + Linking is specified as collections (UsdCollectionAPI) which can + be accessed via GetLightLinkCollection() and GetShadowLinkCollection(). + Note that these collections have their includeRoot set to true, + so that lights will illuminate and cast shadows from all objects + by default. To illuminate only a specific set of objects, there + are two options. One option is to modify the collection paths + to explicitly exclude everything else, assuming it is known; + the other option is to set includeRoot to false and explicitly + include the desired objects. These are complementary approaches + that may each be preferable depending on the scenario and how + to best express the intent of the light setup. + """ +) +{ + uniform bool collection:lightLink:includeRoot = 1 + uniform bool collection:shadowLink:includeRoot = 1 + color3f inputs:color = (1, 1, 1) ( + displayGroup = "Basic" + displayName = "Color" + doc = "The color of emitted light, in energy-linear terms." + ) + float inputs:colorTemperature = 6500 ( + displayGroup = "Basic" + displayName = "Color Temperature" + doc = """Color temperature, in degrees Kelvin, representing the + white point. The default is a common white point, D65. Lower + values are warmer and higher values are cooler. The valid range + is from 1000 to 10000. Only takes effect when + enableColorTemperature is set to true. When active, the + computed result multiplies against the color attribute. + See UsdLuxBlackbodyTemperatureAsRgb().""" + ) + float inputs:diffuse = 1 ( + displayGroup = "Refine" + displayName = "Diffuse Multiplier" + doc = """A multiplier for the effect of this light on the diffuse + response of materials. This is a non-physical control.""" + ) + bool inputs:enableColorTemperature = 0 ( + displayGroup = "Basic" + displayName = "Enable Color Temperature" + doc = "Enables using colorTemperature." + ) + float inputs:exposure = 0 ( + displayGroup = "Basic" + displayName = "Exposure" + doc = """Scales the power of the light exponentially as a power + of 2 (similar to an F-stop control over exposure). The result + is multiplied against the intensity.""" + ) + float inputs:intensity = 1 ( + displayGroup = "Basic" + displayName = "Intensity" + doc = "Scales the power of the light linearly." + ) + bool inputs:normalize = 0 ( + displayGroup = "Advanced" + displayName = "Normalize Power" + doc = """Normalizes power by the surface area of the light. + This makes it easier to independently adjust the power and shape + of the light, by causing the power to not vary with the area or + angular size of the light.""" + ) + float inputs:specular = 1 ( + displayGroup = "Refine" + displayName = "Specular Multiplier" + doc = """A multiplier for the effect of this light on the specular + response of materials. This is a non-physical control.""" + ) + rel light:filters ( + doc = "Relationship to the light filters that apply to this light." + ) + uniform token light:materialSyncMode = "noMaterialResponse" ( + allowedTokens = ["materialGlowTintsLight", "independent", "noMaterialResponse"] + displayGroup = "Geometry" + displayName = "Material Sync Mode" + doc = """For a LightAPI applied to geometry that has a bound Material, + which is entirely or partly emissive, this specifies the relationship + of the Material response to the lighting response. + Valid values are: + - materialGlowTintsLight: All primary and secondary rays see the + emissive/glow response as dictated by the bound Material while the + base color seen by light rays (which is then modulated by all of the + other LightAPI controls) is the multiplication of the color feeding + the emission/glow input of the Material (i.e. its surface or volume + shader) with the scalar or pattern input to *inputs:color*. + This allows the light's color to tint the geometry's glow color while + preserving access to intensity and other light controls as ways to + further modulate the illumination. + - independent: All primary and secondary rays see the emissive/glow + response as dictated by the bound Material, while the base color seen + by light rays is determined solely by *inputs:color*. Note that for + partially emissive geometry (in which some parts are reflective + rather than emissive), a suitable pattern must be connected to the + light's color input, or else the light will radiate uniformly from + the geometry. + - noMaterialResponse: The geometry behaves as if there is no Material + bound at all, i.e. there is no diffuse, specular, or transmissive + response. The base color of light rays is entirely controlled by the + *inputs:color*. This is the standard mode for \"canonical\" lights in + UsdLux and indicates to renderers that a Material will either never + be bound or can always be ignored. + """ + ) + uniform token light:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light's shader. + This defines the shader ID for this light when a render context specific + shader ID is not available. + + The default shaderId for the intrinsic UsdLux lights (RectLight, + DistantLight, etc.) are set to default to the light's type name. For + each intrinsic UsdLux light, we will always register an SdrShaderNode in + the SdrRegistry, with the identifier matching the type name and the + source type \"USD\", that corresponds to the light's inputs. + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) +} + +class "MeshLightAPI" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:materialSyncMode", "light:shaderId"] + } + doc = '''This is the preferred API schema to apply to + "Mesh" type prims when adding light behaviors to a mesh. + At its base, this API schema has the built-in behavior of applying LightAPI + to the mesh and overriding the default materialSyncMode to allow the + emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "mesh lights" through the creation of API schemas which are + authored to auto-apply to MeshLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + ''' +) +{ + uniform token light:materialSyncMode = "materialGlowTintsLight" + uniform token light:shaderId = "MeshLight" +} + +class "VolumeLightAPI" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:materialSyncMode", "light:shaderId"] + } + doc = '''This is the preferred API schema to apply to + "Volume" type prims when adding light behaviors to a + volume. At its base, this API schema has the built-in behavior of applying + LightAPI to the volume and overriding the default materialSyncMode to allow + the emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "volume lights" through the creation of API schemas which are + authored to auto-apply to VolumeLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + ''' +) +{ + uniform token light:materialSyncMode = "materialGlowTintsLight" + uniform token light:shaderId = "VolumeLight" +} + +class "LightListAPI" ( + doc = '''API schema to support discovery and publishing of lights in a scene. + + Discovering Lights via Traversal + + To motivate this API, consider what is required to discover all + lights in a scene. We must load all payloads and traverse all prims: + + \\code + 01 // Load everything on the stage so we can find all lights, + 02 // including those inside payloads + 03 stage->Load(); + 04 + 05 // Traverse all prims, checking if they have an applied UsdLuxLightAPI + 06 // (Note: ignoring instancing and a few other things for simplicity) + 07 SdfPathVector lights; + 08 for (UsdPrim prim: stage->Traverse()) { + 09 if (prim.HasAPI()) { + 10 lights.push_back(i->GetPath()); + 11 } + 12 } + \\endcode + + This traversal -- suitably elaborated to handle certain details -- + is the first and simplest thing UsdLuxLightListAPI provides. + UsdLuxLightListAPI::ComputeLightList() performs this traversal and returns + all lights in the scene: + + \\code + 01 UsdLuxLightListAPI listAPI(stage->GetPseudoRoot()); + 02 SdfPathVector lights = listAPI.ComputeLightList(); + \\endcode + + Publishing a Cached Light List + + Consider a USD client that needs to quickly discover lights but + wants to defer loading payloads and traversing the entire scene + where possible, and is willing to do up-front computation and + caching to achieve that. + + UsdLuxLightListAPI provides a way to cache the computed light list, + by publishing the list of lights onto prims in the model + hierarchy. Consider a big set that contains lights: + + \\code + 01 def Xform "BigSetWithLights" ( + 02 kind = "assembly" + 03 payload = @BigSetWithLights.usd@ // Heavy payload + 04 ) { + 05 // Pre-computed, cached list of lights inside payload + 06 rel lightList = [ + 07 <./Lights/light_1>, + 08 <./Lights/light_2>, + 09 ... + 10 ] + 11 token lightList:cacheBehavior = "consumeAndContinue"; + 12 } + \\endcode + + The lightList relationship encodes a set of lights, and the + lightList:cacheBehavior property provides fine-grained + control over how to use that cache. (See details below.) + + The cache can be created by first invoking + ComputeLightList(ComputeModeIgnoreCache) to pre-compute the list + and then storing the result with UsdLuxLightListAPI::StoreLightList(). + + To enable efficient retrieval of the cache, it should be stored + on a model hierarchy prim. Furthermore, note that while you can + use a UsdLuxLightListAPI bound to the pseudo-root prim to query the + lights (as in the example above) because it will perform a + traversal over descendants, you cannot store the cache back to the + pseduo-root prim. + + To consult the cached list, we invoke + ComputeLightList(ComputeModeConsultModelHierarchyCache): + + \\code + 01 // Find and load all lights, using lightList cache where available + 02 UsdLuxLightListAPI list(stage->GetPseudoRoot()); + 03 SdfPathSet lights = list.ComputeLightList( + 04 UsdLuxLightListAPI::ComputeModeConsultModelHierarchyCache); + 05 stage.LoadAndUnload(lights, SdfPathSet()); + \\endcode + + In this mode, ComputeLightList() will traverse the model + hierarchy, accumulating cached light lists. + + Controlling Cache Behavior + + The lightList:cacheBehavior property gives additional fine-grained + control over cache behavior: + + - The fallback value, "ignore", indicates that the lightList should + be disregarded. This provides a way to invalidate cache entries. + Note that unless "ignore" is specified, a lightList with an empty + list of targets is considered a cache indicating that no lights + are present. + + - The value "consumeAndContinue" indicates that the cache should + be consulted to contribute lights to the scene, and that recursion + should continue down the model hierarchy in case additional lights + are added as descedants. This is the default value established when + StoreLightList() is invoked. This behavior allows the lights within + a large model, such as the BigSetWithLights example above, to be + published outside the payload, while also allowing referencing and + layering to add additional lights over that set. + + - The value "consumeAndHalt" provides a way to terminate recursive + traversal of the scene for light discovery. The cache will be + consulted but no descendant prims will be examined. + + Instancing + + Where instances are present, UsdLuxLightListAPI::ComputeLightList() will + return the instance-unique paths to any lights discovered within + those instances. Lights within a UsdGeomPointInstancer will + not be returned, however, since they cannot be referred to + solely via paths. +''' +) +{ + rel lightList ( + doc = "Relationship to lights in the scene." + ) + token lightList:cacheBehavior ( + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + ) +} + +class "ListAPI" ( + doc = """ + \\deprecated + Use LightListAPI instead +""" +) +{ + rel lightList ( + doc = "Relationship to lights in the scene." + ) + token lightList:cacheBehavior ( + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + ) +} + +class "ShapingAPI" ( + doc = "Controls for shaping a light's emission." +) +{ + float inputs:shaping:cone:angle = 90 ( + displayGroup = "Shaping" + displayName = "Cone Angle" + doc = """Angular limit off the primary axis to restrict the + light spread.""" + ) + float inputs:shaping:cone:softness = 0 ( + displayGroup = "Shaping" + displayName = "Cone Softness" + doc = """Controls the cutoff softness for cone angle. + TODO: clarify semantics""" + ) + float inputs:shaping:focus = 0 ( + displayGroup = "Shaping" + displayName = "Emission Focus" + doc = """A control to shape the spread of light. Higher focus + values pull light towards the center and narrow the spread. + Implemented as an off-axis cosine power exponent. + TODO: clarify semantics""" + ) + color3f inputs:shaping:focusTint = (0, 0, 0) ( + displayGroup = "Shaping" + displayName = "Emission Focus Tint" + doc = """Off-axis color tint. This tints the emission in the + falloff region. The default tint is black. + TODO: clarify semantics""" + ) + float inputs:shaping:ies:angleScale = 0 ( + displayGroup = "Shaping" + displayName = "Profile Scale" + doc = """Rescales the angular distribution of the IES profile. + TODO: clarify semantics""" + ) + asset inputs:shaping:ies:file ( + displayGroup = "Shaping" + displayName = "IES Profile" + doc = """An IES (Illumination Engineering Society) light + profile describing the angular distribution of light.""" + ) + bool inputs:shaping:ies:normalize = 0 ( + displayGroup = "Shaping" + displayName = "Profile Normalization" + doc = """Normalizes the IES profile so that it affects the shaping + of the light while preserving the overall energy output.""" + ) +} + +class "ShadowAPI" ( + doc = """Controls to refine a light's shadow behavior. These are + non-physical controls that are valuable for visual lighting work.""" +) +{ + color3f inputs:shadow:color = (0, 0, 0) ( + displayGroup = "Shadows" + displayName = "Shadow Color" + doc = """The color of shadows cast by the light. This is a + non-physical control. The default is to cast black shadows.""" + ) + float inputs:shadow:distance = -1 ( + displayGroup = "Shadows" + displayName = "Shadow Max Distance" + doc = """The maximum distance shadows are cast. The distance is + measured as the distance between the point on the surface and the + occluder. + The default value (-1) indicates no limit. + """ + ) + bool inputs:shadow:enable = 1 ( + displayGroup = "Shadows" + displayName = "Enable Shadows" + doc = "Enables shadows to be cast by this light." + ) + float inputs:shadow:falloff = -1 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff" + doc = """The size of the shadow falloff zone within the shadow max + distance, which can be used to hide the hard cut-off for shadows seen + stretching past the max distance. The falloff zone is the area that + fades from full shadowing at the beginning of the falloff zone to no + shadowing at the max distance from the occluder. The falloff zone + distance cannot exceed the shadow max distance. A falloff value equal + to or less than zero (with -1 as the default) indicates no falloff. + """ + ) + float inputs:shadow:falloffGamma = 1 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff Gamma" + doc = """A gamma (i.e., exponential) control over shadow strength + with linear distance within the falloff zone. This controls the rate + of the falloff. + This requires the use of shadowDistance and shadowFalloff.""" + ) +} + +class LightFilter "LightFilter" ( + apiSchemas = ["CollectionAPI:filterLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:filterLink:includeRoot"] + } + doc = """A light filter modifies the effect of a light. + Lights refer to filters via relationships so that filters may be + shared. + + Linking + + Filters can be linked to geometry. Linking controls which geometry + a light-filter affects, when considering the light filters attached + to a light illuminating the geometry. + + Linking is specified as a collection (UsdCollectionAPI) which can + be accessed via GetFilterLinkCollection(). + """ +) +{ + uniform bool collection:filterLink:includeRoot = 1 + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "BoundableLightBase" ( + apiSchemas = ["LightAPI"] + doc = """Base class for intrinsic lights that are boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "NonboundableLightBase" ( + apiSchemas = ["LightAPI"] + doc = """Base class for intrinsic lights that are not boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DistantLight "DistantLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["inputs:intensity", "light:shaderId"] + } + doc = """Light emitted from a distant source along the -Z axis. + Also known as a directional light.""" +) +{ + float inputs:angle = 0.53 ( + displayGroup = "Basic" + displayName = "Angle Extent" + doc = """Angular size of the light in degrees. + As an example, the Sun is approximately 0.53 degrees as seen from Earth. + Higher values broaden the light and therefore soften shadow edges. + """ + ) + float inputs:intensity = 50000 ( + doc = """Scales the emission of the light linearly. + The DistantLight has a high default intensity to approximate the Sun.""" + ) + uniform token light:shaderId = "DistantLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DiskLight "DiskLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted from one side of a circular disk. + The disk is centered in the XY plane and emits light along the -Z axis.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the disk." + ) + uniform token light:shaderId = "DiskLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class RectLight "RectLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted from one side of a rectangle. + The rectangle is centered in the XY plane and emits light along the -Z axis. + The rectangle is 1 unit in length in the X and Y axis. In the default + position, a texture file's min coordinates should be at (+X, +Y) and + max coordinates at (-X, -Y).""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the rectangle, in the local Y axis." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = "A color texture to use on the rectangle." + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the rectangle, in the local X axis." + ) + uniform token light:shaderId = "RectLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class SphereLight "SphereLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = "Light emitted outward from a sphere." +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the sphere." + ) + uniform token light:shaderId = "SphereLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + bool treatAsPoint = 0 ( + displayGroup = "Advanced" + displayName = "Treat As Point" + doc = """A hint that this light can be treated as a 'point' + light (effectively, a zero-radius sphere) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class CylinderLight "CylinderLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted outward from a cylinder. + The cylinder is centered at the origin and has its major axis on the X axis. + The cylinder does not emit light from the flat end-caps. + """ +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:length = 1 ( + displayGroup = "Geometry" + displayName = "Length" + doc = "Length of the cylinder, in the local X axis." + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the cylinder." + ) + uniform token light:shaderId = "CylinderLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + bool treatAsLine = 0 ( + displayGroup = "Advanced" + displayName = "Treat As Line" + doc = """A hint that this light can be treated as a 'line' + light (effectively, a zero-radius cylinder) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class GeometryLight "GeometryLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """\\deprecated + Light emitted outward from a geometric prim (UsdGeomGprim), + which is typically a mesh.""" +) +{ + rel geometry ( + doc = "Relationship to the geometry to use as the light source." + ) + uniform token light:shaderId = "GeometryLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DomeLight "DomeLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is such + that its top pole is aligned with the world's +Y axis. This adheres to the + OpenEXR specification for latlong environment maps. From the OpenEXR + documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- +""" +) +{ + float guideRadius = 100000 ( + displayGroup = "Guides" + displayName = "Radius" + doc = "The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm)." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + ) + token inputs:texture:format = "automatic" ( + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + displayGroup = "Basic" + displayName = "Color Map Format" + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + ) + uniform token light:shaderId = "DomeLight" + rel portals ( + doc = "Optional portals to guide light sampling." + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class DomeLight_1 "DomeLight_1" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is + determined by its *poleAxis* property. The fallback value, \"scene\", means + that the dome starts with its top pole aligned with the stage's up axis. + + Note that the rotation necessary to align the dome light with its *poleAxis* + is intended to be applied by a renderer to only the dome itself, and *not* + to inherit down to any USD namespace children of the dome light prim. + + If *poleAxis* is set to \"Y\" or \"scene\" and the stage's up axis is \"Y\", the + dome's default orientation will adhere to the OpenEXR specification for + latlong environment maps. From the OpenEXR documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- + + If *poleAxis* is set to \"Z\" or \"scene\" and the stage's up axis is \"Z\", + latitudes -pi/2 and +pi/2 will instead correspond to the negative and + positive Z direction, and latitude 0, longitude 0 will instead point into + the negative Y direction in 3D space. +""" +) +{ + float guideRadius = 100000 ( + displayGroup = "Guides" + displayName = "Radius" + doc = "The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm)." + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + ) + token inputs:texture:format = "automatic" ( + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + displayGroup = "Basic" + displayName = "Color Map Format" + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + ) + uniform token light:shaderId = "DomeLight" + uniform token poleAxis = "scene" ( + allowedTokens = ["scene", "Y", "Z"] + displayGroup = "Advanced" + displayName = "Pole Axis" + doc = """A token which indicates the starting alignment of the dome + light's top pole. This alignment is for the dome itself and is *not* + inherited by the namespace children of the dome. + Valid values are: + - scene: The dome light's top pole is aligned with the stage's up axis. + - Y: The dome light's top pole is aligned with the +Y axis. + - Z: The dome light's top pole is aligned with the +Z axis. + """ + ) + rel portals ( + doc = "Optional portals to guide light sampling." + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PortalLight "PortalLight" ( + apiSchemas = ["LightAPI"] + customData = { + token[] apiSchemaOverridePropertyNames = ["light:shaderId"] + } + doc = """A rectangular portal in the local XY plane that guides sampling + of a dome light. Transmits light in the -Z direction. + The rectangle is 1 unit in length.""" +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the portal rectangle in the local Y axis." + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the portal rectangle in the local X axis." + ) + uniform token light:shaderId = "PortalLight" + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PluginLight "PluginLight" ( + apiSchemas = ["NodeDefAPI", "LightAPI"] + doc = """Light that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light's type. + + \\see \\ref usdLux_PluginSchemas +""" +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class PluginLightFilter "PluginLightFilter" ( + apiSchemas = ["NodeDefAPI", "CollectionAPI:filterLink"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:filterLink:includeRoot"] + } + doc = """Light filter that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light filter's type. + + \\see \\ref usdLux_PluginSchemas +""" +) +{ + uniform bool collection:filterLink:includeRoot = 1 + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdLuxBoundableLightBase": { + "alias": { + "UsdSchemaBase": "BoundableLightBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "schemaKind": "abstractTyped" + }, + "UsdLuxCylinderLight": { + "alias": { + "UsdSchemaBase": "CylinderLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxDiskLight": { + "alias": { + "UsdSchemaBase": "DiskLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxDistantLight": { + "alias": { + "UsdSchemaBase": "DistantLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxDomeLight": { + "alias": { + "UsdSchemaBase": "DomeLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxDomeLight_1": { + "alias": { + "UsdSchemaBase": "DomeLight_1" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxGeometryLight": { + "alias": { + "UsdSchemaBase": "GeometryLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxNonboundableLightBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxLightAPI": { + "alias": { + "UsdSchemaBase": "LightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "singleApplyAPI" + }, + "UsdLuxLightFilter": { + "alias": { + "UsdSchemaBase": "LightFilter" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxLightListAPI": { + "alias": { + "UsdSchemaBase": "LightListAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxListAPI": { + "alias": { + "UsdSchemaBase": "ListAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxMeshLightAPI": { + "alias": { + "UsdSchemaBase": "MeshLightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxNonboundableLightBase": { + "alias": { + "UsdSchemaBase": "NonboundableLightBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdLuxPluginLight": { + "alias": { + "UsdSchemaBase": "PluginLight" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxPluginLightFilter": { + "alias": { + "UsdSchemaBase": "PluginLightFilter" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxLightFilter" + ], + "schemaKind": "concreteTyped" + }, + "UsdLuxPortalLight": { + "alias": { + "UsdSchemaBase": "PortalLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxRectLight": { + "alias": { + "UsdSchemaBase": "RectLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxShadowAPI": { + "alias": { + "UsdSchemaBase": "ShadowAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxShapingAPI": { + "alias": { + "UsdSchemaBase": "ShapingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLuxSphereLight": { + "alias": { + "UsdSchemaBase": "SphereLight" + }, + "autoGenerated": true, + "bases": [ + "UsdLuxBoundableLightBase" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdLuxVolumeLightAPI": { + "alias": { + "UsdSchemaBase": "VolumeLightAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdLux_DiscoveryPlugin": { + "bases": [ + "NdrDiscoveryPlugin" + ] + }, + "UsdLux_LightDefParserPlugin": { + "bases": [ + "NdrParserPlugin" + ] + } + } + }, + "LibraryPath": "", + "Name": "usdLux", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Lux light schemata for code generation." + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdLux" + string libraryPath = "pxr/usd/usdLux" + dictionary libraryTokens = { + dictionary lightLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent light-linking + of a prim with an applied UsdLuxLightAPI. + """ + } + dictionary shadowLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent shadow-linking + of a prim with an applied UsdLuxLightAPI. + """ + } + dictionary filterLink = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent filter-linking + of a UsdLuxLightFilter prim. + """ + } + dictionary orientToStageUpAxis = { + string doc = """ + This token represents the suffix for a UsdGeomXformOp + used to orient a light with the stage's up axis. + """ + } + } + } +) +{ +} + +class "LightAPI" ( + inherits = + doc = """API schema that imparts the quality of being a light onto a prim. + + A light is any prim that has this schema applied to it. This is true + regardless of whether LightAPI is included as a built-in API of the prim + type (e.g. RectLight or DistantLight) or is applied directly to a Gprim + that should be treated as a light. + + Linking + + Lights can be linked to geometry. Linking controls which geometry + a light illuminates, and which geometry casts shadows from the light. + + Linking is specified as collections (UsdCollectionAPI) which can + be accessed via GetLightLinkCollection() and GetShadowLinkCollection(). + Note that these collections have their includeRoot set to true, + so that lights will illuminate and cast shadows from all objects + by default. To illuminate only a specific set of objects, there + are two options. One option is to modify the collection paths + to explicitly exclude everything else, assuming it is known; + the other option is to set includeRoot to false and explicitly + include the desired objects. These are complementary approaches + that may each be preferable depending on the scenario and how + to best express the intent of the light setup. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + prepend apiSchemas = ["CollectionAPI:lightLink", "CollectionAPI:shadowLink"] +) { + uniform bool collection:lightLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform bool collection:shadowLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light's shader. + This defines the shader ID for this light when a render context specific + shader ID is not available. + + The default shaderId for the intrinsic UsdLux lights (RectLight, + DistantLight, etc.) are set to default to the light's type name. For + each intrinsic UsdLux light, we will always register an SdrShaderNode in + the SdrRegistry, with the identifier matching the type name and the + source type "USD", that corresponds to the light's inputs. + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + customData = { + token apiName = "shaderId" + } + ) + uniform token light:materialSyncMode = "noMaterialResponse" ( + displayGroup = "Geometry" + displayName = "Material Sync Mode" + doc = """For a LightAPI applied to geometry that has a bound Material, + which is entirely or partly emissive, this specifies the relationship + of the Material response to the lighting response. + Valid values are: + - materialGlowTintsLight: All primary and secondary rays see the + emissive/glow response as dictated by the bound Material while the + base color seen by light rays (which is then modulated by all of the + other LightAPI controls) is the multiplication of the color feeding + the emission/glow input of the Material (i.e. its surface or volume + shader) with the scalar or pattern input to *inputs:color*. + This allows the light's color to tint the geometry's glow color while + preserving access to intensity and other light controls as ways to + further modulate the illumination. + - independent: All primary and secondary rays see the emissive/glow + response as dictated by the bound Material, while the base color seen + by light rays is determined solely by *inputs:color*. Note that for + partially emissive geometry (in which some parts are reflective + rather than emissive), a suitable pattern must be connected to the + light's color input, or else the light will radiate uniformly from + the geometry. + - noMaterialResponse: The geometry behaves as if there is no Material + bound at all, i.e. there is no diffuse, specular, or transmissive + response. The base color of light rays is entirely controlled by the + *inputs:color*. This is the standard mode for "canonical" lights in + UsdLux and indicates to renderers that a Material will either never + be bound or can always be ignored. + """ + allowedTokens = ["materialGlowTintsLight", + "independent", + "noMaterialResponse"] + customData = { + token apiName = "materialSyncMode" + } + ) + float inputs:intensity = 1 ( + displayGroup = "Basic" + displayName = "Intensity" + doc = """Scales the power of the light linearly.""" + customData = { + token apiName = "intensity" + } + ) + float inputs:exposure = 0 ( + displayGroup = "Basic" + displayName = "Exposure" + doc = """Scales the power of the light exponentially as a power + of 2 (similar to an F-stop control over exposure). The result + is multiplied against the intensity.""" + customData = { + token apiName = "exposure" + } + ) + float inputs:diffuse = 1.0 ( + displayGroup = "Refine" + displayName = "Diffuse Multiplier" + doc = """A multiplier for the effect of this light on the diffuse + response of materials. This is a non-physical control.""" + customData = { + token apiName = "diffuse" + } + ) + float inputs:specular = 1.0 ( + displayGroup = "Refine" + displayName = "Specular Multiplier" + doc = """A multiplier for the effect of this light on the specular + response of materials. This is a non-physical control.""" + customData = { + token apiName = "specular" + } + ) + bool inputs:normalize = false ( + displayGroup = "Advanced" + displayName = "Normalize Power" + doc = """Normalizes power by the surface area of the light. + This makes it easier to independently adjust the power and shape + of the light, by causing the power to not vary with the area or + angular size of the light.""" + customData = { + token apiName = "normalize" + } + ) + color3f inputs:color = (1, 1, 1) ( + displayGroup = "Basic" + displayName = "Color" + doc = """The color of emitted light, in energy-linear terms.""" + customData = { + token apiName = "color" + } + ) + bool inputs:enableColorTemperature = false ( + displayGroup = "Basic" + displayName = "Enable Color Temperature" + doc = """Enables using colorTemperature.""" + customData = { + token apiName = "enableColorTemperature" + } + ) + float inputs:colorTemperature = 6500 ( + displayGroup = "Basic" + displayName = "Color Temperature" + doc = """Color temperature, in degrees Kelvin, representing the + white point. The default is a common white point, D65. Lower + values are warmer and higher values are cooler. The valid range + is from 1000 to 10000. Only takes effect when + enableColorTemperature is set to true. When active, the + computed result multiplies against the color attribute. + See UsdLuxBlackbodyTemperatureAsRgb().""" + customData = { + token apiName = "colorTemperature" + } + ) + rel light:filters ( + doc = """Relationship to the light filters that apply to this light.""" + customData = { + token apiName = "filters" + } + ) +} + +class "MeshLightAPI" ( + inherits = + doc = """This is the preferred API schema to apply to + \\ref UsdGeomMesh "Mesh" type prims when adding light behaviors to a mesh. + At its base, this API schema has the built-in behavior of applying LightAPI + to the mesh and overriding the default materialSyncMode to allow the + emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "mesh lights" through the creation of API schemas which are + authored to auto-apply to MeshLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + """ + prepend apiSchemas = ["LightAPI"] +) { + uniform token light:shaderId = "MeshLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:materialSyncMode = "materialGlowTintsLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class "VolumeLightAPI" ( + inherits = + doc = """This is the preferred API schema to apply to + \\ref UsdVolVolume "Volume" type prims when adding light behaviors to a + volume. At its base, this API schema has the built-in behavior of applying + LightAPI to the volume and overriding the default materialSyncMode to allow + the emission/glow of the bound material to affect the color of the light. + But, it additionally serves as a hook for plugins to attach additional + properties to "volume lights" through the creation of API schemas which are + authored to auto-apply to VolumeLightAPI. + \\see \\ref Usd_AutoAppliedAPISchemas + """ + prepend apiSchemas = ["LightAPI"] +) { + uniform token light:shaderId = "VolumeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token light:materialSyncMode = "materialGlowTintsLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class "LightListAPI" ( + inherits = + doc = """API schema to support discovery and publishing of lights in a scene. + + \\section UsdLuxLightListAPI_Discovery Discovering Lights via Traversal + + To motivate this API, consider what is required to discover all + lights in a scene. We must load all payloads and traverse all prims: + + \\code + 01 // Load everything on the stage so we can find all lights, + 02 // including those inside payloads + 03 stage->Load(); + 04 + 05 // Traverse all prims, checking if they have an applied UsdLuxLightAPI + 06 // (Note: ignoring instancing and a few other things for simplicity) + 07 SdfPathVector lights; + 08 for (UsdPrim prim: stage->Traverse()) { + 09 if (prim.HasAPI()) { + 10 lights.push_back(i->GetPath()); + 11 } + 12 } + \\endcode + + This traversal -- suitably elaborated to handle certain details -- + is the first and simplest thing UsdLuxLightListAPI provides. + UsdLuxLightListAPI::ComputeLightList() performs this traversal and returns + all lights in the scene: + + \\code + 01 UsdLuxLightListAPI listAPI(stage->GetPseudoRoot()); + 02 SdfPathVector lights = listAPI.ComputeLightList(); + \\endcode + + \\section UsdLuxLightListAPI_LightList Publishing a Cached Light List + + Consider a USD client that needs to quickly discover lights but + wants to defer loading payloads and traversing the entire scene + where possible, and is willing to do up-front computation and + caching to achieve that. + + UsdLuxLightListAPI provides a way to cache the computed light list, + by publishing the list of lights onto prims in the model + hierarchy. Consider a big set that contains lights: + + \\code + 01 def Xform "BigSetWithLights" ( + 02 kind = "assembly" + 03 payload = @BigSetWithLights.usd@ // Heavy payload + 04 ) { + 05 // Pre-computed, cached list of lights inside payload + 06 rel lightList = [ + 07 <./Lights/light_1>, + 08 <./Lights/light_2>, + 09 ... + 10 ] + 11 token lightList:cacheBehavior = "consumeAndContinue"; + 12 } + \\endcode + + The lightList relationship encodes a set of lights, and the + lightList:cacheBehavior property provides fine-grained + control over how to use that cache. (See details below.) + + The cache can be created by first invoking + ComputeLightList(ComputeModeIgnoreCache) to pre-compute the list + and then storing the result with UsdLuxLightListAPI::StoreLightList(). + + To enable efficient retrieval of the cache, it should be stored + on a model hierarchy prim. Furthermore, note that while you can + use a UsdLuxLightListAPI bound to the pseudo-root prim to query the + lights (as in the example above) because it will perform a + traversal over descendants, you cannot store the cache back to the + pseduo-root prim. + + To consult the cached list, we invoke + ComputeLightList(ComputeModeConsultModelHierarchyCache): + + \\code + 01 // Find and load all lights, using lightList cache where available + 02 UsdLuxLightListAPI list(stage->GetPseudoRoot()); + 03 SdfPathSet lights = list.ComputeLightList( + 04 UsdLuxLightListAPI::ComputeModeConsultModelHierarchyCache); + 05 stage.LoadAndUnload(lights, SdfPathSet()); + \\endcode + + In this mode, ComputeLightList() will traverse the model + hierarchy, accumulating cached light lists. + + \\section UsdLuxLightListAPI_CacheBehavior Controlling Cache Behavior + + The lightList:cacheBehavior property gives additional fine-grained + control over cache behavior: + + \\li The fallback value, "ignore", indicates that the lightList should + be disregarded. This provides a way to invalidate cache entries. + Note that unless "ignore" is specified, a lightList with an empty + list of targets is considered a cache indicating that no lights + are present. + + \\li The value "consumeAndContinue" indicates that the cache should + be consulted to contribute lights to the scene, and that recursion + should continue down the model hierarchy in case additional lights + are added as descedants. This is the default value established when + StoreLightList() is invoked. This behavior allows the lights within + a large model, such as the BigSetWithLights example above, to be + published outside the payload, while also allowing referencing and + layering to add additional lights over that set. + + \\li The value "consumeAndHalt" provides a way to terminate recursive + traversal of the scene for light discovery. The cache will be + consulted but no descendant prims will be examined. + + \\section UsdLuxLightListAPI_Instancing Instancing + + Where instances are present, UsdLuxLightListAPI::ComputeLightList() will + return the instance-unique paths to any lights discovered within + those instances. Lights within a UsdGeomPointInstancer will + not be returned, however, since they cannot be referred to + solely via paths. +""" +) { + rel lightList ( + doc = """Relationship to lights in the scene.""" + ) + token lightList:cacheBehavior ( + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + ) +} + +class "ListAPI" ( + inherits = + doc = """ + \\deprecated + Use LightListAPI instead +""" +) { + rel lightList ( + doc = """Relationship to lights in the scene.""" + ) + token lightList:cacheBehavior ( + doc = """Controls how the lightList should be interpreted. + Valid values are: + - consumeAndHalt: The lightList should be consulted, + and if it exists, treated as a final authoritative statement + of any lights that exist at or below this prim, halting + recursive discovery of lights. + - consumeAndContinue: The lightList should be consulted, + but recursive traversal over nameChildren should continue + in case additional lights are added by descendants. + - ignore: The lightList should be entirely ignored. This + provides a simple way to temporarily invalidate an existing + cache. This is the fallback behavior. + """ + allowedTokens = ["consumeAndHalt", "consumeAndContinue", "ignore"] + ) +} + +class "ShapingAPI" ( + inherits = + doc = """Controls for shaping a light's emission.""" + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + +) { + float inputs:shaping:focus = 0 ( + displayGroup = "Shaping" + displayName = "Emission Focus" + doc = """A control to shape the spread of light. Higher focus + values pull light towards the center and narrow the spread. + Implemented as an off-axis cosine power exponent. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:focus" + } + ) + color3f inputs:shaping:focusTint = (0, 0, 0) ( + displayGroup = "Shaping" + displayName = "Emission Focus Tint" + doc = """Off-axis color tint. This tints the emission in the + falloff region. The default tint is black. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:focusTint" + } + ) + float inputs:shaping:cone:angle = 90 ( + displayGroup = "Shaping" + displayName = "Cone Angle" + doc = """Angular limit off the primary axis to restrict the + light spread.""" + customData = { + token apiName = "shaping:cone:angle" + } + ) + float inputs:shaping:cone:softness = 0 ( + displayGroup = "Shaping" + displayName = "Cone Softness" + doc = """Controls the cutoff softness for cone angle. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:cone:softness" + } + ) + asset inputs:shaping:ies:file ( + displayGroup = "Shaping" + displayName = "IES Profile" + doc = """An IES (Illumination Engineering Society) light + profile describing the angular distribution of light.""" + customData = { + token apiName = "shaping:ies:file" + } + ) + float inputs:shaping:ies:angleScale = 0 ( + displayGroup = "Shaping" + displayName = "Profile Scale" + doc = """Rescales the angular distribution of the IES profile. + TODO: clarify semantics""" + customData = { + token apiName = "shaping:ies:angleScale" + } + ) + bool inputs:shaping:ies:normalize = false ( + displayGroup = "Shaping" + displayName = "Profile Normalization" + doc = """Normalizes the IES profile so that it affects the shaping + of the light while preserving the overall energy output.""" + customData = { + token apiName = "shaping:ies:normalize" + } + ) +} + +class "ShadowAPI" ( + inherits = + doc = """Controls to refine a light's shadow behavior. These are + non-physical controls that are valuable for visual lighting work.""" + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + +) { + bool inputs:shadow:enable = true ( + displayGroup = "Shadows" + displayName = "Enable Shadows" + doc = """Enables shadows to be cast by this light.""" + customData = { + token apiName = "shadow:enable" + } + ) + color3f inputs:shadow:color = (0, 0, 0) ( + displayGroup = "Shadows" + displayName = "Shadow Color" + doc = """The color of shadows cast by the light. This is a + non-physical control. The default is to cast black shadows.""" + customData = { + token apiName = "shadow:color" + } + ) + float inputs:shadow:distance = -1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Max Distance" + doc = """The maximum distance shadows are cast. The distance is + measured as the distance between the point on the surface and the + occluder. + The default value (-1) indicates no limit. + """ + customData = { + token apiName = "shadow:distance" + } + ) + float inputs:shadow:falloff = -1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff" + doc = """The size of the shadow falloff zone within the shadow max + distance, which can be used to hide the hard cut-off for shadows seen + stretching past the max distance. The falloff zone is the area that + fades from full shadowing at the beginning of the falloff zone to no + shadowing at the max distance from the occluder. The falloff zone + distance cannot exceed the shadow max distance. A falloff value equal + to or less than zero (with -1 as the default) indicates no falloff. + """ + customData = { + token apiName = "shadow:falloff" + } + ) + float inputs:shadow:falloffGamma = 1.0 ( + displayGroup = "Shadows" + displayName = "Shadow Falloff Gamma" + doc = """A gamma (i.e., exponential) control over shadow strength + with linear distance within the falloff zone. This controls the rate + of the falloff. + This requires the use of shadowDistance and shadowFalloff.""" + customData = { + token apiName = "shadow:falloffGamma" + } + ) +} + +class LightFilter "LightFilter" ( + inherits = + doc = """A light filter modifies the effect of a light. + Lights refer to filters via relationships so that filters may be + shared. + + Linking + + Filters can be linked to geometry. Linking controls which geometry + a light-filter affects, when considering the light filters attached + to a light illuminating the geometry. + + Linking is specified as a collection (UsdCollectionAPI) which can + be accessed via GetFilterLinkCollection(). + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" """ + } + prepend apiSchemas = ["CollectionAPI:filterLink"] +) { + uniform bool collection:filterLink:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) + uniform token lightFilter:shaderId = "" ( + displayGroup = "Internal" + doc = """Default ID for the light filter's shader. + This defines the shader ID for this light filter when a render context + specific shader ID is not available. + + \\see GetShaderId + \\see GetShaderIdAttrForRenderContext + \\see SdrRegistry::GetShaderNodeByIdentifier + \\see SdrRegistry::GetShaderNodeByIdentifierAndType + """ + customData = { + token apiName = "shaderId" + } + ) + +} + +class "BoundableLightBase" ( + inherits = + doc = """Base class for intrinsic lights that are boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ + customData = { + string extraIncludes = """#include "pxr/usd/usdLux/lightAPI.h" """ + } + prepend apiSchemas = ["LightAPI"] +) { +} + +class "NonboundableLightBase" ( + inherits = + doc = """Base class for intrinsic lights that are not boundable. + + The primary purpose of this class is to provide a direct API to the + functions provided by LightAPI for concrete derived light types. + """ + customData = { + string extraIncludes = """#include "pxr/usd/usdLux/lightAPI.h" """ + } + prepend apiSchemas = ["LightAPI"] +) { +} + +class DistantLight "DistantLight" ( + inherits = + doc = """Light emitted from a distant source along the -Z axis. + Also known as a directional light.""" +) { + uniform token light:shaderId = "DistantLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:angle = 0.53 ( + displayGroup = "Basic" + displayName = "Angle Extent" + doc = """Angular size of the light in degrees. + As an example, the Sun is approximately 0.53 degrees as seen from Earth. + Higher values broaden the light and therefore soften shadow edges. + """ + customData = { + token apiName = "angle" + } + ) + float inputs:intensity = 50000 ( + doc = """Scales the emission of the light linearly. + The DistantLight has a high default intensity to approximate the Sun.""" + customData = { + token apiName = "intensity" + bool apiSchemaOverride = true + } + ) +} + +class DiskLight "DiskLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted from one side of a circular disk. + The disk is centered in the XY plane and emits light along the -Z axis.""" +) { + uniform token light:shaderId = "DiskLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the disk." + customData = { + token apiName = "radius" + } + ) +} + +class RectLight "RectLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted from one side of a rectangle. + The rectangle is centered in the XY plane and emits light along the -Z axis. + The rectangle is 1 unit in length in the X and Y axis. In the default + position, a texture file's min coordinates should be at (+X, +Y) and + max coordinates at (-X, -Y).""" +) { + uniform token light:shaderId = "RectLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the rectangle, in the local X axis." + customData = { + token apiName = "width" + } + + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the rectangle, in the local Y axis." + customData = { + token apiName = "height" + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the rectangle.""" + customData = { + token apiName = "textureFile" + } + ) +} + +class SphereLight "SphereLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted outward from a sphere.""" +) { + uniform token light:shaderId = "SphereLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the sphere." + customData = { + token apiName = "radius" + } + ) + bool treatAsPoint = false ( + displayGroup = "Advanced" + displayName = "Treat As Point" + doc = """A hint that this light can be treated as a 'point' + light (effectively, a zero-radius sphere) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) +} + +class CylinderLight "CylinderLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """Light emitted outward from a cylinder. + The cylinder is centered at the origin and has its major axis on the X axis. + The cylinder does not emit light from the flat end-caps. + """ +) { + uniform token light:shaderId = "CylinderLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:length = 1 ( + displayGroup = "Geometry" + displayName = "Length" + doc = "Length of the cylinder, in the local X axis." + customData = { + token apiName = "length" + } + ) + float inputs:radius = 0.5 ( + displayGroup = "Geometry" + displayName = "Radius" + doc = "Radius of the cylinder." + customData = { + token apiName = "radius" + } + ) + bool treatAsLine = false ( + displayGroup = "Advanced" + displayName = "Treat As Line" + doc = """A hint that this light can be treated as a 'line' + light (effectively, a zero-radius cylinder) by renderers that + benefit from non-area lighting. Renderers that only support + area lights can disregard this.""" + ) +} + +class GeometryLight "GeometryLight" ( + inherits = + doc = """\\deprecated + Light emitted outward from a geometric prim (UsdGeomGprim), + which is typically a mesh.""" +) { + rel geometry ( + doc = """Relationship to the geometry to use as the light source.""" + ) + uniform token light:shaderId = "GeometryLight" ( + customData = { + bool apiSchemaOverride = true + } + ) +} + +class DomeLight "DomeLight" ( + inherits = + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is such + that its top pole is aligned with the world's +Y axis. This adheres to the + OpenEXR specification for latlong environment maps. From the OpenEXR + documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- +""" +) { + uniform token light:shaderId = "DomeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + customData = { + token apiName = "textureFile" + } + ) + token inputs:texture:format = "automatic" ( + displayGroup = "Basic" + displayName = "Color Map Format" + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + customData = { + token apiName = "textureFormat" + } + ) + rel portals ( + doc = """Optional portals to guide light sampling.""" + ) + float guideRadius = 1.0e5 ( + displayGroup = "Guides" + displayName = "Radius" + doc = """The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm).""" + ) +} + +class DomeLight_1 "DomeLight_1" ( + inherits = + doc = """Light emitted inward from a distant external environment, + such as a sky or IBL light probe. + + In this version of the dome light, the dome's default orientation is + determined by its *poleAxis* property. The fallback value, "scene", means + that the dome starts with its top pole aligned with the stage's up axis. + + Note that the rotation necessary to align the dome light with its *poleAxis* + is intended to be applied by a renderer to only the dome itself, and *not* + to inherit down to any USD namespace children of the dome light prim. + + If *poleAxis* is set to "Y" or "scene" and the stage's up axis is "Y", the + dome's default orientation will adhere to the OpenEXR specification for + latlong environment maps. From the OpenEXR documentation: + + ------------------------------------------------------------------------- + Latitude-Longitude Map: + + The environment is projected onto the image using polar coordinates + (latitude and longitude). A pixel's x coordinate corresponds to + its longitude, and the y coordinate corresponds to its latitude. + Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and + longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has + latitude -pi/2 and longitude -pi. + + In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and + positive y direction. Latitude 0, longitude 0 points into positive + z direction; and latitude 0, longitude pi/2 points into positive x + direction. + + The size of the data window should be 2*N by N pixels (width by height), + where N can be any integer greater than 0. + ------------------------------------------------------------------------- + + If *poleAxis* is set to "Z" or "scene" and the stage's up axis is "Z", + latitudes -pi/2 and +pi/2 will instead correspond to the negative and + positive Z direction, and latitude 0, longitude 0 will instead point into + the negative Y direction in 3D space. +""" +) { + uniform token light:shaderId = "DomeLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + asset inputs:texture:file ( + displayGroup = "Basic" + displayName = "Color Map" + doc = """A color texture to use on the dome, such as an HDR (high + dynamic range) texture intended for IBL (image based lighting).""" + customData = { + token apiName = "textureFile" + } + ) + token inputs:texture:format = "automatic" ( + displayGroup = "Basic" + displayName = "Color Map Format" + allowedTokens = ["automatic", "latlong", "mirroredBall", "angular", "cubeMapVerticalCross"] + doc = """Specifies the parameterization of the color map file. + Valid values are: + - automatic: Tries to determine the layout from the file itself. + For example, Renderman texture files embed an explicit + parameterization. + - latlong: Latitude as X, longitude as Y. + - mirroredBall: An image of the environment reflected in a + sphere, using an implicitly orthogonal projection. + - angular: Similar to mirroredBall but the radial dimension + is mapped linearly to the angle, providing better sampling + at the edges. + - cubeMapVerticalCross: A cube map with faces laid out as a + vertical cross. + """ + customData = { + token apiName = "textureFormat" + } + ) + rel portals ( + doc = """Optional portals to guide light sampling.""" + ) + float guideRadius = 1.0e5 ( + displayGroup = "Guides" + displayName = "Radius" + doc = """The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm).""" + ) + uniform token poleAxis = "scene" ( + displayGroup = "Advanced" + displayName = "Pole Axis" + allowedTokens = ["scene", "Y", "Z"] + doc = """A token which indicates the starting alignment of the dome + light's top pole. This alignment is for the dome itself and is *not* + inherited by the namespace children of the dome. + Valid values are: + - scene: The dome light's top pole is aligned with the stage's up axis. + - Y: The dome light's top pole is aligned with the +Y axis. + - Z: The dome light's top pole is aligned with the +Z axis. + """ + ) +} + +class PortalLight "PortalLight" ( + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = 1 + } + } + inherits = + doc = """A rectangular portal in the local XY plane that guides sampling + of a dome light. Transmits light in the -Z direction. + The rectangle is 1 unit in length.""" +) { + uniform token light:shaderId = "PortalLight" ( + customData = { + bool apiSchemaOverride = true + } + ) + float inputs:width = 1 ( + displayGroup = "Geometry" + displayName = "Width" + doc = "Width of the portal rectangle in the local X axis." + customData = { + token apiName = "width" + } + + ) + float inputs:height = 1 ( + displayGroup = "Geometry" + displayName = "Height" + doc = "Height of the portal rectangle in the local Y axis." + customData = { + token apiName = "height" + } + ) +} + +class PluginLight "PluginLight" ( + inherits = + doc = """Light that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light's type. + + \\see \\ref usdLux_PluginSchemas +""" + prepend apiSchemas = ["NodeDefAPI", "LightAPI"] + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/nodeDefAPI.h" """ + } +) { +} + +class PluginLightFilter "PluginLightFilter" ( + inherits = + doc = """Light filter that provides properties that allow it to identify an + external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be + provided to render delegates without the need to provide a schema + definition for the light filter's type. + + \\see \\ref usdLux_PluginSchemas +""" + prepend apiSchemas = ["NodeDefAPI"] + customData = { + string extraIncludes = """ +#include "pxr/usd/usdShade/nodeDefAPI.h" """ + } +) { +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "RenderSettingsBase" ( + doc = """Abstract base class that defines render settings that + can be specified on either a RenderSettings prim or a RenderProduct + prim.""" +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderSettings "RenderSettings" ( + doc = """A UsdRenderSettings prim specifies global settings for + a render process, including an enumeration of the RenderProducts + that should result, and the UsdGeomImageable purposes that should + be rendered. \\ref UsdRenderHowSettingsAffectRendering""" +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform token[] includedPurposes = ["default", "render"] ( + doc = """The list of UsdGeomImageable _purpose_ values that + should be included in the render. Note this cannot be + specified per-RenderProduct because it is a statement of + which geometry is present.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform token[] materialBindingPurposes = ["full", ""] ( + allowedTokens = ["full", "preview", ""] + doc = '''Ordered list of material purposes to consider when + resolving material bindings in the scene. The empty string + indicates the "allPurpose" binding.''' + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + rel products ( + doc = """The set of RenderProducts the render should produce. + This relationship should target UsdRenderProduct prims. + If no _products_ are specified, an application should produce + an rgb image according to the RenderSettings configuration, + to a default display or image name.""" + ) + uniform token renderingColorSpace ( + doc = """Describes a renderer's working (linear) colorSpace where all + the renderer/shader math is expected to happen. When no + renderingColorSpace is provided, renderer should use its own default.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderVar "RenderVar" ( + doc = """A UsdRenderVar describes a custom data variable for + a render to produce. The prim describes the source of the data, which + can be a shader output or an LPE (Light Path Expression), and also + allows encoding of (generally renderer-specific) parameters that + configure the renderer for computing the variable. + + \\note The name of the RenderVar prim drives the name of the data + variable that the renderer will produce. + + \\note In the future, UsdRender may standardize RenderVar representation + for well-known variables under the sourceType `intrinsic`, + such as _r_, _g_, _b_, _a_, _z_, or _id_. + """ +) +{ + uniform token dataType = "color3f" ( + doc = "The type of this channel, as a USD attribute type." + ) + uniform string sourceName = "" ( + doc = """The renderer should look for an output of this name + as the computed value for the RenderVar.""" + ) + uniform token sourceType = "raw" ( + allowedTokens = ["raw", "primvar", "lpe", "intrinsic"] + doc = '''Indicates the type of the source. + + - "raw": The name should be passed directly to the + renderer. This is the default behavior. + - "primvar": This source represents the name of a primvar. + Some renderers may use this to ensure that the primvar + is provided; other renderers may require that a suitable + material network be provided, in which case this is simply + an advisory setting. + - "lpe": Specifies a Light Path Expression in the + [OSL Light Path Expressions language](https://github.com/imageworks/OpenShadingLanguage/wiki/OSL-Light-Path-Expressions) as the source for + this RenderVar. Some renderers may use extensions to + that syntax, which will necessarily be non-portable. + - "intrinsic": This setting is currently unimplemented, + but represents a future namespace for UsdRender to provide + portable baseline RenderVars, such as camera depth, that + may have varying implementations for each renderer. + ''' + ) +} + +class RenderProduct "RenderProduct" ( + doc = """A UsdRenderProduct describes an image or other + file-like artifact produced by a render. A RenderProduct + combines one or more RenderVars into a file or interactive + buffer. It also provides all the controls established in + UsdRenderSettingsBase as optional overrides to whatever the + owning UsdRenderSettings prim dictates. + + Specific renderers may support additional settings, such + as a way to configure compression settings, filetype metadata, + and so forth. Such settings can be encoded using + renderer-specific API schemas applied to the product prim. + """ +) +{ + uniform token aspectRatioConformPolicy = "expandAperture" ( + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + doc = '''Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + ''' + ) + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform float4 dataWindowNDC = (0, 0, 1, 1) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool disableDepthOfField = 0 ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) + uniform bool disableMotionBlur = 0 ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool instantaneousShutter = 0 ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + rel orderedVars ( + doc = """Specifies the RenderVars that should be consumed and + combined into the final product. If ordering is relevant to the + output driver, then the ordering of targets in this relationship + provides the order to use.""" + ) + uniform float pixelAspectRatio = 1 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + token productName = "" ( + doc = """Specifies the name that the output/display driver + should give the product. This is provided as-authored to the + driver, whose responsibility it is to situate the product on a + filesystem or other storage, in the desired location.""" + ) + uniform token productType = "raster" ( + doc = '''The type of output to produce. + The default, "raster", indicates a 2D image. + + \\note In the future, UsdRender may define additional product + types.''' + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) +} + +class RenderPass "RenderPass" ( + apiSchemas = ["CollectionAPI:renderVisibility"] + customData = { + token[] apiSchemaOverridePropertyNames = ["collection:renderVisibility:includeRoot"] + } + doc = """A RenderPass prim encapsulates the necessary information + to generate multipass renders. It houses properties for generating + dependencies and the necessary commands to run to generate renders, as + well as visibility controls for the scene. While RenderSettings + describes the information needed to generate images from a single + invocation of a renderer, RenderPass describes the additional information + needed to generate a time varying set of images. + + There are two consumers of RenderPass prims - a runtime executable that + generates images from usdRender prims, and pipeline specific code that + translates between usdRender prims and the pipeline's resource scheduling + software. We'll refer to the latter as 'job submission code'. + + \\anchor usdRender_renderVisibility + The objects that are relevant to the render is specified via the + renderVisibility collection (UsdCollectionAPI) and can be accessed via + GetRenderVisibilityCollectionAPI(). This collection has includeRoot set to + true so that all objects participate in the render by default. To render + only a specific set of objects, there are two options. One is to modify the + collection paths to explicitly exclude objects that don't participate in + the render, assuming it is known; the other option is to set includeRoot to + false and explicitly include the desired objects. These are complementary + approaches that may each be preferable depending on the scenario. + + The name of the prim is used as the pass's name. + """ +) +{ + uniform bool collection:renderVisibility:includeRoot = 1 + uniform string[] command ( + doc = '''The command to run in order to generate + renders for this pass. The job submission code can use + this to properly send tasks to the job scheduling software + that will generate products. + + The command can contain variables that will be substituted + appropriately during submission, as seen in the example below + with {fileName}. + + For example: + command[0] = "prman" + command[1] = "-progress" + command[2] = "-pixelvariance" + command[3] = "-0.15" + command[4] = "{fileName}" # the fileName property will be substituted + ''' + ) + uniform bool denoise:enable = 0 ( + doc = "When True, this Pass pass should be denoised." + ) + rel denoise:pass ( + doc = """The The UsdRenderDenoisePass prim from which to + source denoise settings. + """ + ) + uniform asset fileName ( + doc = """The asset that contains the rendering prims or other + information needed to render this pass. + """ + ) + rel inputPasses ( + doc = """The set of other Passes that this Pass depends on + in order to be constructed properly. For example, a Pass A + may generate a texture, which is then used as an input to + Pass B. + + By default, usdRender makes some assumptions about the + relationship between this prim and the prims listed in inputPasses. + Namely, when per-frame tasks are generated from these pass prims, + usdRender will assume a one-to-one relationship between tasks + that share their frame number. Consider a pass named 'composite' + whose _inputPasses_ targets a Pass prim named 'beauty`. + By default, each frame for 'composite' will depend on the + same frame from 'beauty': + beauty.1 -> composite.1 + beauty.2 -> composite.2 + etc + + The consumer of this RenderPass graph of inputs will need to resolve + the transitive dependencies. + """ + ) + uniform token passType ( + doc = """A string used to categorize differently structured + or executed types of passes within a customized pipeline. + + For example, when multiple DCC's (e.g. Houdini, Katana, Nuke) + each compute and contribute different Products to a final result, + it may be clearest and most flexible to create a separate + RenderPass for each. + """ + ) + rel renderSource ( + doc = """The source prim to render from. If _fileName_ is not present, + the source is assumed to be a RenderSettings prim present in the current + Usd stage. If fileName is present, the source should be found in the + file there. This relationship might target a string attribute on this + or another prim that identifies the appropriate object in the external + container. + + For example, for a Usd-backed pass, this would point to a RenderSettings + prim. Houdini passes would point to a Rop. Nuke passes would point to + a write node. + """ + ) +} + +class RenderDenoisePass "RenderDenoisePass" ( + doc = """A RenderDenoisePass generates renders via a denoising process. + This may be the same renderer that a pipeline uses for UsdRender, + or may be a separate one. Notably, a RenderDenoisePass requires + another Pass to be present for it to operate. The denoising process + itself is not generative, and requires images inputs to operate. + + As denoising integration varies so widely across pipelines, all + implementation details are left to pipeline-specific prims + that inherit from RenderDenoisePass. + """ +) +{ +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "renderSettingsPrimPath": { + "appliesTo": "layers", + "default": "", + "type": "string" + } + }, + "Types": { + "UsdRenderDenoisePass": { + "alias": { + "UsdSchemaBase": "RenderDenoisePass" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderPass": { + "alias": { + "UsdSchemaBase": "RenderPass" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderProduct": { + "alias": { + "UsdSchemaBase": "RenderProduct" + }, + "autoGenerated": true, + "bases": [ + "UsdRenderSettingsBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderSettings": { + "alias": { + "UsdSchemaBase": "RenderSettings" + }, + "autoGenerated": true, + "bases": [ + "UsdRenderSettingsBase" + ], + "schemaKind": "concreteTyped" + }, + "UsdRenderSettingsBase": { + "alias": { + "UsdSchemaBase": "RenderSettingsBase" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "abstractTyped" + }, + "UsdRenderVar": { + "alias": { + "UsdSchemaBase": "RenderVar" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdRender", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Render schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdRender" + string libraryPath = "pxr/usd/usdRender" + dictionary libraryTokens = { + dictionary renderSettingsPrimPath = { + string doc = """Stage-level metadata that encodes the + path to UsdRenderSettingsPrim to use for rendering.""" + } + dictionary renderVisibility = { + string doc = """ + This token represents the collection name to use + with UsdCollectionAPI to represent renderVisibility + of a RenderPass prim. + """ + } + } + } +) +{ +} + +class "RenderSettingsBase" ( + inherits = + doc = """Abstract base class that defines render settings that + can be specified on either a RenderSettings prim or a RenderProduct + prim.""" + customData = { + string className = "SettingsBase" + } +) +{ + rel camera ( + doc = """The _camera_ relationship specifies the primary + camera to use in a render. It must target a UsdGeomCamera.""" + ) + uniform int2 resolution = (2048, 1080) ( + doc = """The image pixel resolution, corresponding to the + camera's screen window.""" + ) + uniform float pixelAspectRatio = 1.0 ( + doc = """The aspect ratio (width/height) of image pixels.. + The default ratio 1.0 indicates square pixels.""" + ) + uniform token aspectRatioConformPolicy = "expandAperture" ( + doc = """Indicates the policy to use to resolve an aspect + ratio mismatch between the camera aperture and image settings. + + This policy allows a standard render setting to do something + reasonable given varying camera inputs. + + The camera aperture aspect ratio is determined by the + aperture atributes on the UsdGeomCamera. + + The image aspect ratio is determined by the resolution and + pixelAspectRatio attributes in the render settings. + + - "expandAperture": if necessary, expand the aperture to + fit the image, exposing additional scene content + - "cropAperture": if necessary, crop the aperture to fit + the image, cropping scene content + - "adjustApertureWidth": if necessary, adjust aperture width + to make its aspect ratio match the image + - "adjustApertureHeight": if necessary, adjust aperture height + to make its aspect ratio match the image + - "adjustPixelAspectRatio": compute pixelAspectRatio to + make the image exactly cover the aperture; disregards + existing attribute value of pixelAspectRatio + """ + allowedTokens = ["expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", "adjustPixelAspectRatio"] + ) + uniform float4 dataWindowNDC = (0.0, 0.0, 1.0, 1.0) ( + doc = """dataWindowNDC specifies the axis-aligned rectangular + region in the adjusted aperture window within which the renderer + should produce data. + + It is specified as (xmin, ymin, xmax, ymax) in normalized + device coordinates, where the range 0 to 1 corresponds to the + aperture. (0,0) corresponds to the bottom-left + corner and (1,1) corresponds to the upper-right corner. + + Specifying a window outside the unit square will produce + overscan data. Specifying a window that does not cover the unit + square will produce a cropped render. + + A pixel is included in the rendered result if the pixel + center is contained by the data window. This is consistent + with standard rules used by polygon rasterization engines. + \\ref UsdRenderRasterization + + The data window is expressed in NDC so that cropping and + overscan may be resolution independent. In interactive + workflows, incremental cropping and resolution adjustment + may be intermixed to isolate and examine parts of the scene. + In compositing workflows, overscan may be used to support + image post-processing kernels, and reduced-resolution proxy + renders may be used for faster iteration. + + The dataWindow:ndc coordinate system references the + aperture after any adjustments required by + aspectRatioConformPolicy. + """ + ) + uniform bool instantaneousShutter = false ( + doc = """Deprecated - use disableMotionBlur instead. Override + the targeted _camera_'s _shutterClose_ to be equal to the + value of its _shutterOpen_, to produce a zero-width shutter + interval. This gives us a convenient way to disable motion + blur.""" + ) + uniform bool disableMotionBlur = false ( + doc = """Disable all motion blur by setting the shutter interval + of the targeted camera to [0,0] - that is, take only one sample, + namely at the current time code.""" + ) + uniform bool disableDepthOfField = false ( + doc = """Disable all depth of field by setting F-stop of the targeted + camera to infinity.""" + ) +} + +class RenderSettings "RenderSettings" ( + inherits = + doc = """A UsdRenderSettings prim specifies global settings for + a render process, including an enumeration of the RenderProducts + that should result, and the UsdGeomImageable purposes that should + be rendered. \\ref UsdRenderHowSettingsAffectRendering""" + customData = { + string className = "Settings" + } +) +{ + rel products ( + doc = """The set of RenderProducts the render should produce. + This relationship should target UsdRenderProduct prims. + If no _products_ are specified, an application should produce + an rgb image according to the RenderSettings configuration, + to a default display or image name.""" + ) + uniform token[] includedPurposes = ["default", "render"] ( + doc = """The list of UsdGeomImageable _purpose_ values that + should be included in the render. Note this cannot be + specified per-RenderProduct because it is a statement of + which geometry is present.""" + ) + uniform token[] materialBindingPurposes = ["full", ""] ( + allowedTokens = ["full", "preview", ""] + doc = """Ordered list of material purposes to consider when + resolving material bindings in the scene. The empty string + indicates the "allPurpose" binding.""" + ) + uniform token renderingColorSpace ( + doc = """Describes a renderer's working (linear) colorSpace where all + the renderer/shader math is expected to happen. When no + renderingColorSpace is provided, renderer should use its own default.""" + ) +} + +class RenderVar "RenderVar" ( + inherits = + doc = """A UsdRenderVar describes a custom data variable for + a render to produce. The prim describes the source of the data, which + can be a shader output or an LPE (Light Path Expression), and also + allows encoding of (generally renderer-specific) parameters that + configure the renderer for computing the variable. + + \\note The name of the RenderVar prim drives the name of the data + variable that the renderer will produce. + + \\note In the future, UsdRender may standardize RenderVar representation + for well-known variables under the sourceType `intrinsic`, + such as _r_, _g_, _b_, _a_, _z_, or _id_. + """ + customData = { + string className = "Var" + } +) { + uniform token dataType = "color3f" ( + doc = """The type of this channel, as a USD attribute type.""" + ) + uniform string sourceName = "" ( + doc = """The renderer should look for an output of this name + as the computed value for the RenderVar.""" + ) + uniform token sourceType = "raw" ( + doc = """Indicates the type of the source. + + - "raw": The name should be passed directly to the + renderer. This is the default behavior. + - "primvar": This source represents the name of a primvar. + Some renderers may use this to ensure that the primvar + is provided; other renderers may require that a suitable + material network be provided, in which case this is simply + an advisory setting. + - "lpe": Specifies a Light Path Expression in the + [OSL Light Path Expressions language](https://github.com/imageworks/OpenShadingLanguage/wiki/OSL-Light-Path-Expressions) as the source for + this RenderVar. Some renderers may use extensions to + that syntax, which will necessarily be non-portable. + - "intrinsic": This setting is currently unimplemented, + but represents a future namespace for UsdRender to provide + portable baseline RenderVars, such as camera depth, that + may have varying implementations for each renderer. + """ + allowedTokens = ["raw", "primvar", "lpe", "intrinsic"] + ) +} + +class RenderProduct "RenderProduct" ( + inherits = + doc = """A UsdRenderProduct describes an image or other + file-like artifact produced by a render. A RenderProduct + combines one or more RenderVars into a file or interactive + buffer. It also provides all the controls established in + UsdRenderSettingsBase as optional overrides to whatever the + owning UsdRenderSettings prim dictates. + + Specific renderers may support additional settings, such + as a way to configure compression settings, filetype metadata, + and so forth. Such settings can be encoded using + renderer-specific API schemas applied to the product prim. + """ + customData = { + string className = "Product" + dictionary schemaTokens = { + dictionary raster = { + string doc = """RenderProduct productType value that + indicates a 2D raster image of pixels.""" + } + } + } +) { + uniform token productType = "raster" ( + doc = """The type of output to produce. + The default, "raster", indicates a 2D image. + + \\note In the future, UsdRender may define additional product + types.""" + ) + token productName = "" ( + doc = """Specifies the name that the output/display driver + should give the product. This is provided as-authored to the + driver, whose responsibility it is to situate the product on a + filesystem or other storage, in the desired location.""" + ) + rel orderedVars ( + doc = """Specifies the RenderVars that should be consumed and + combined into the final product. If ordering is relevant to the + output driver, then the ordering of targets in this relationship + provides the order to use.""" + ) +} + + +class RenderPass "RenderPass" ( + inherits = + doc = """A RenderPass prim encapsulates the necessary information + to generate multipass renders. It houses properties for generating + dependencies and the necessary commands to run to generate renders, as + well as visibility controls for the scene. While RenderSettings + describes the information needed to generate images from a single + invocation of a renderer, RenderPass describes the additional information + needed to generate a time varying set of images. + + There are two consumers of RenderPass prims - a runtime executable that + generates images from usdRender prims, and pipeline specific code that + translates between usdRender prims and the pipeline's resource scheduling + software. We'll refer to the latter as 'job submission code'. + + \\anchor usdRender_renderVisibility + The objects that are relevant to the render is specified via the + renderVisibility collection (UsdCollectionAPI) and can be accessed via + GetRenderVisibilityCollectionAPI(). This collection has includeRoot set to + true so that all objects participate in the render by default. To render + only a specific set of objects, there are two options. One is to modify the + collection paths to explicitly exclude objects that don't participate in + the render, assuming it is known; the other option is to set includeRoot to + false and explicitly include the desired objects. These are complementary + approaches that may each be preferable depending on the scenario. + + The name of the prim is used as the pass's name. + """ + customData = { + string className = "Pass" + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" """ + } + prepend apiSchemas = ["CollectionAPI:renderVisibility"] +) { + uniform token passType ( + doc = """A string used to categorize differently structured + or executed types of passes within a customized pipeline. + + For example, when multiple DCC's (e.g. Houdini, Katana, Nuke) + each compute and contribute different Products to a final result, + it may be clearest and most flexible to create a separate + RenderPass for each. + """ + ) + + uniform string[] command ( + doc = """The command to run in order to generate + renders for this pass. The job submission code can use + this to properly send tasks to the job scheduling software + that will generate products. + + The command can contain variables that will be substituted + appropriately during submission, as seen in the example below + with {fileName}. + + For example: + command[0] = "prman" + command[1] = "-progress" + command[2] = "-pixelvariance" + command[3] = "-0.15" + command[4] = "{fileName}" # the fileName property will be substituted + """ + ) + + rel renderSource ( + doc = """The source prim to render from. If _fileName_ is not present, + the source is assumed to be a RenderSettings prim present in the current + Usd stage. If fileName is present, the source should be found in the + file there. This relationship might target a string attribute on this + or another prim that identifies the appropriate object in the external + container. + + For example, for a Usd-backed pass, this would point to a RenderSettings + prim. Houdini passes would point to a Rop. Nuke passes would point to + a write node. + """ + ) + + rel inputPasses ( + doc = """The set of other Passes that this Pass depends on + in order to be constructed properly. For example, a Pass A + may generate a texture, which is then used as an input to + Pass B. + + By default, usdRender makes some assumptions about the + relationship between this prim and the prims listed in inputPasses. + Namely, when per-frame tasks are generated from these pass prims, + usdRender will assume a one-to-one relationship between tasks + that share their frame number. Consider a pass named 'composite' + whose _inputPasses_ targets a Pass prim named 'beauty`. + By default, each frame for 'composite' will depend on the + same frame from 'beauty': + beauty.1 -> composite.1 + beauty.2 -> composite.2 + etc + + The consumer of this RenderPass graph of inputs will need to resolve + the transitive dependencies. + """ + ) + + uniform asset fileName ( + doc = """The asset that contains the rendering prims or other + information needed to render this pass. + """ + ) + + uniform bool denoise:enable = false ( + doc = """When True, this Pass pass should be denoised.""" + ) + + rel denoise:pass ( + doc = """The The UsdRenderDenoisePass prim from which to + source denoise settings. + """ + ) + + uniform bool collection:renderVisibility:includeRoot = 1 ( + customData = { + bool apiSchemaOverride = true + } + ) +} + + +class RenderDenoisePass "RenderDenoisePass" ( + inherits = + doc = """A RenderDenoisePass generates renders via a denoising process. + This may be the same renderer that a pipeline uses for UsdRender, + or may be a separate one. Notably, a RenderDenoisePass requires + another Pass to be present for it to operate. The denoising process + itself is not generative, and requires images inputs to operate. + + As denoising integration varies so widely across pipelines, all + implementation details are left to pipeline-specific prims + that inherit from RenderDenoisePass. + """ + customData = { + string className = "DenoisePass" + } +) { +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class NodeGraph "NodeGraph" ( + doc = '''A node-graph is a container for shading nodes, as well as other + node-graphs. It has a public input interface and provides a list of public + outputs. + + Node Graph Interfaces + + One of the most important functions of a node-graph is to host the "interface" + with which clients of already-built shading networks will interact. Please + see "Interface Inputs" for a detailed + explanation of what the interface provides, and how to construct and + use it, to effectively share/instance shader networks. + + Node Graph Outputs + + These behave like outputs on a shader and are typically connected to an + output on a shader inside the node-graph. + ''' +) +{ +} + +class Material "Material" ( + doc = """A Material provides a container into which multiple \"render contexts\" + can add data that defines a \"shading material\" for a renderer. Typically + this consists of one or more UsdShadeOutput properties connected to outputs + of nested Shader prims - though a context/client is free to add + any data that is suitable. We strongly advise that all contexts + adopt the convention that all properties be prefixed with a namespace + that identifies the context e.g. \"token outputs:ri:surface.connect = + resolved Material that will be used to shade the gprim (exceptions, + of course, for gprims that possess UsdGeomSubsets, as each subset can be + shaded by a different Material). A gprim and each of its ancestor + prims can possess, through the MaterialBindingAPI, both a + direct binding to a Material, and any number of + collection-based bindings to Materials; each binding can be generic + or declared for a particular purpose, and given a specific binding + strength. It is the process of \"material resolution\" (see + that examines all of + these bindings, and selects the one Material that best matches the + client's needs. + + The intent of purpose is that each gprim should be able to resolve a + Material for any given purpose, which implies it can have differently bound + materials for different purposes. There are two special values of + purpose defined in UsdShade, although the API fully supports + specifying arbitrary values for it, for the sake of extensibility: +
  • UsdShadeTokens->full: to be used when the purpose of the + render is entirely to visualize the truest representation of a scene, + considering all lighting and material information, at highest fidelity.
  • +
  • UsdShadeTokens->preview: to be used when the render is in + service of a goal other than a high fidelity \"full\" render (such as scene + manipulation, modeling, or realtime playback). Latency and speed are + generally of greater concern for preview renders, therefore preview + materials are generally designed to be \"lighterweight\" compared to full + materials.
+ A binding can also have no specific purpose at all, in which + case, it is considered to be the fallback or all-purpose binding (denoted + by the empty-valued token UsdShadeTokens->allPurpose). + + The purpose of a material binding is encoded in the name of the + binding relationship. +
  • + In the case of a direct binding, the allPurpose binding is + represented by the relationship named material:binding. + Special-purpose direct bindings are represented by relationships named + material:binding:purpose. A direct binding relationship + must have a single target path that points to a UsdShadeMaterial.
  • +
  • + In the case of a collection-based binding, the allPurpose binding is + represented by a relationship named + material:binding:collection:bindingName, where + bindingName establishes an identity for the binding that is unique + on the prim. Attempting to establish two collection bindings of the same + name on the same prim will result in the first binding simply being + overridden. A special-purpose collection-based binding is represented by a + relationship named material:binding:collection:purpose:bindingName. + A collection-based binding relationship must have exacly two targets, one of + which should be a collection-path (see + and the other should point to a + UsdShadeMaterial. In the future, we may allow a single collection + binding to target multiple collections, if we can establish a reasonable + round-tripping pattern for applications that only allow a single collection + to be associated with each Material. +
  • +
+ + Note: Both bindingName and purpose must be + non-namespaced tokens. This allows us to know the role of a binding + relationship simply from the number of tokens in it. +
  • Two tokens: the fallback, \"all purpose\", direct binding, + material:binding
  • +
  • Three tokens: a purpose-restricted, direct, fallback binding, + e.g. material:binding:preview
  • +
  • Four tokens: an all-purpose, collection-based binding, e.g. + material:binding:collection:metalBits
  • +
  • Five tokens: a purpose-restricted, collection-based binding, + e.g. material:binding:collection:full:metalBits
  • +
+ + A binding-strength value is used to specify whether a binding + authored on a prim should be weaker or stronger than bindings that appear + lower in namespace. We encode the binding strength with as token-valued + metadata 'bindMaterialAs' for future flexibility, even though for + now, there are only two possible values: + UsdShadeTokens->weakerThanDescendants and + UsdShadeTokens->strongerThanDescendants. When binding-strength is + not authored (i.e. empty) on a binding-relationship, the default behavior + matches UsdShadeTokens->weakerThanDescendants. + + \\note If a material binding relationship is a built-in property defined as + part of a typed prim's schema, a fallback value should not be provided for + it. This is because the \"material resolution\" algorithm only conisders + authored properties. + """ +) +{ +} + +class "CoordSysAPI" ( + doc = '''UsdShadeCoordSysAPI provides a way to designate, name, + and discover coordinate systems. + + Coordinate systems are implicitly established by UsdGeomXformable + prims, using their local space. That coordinate system may be + bound (i.e., named) from another prim. The binding is encoded + as a single-target relationship. + Coordinate system bindings apply to descendants of the prim + where the binding is expressed, but names may be re-bound by + descendant prims. + + CoordSysAPI is a multi-apply API schema, where instance names + signify the named coordinate systems. The instance names are + used with the "coordSys:" namespace to determine the binding + to the UsdGeomXformable prim. + + Named coordinate systems are useful in shading (and other) workflows. + An example is projection paint, which projects a texture + from a certain view (the paint coordinate system), encoded as + (e.g.) "rel coordSys:paint:binding". Using the paint coordinate frame + avoids the need to assign a UV set to the object, and can be a + concise way to project paint across a collection of objects with + a single shared paint coordinate system. + ''' +) +{ + rel coordSys:__INSTANCE_NAME__:binding ( + displayName = "Bound Coordinate System" + doc = "Prim binding expressing the appropriate coordinate systems." + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "bindMaterialAs": { + "appliesTo": [ + "relationships" + ], + "displayGroup": "Shading", + "documentation": "Metadata authored on collection-based material binding relationship to indicate the strength of the binding relative to bindings authored on descendant prims.", + "type": "token" + }, + "connectability": { + "appliesTo": [ + "attributes" + ], + "default": "full", + "displayGroup": "Shading", + "documentation": "Metadata authored on UsdShadeInput's to specify what they can be connected to. Can be either \"full\" or \"interfaceOnly\". \"full\" implies that the input can be connected to any other input or output. \"interfaceOnly\" implies that the input can only connect to a NodeGraph Input (which represents an interface override, not a render-time dataflow connection), or another Input whose connectability is also \"interfaceOnly\".", + "type": "token" + }, + "outputName": { + "appliesTo": [ + "relationships" + ], + "displayGroup": "deprecated", + "type": "token" + }, + "renderType": { + "appliesTo": [ + "properties" + ], + "displayGroup": "Rendering", + "type": "token" + }, + "sdrMetadata": { + "appliesTo": [ + "prims", + "attributes" + ], + "displayGroup": "Shading", + "type": "dictionary" + } + }, + "Types": { + "UsdShadeConnectableAPI": { + "alias": { + "UsdSchemaBase": "ConnectableAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "nonAppliedAPI" + }, + "UsdShadeCoordSysAPI": { + "alias": { + "UsdSchemaBase": "CoordSysAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "multipleApplyAPI" + }, + "UsdShadeMaterial": { + "alias": { + "UsdSchemaBase": "Material" + }, + "autoGenerated": true, + "bases": [ + "UsdShadeNodeGraph" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeMaterialBindingAPI": { + "alias": { + "UsdSchemaBase": "MaterialBindingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdShadeNodeDefAPI": { + "alias": { + "UsdSchemaBase": "NodeDefAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdShadeNodeGraph": { + "alias": { + "UsdSchemaBase": "NodeGraph" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeShader": { + "alias": { + "UsdSchemaBase": "Shader" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "providesUsdShadeConnectableAPIBehavior": true, + "schemaKind": "concreteTyped" + }, + "UsdShadeShaderDefParserPlugin": { + "bases": [ + "NdrParserPlugin" + ], + "displayName": "USD-based shader definition parser plugin" + } + } + }, + "LibraryPath": "", + "Name": "usdShade", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + "This file describes the USD Shader schemata for code generation." + subLayers = [ + @usd/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdShade" + string libraryPath = "pxr/usd/usdShade" + dictionary libraryTokens = { + dictionary materialBind = { + string doc = """The name of the GeomSubset family used to + identify face subsets defined for the purpose of binding + materials to facesets. + """ + } + dictionary full = { + string doc= """Possible value for 'connectability' metadata on + a UsdShadeInput. When connectability of an input is set to + "full", it implies that it can be connected to any input or + output. + """ + } + dictionary interfaceOnly = { + string doc= """Possible value for 'connectability' metadata on + a UsdShadeInput. It implies that the input can only connect to + a NodeGraph Input (which represents an interface override, not + a render-time dataflow connection), or another Input whose + connectability is also 'interfaceOnly'. + """ + } + dictionary outputs = { + string value = "outputs:" + string doc = """The prefix on shading attributes + denoting an output. + """ + } + dictionary inputs = { + string value = "inputs:" + string doc = """The prefix on shading attributes + denoting an input. + """ + } + } + } +) +{ +} + +class NodeGraph "NodeGraph" ( + inherits = + doc = """A node-graph is a container for shading nodes, as well as other + node-graphs. It has a public input interface and provides a list of public + outputs. + + Node Graph Interfaces + + One of the most important functions of a node-graph is to host the "interface" + with which clients of already-built shading networks will interact. Please + see \\ref UsdShadeNodeGraph_Interfaces "Interface Inputs" for a detailed + explanation of what the interface provides, and how to construct and + use it, to effectively share/instance shader networks. + + Node Graph Outputs + + These behave like outputs on a shader and are typically connected to an + output on a shader inside the node-graph. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = ''' +#include +#include "pxr/usd/usd/editTarget.h" +#include "pxr/usd/usd/relationship.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/shader.h" +#include "pxr/usd/usdShade/connectableAPIBehavior.h"''' + } +) { + +} + + +class Material "Material" ( + inherits = + doc = """A Material provides a container into which multiple "render contexts" + can add data that defines a "shading material" for a renderer. Typically + this consists of one or more UsdShadeOutput properties connected to outputs + of nested Shader prims - though a context/client is free to add + any data that is suitable. We strongly advise that all contexts + adopt the convention that all properties be prefixed with a namespace + that identifies the context e.g. "token outputs:ri:surface.connect = + surface output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the surface of a + UsdShadeMaterial. + """ + } + dictionary displacement = { + string doc = """Describes the displacement output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the displacement of a + UsdShadeMaterial. + """ + } + dictionary volume = { + string doc = """Describes the volume output + terminal on a UsdShadeMaterial. It is used to define the + terminal UsdShadeShader describing the volume of a + UsdShadeMaterial. + """ + } + dictionary universalRenderContext = { + string value = "" + string doc = """Possible value for the "renderContext" parameter + in \\ref UsdShadeMaterial_Outputs API. Represents the universal + renderContext. An output with a universal renderContext is + applicable to all possible rendering contexts. + """ + } + } + } +) +{ + token outputs:surface ( + doc = """Represents the universal "surface" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "surface" + } + ) + token outputs:displacement ( + doc = """Represents the universal "displacement" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "displacement" + } + ) + token outputs:volume ( + doc = """Represents the universal "volume" output terminal of a + material.""" + displayGroup = "Outputs" + customData = { + string apiName = "volume" + } + ) +} + +class Shader "Shader" ( + inherits = + prepend apiSchemas = ["NodeDefAPI"] + doc = """Base class for all USD shaders. Shaders are the building blocks + of shading networks. While UsdShadeShader objects are not target specific, + each renderer or application target may derive its own renderer-specific + shader object types from this base, if needed. + + Objects of this class generally represent a single shading object, whether + it exists in the target renderer or not. For example, a texture, a fractal, + or a mix node. + + The UsdShadeNodeDefAPI provides attributes to uniquely identify the + type of this node. The id resolution into a renderable shader target + type of this node. The id resolution into a renderable shader target + is deferred to the consuming application. + + The purpose of representing them in Usd is two-fold: + \\li To represent, via "connections" the topology of the shading network + that must be reconstructed in the renderer. Facilities for authoring and + manipulating connections are encapsulated in the API schema + UsdShadeConnectableAPI. + \\li To present a (partial or full) interface of typed input parameters + whose values can be set and overridden in Usd, to be provided later at + render-time as parameter values to the actual render shader objects. Shader + input parameters are encapsulated in the property schema UsdShadeInput. + """ + customData = { + dictionary extraPlugInfo = { + bool providesUsdShadeConnectableAPIBehavior = 1 + } + string extraIncludes = ''' +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/tokens.h" +#include "pxr/usd/ndr/declare.h" +#include "pxr/usd/sdr/shaderNode.h"''' + } +) { +} + +class "NodeDefAPI" +( + inherits = + doc = """UsdShadeNodeDefAPI is an API schema that provides attributes + for a prim to select a corresponding Shader Node Definition ("Sdr Node"), + as well as to look up a runtime entry for that shader node in the + form of an SdrShaderNode. + + UsdShadeNodeDefAPI is intended to be a pre-applied API schema for any + prim type that wants to refer to the SdrRegistry for further implementation + details about the behavior of that prim. The primary use in UsdShade + itself is as UsdShadeShader, which is a basis for material shading networks + (UsdShadeMaterial), but this is intended to be used in other domains + that also use the Sdr node mechanism. + + This schema provides properties that allow a prim to identify an external + node definition, either by a direct identifier key into the SdrRegistry + (info:id), an asset to be parsed by a suitable NdrParserPlugin + (info:sourceAsset), or an inline source code that must also be parsed + (info:sourceCode); as well as a selector attribute to determine which + specifier is active (info:implementationSource). + """ + customData = { + token apiSchemaType = "singleApply" + string extraIncludes = """ +#include "pxr/usd/ndr/declare.h" +#include "pxr/usd/sdr/shaderNode.h" + """ + dictionary schemaTokens = { + dictionary universalSourceType = { + string value = "" + string doc = """Possible value for the "sourceType" parameter + in \\ref UsdShadeNodeDefAPI_ImplementationSource API. Represents + the universal or fallback source type. + """ + } + dictionary sdrMetadata = { + string doc = """Dictionary valued metadata key authored on + Shader prims with implementationSource value of sourceAsset or + sourceCode to pass along metadata to the shader parser or + compiler. It is also used to author metadata on shader + properties in a UsdShade-based shader definition file. + """ + } + dictionary subIdentifier = { + string doc = """This identifier is used in conjunction with a + specific source asset to indicate a particular definition within + the source asset, if the source asset specifies more than one + shader node definition. + """ + } + } + } +) +{ + uniform token info:implementationSource = "id" ( + allowedTokens = ["id", "sourceAsset", "sourceCode"] + doc = """Specifies the attribute that should be consulted to get the + shader's implementation or its source code. + + * If set to "id", the "info:id" attribute's value is used to + determine the shader source from the shader registry. + * If set to "sourceAsset", the resolved value of the "info:sourceAsset" + attribute corresponding to the desired implementation (or source-type) + is used to locate the shader source. A source asset file may also + specify multiple shader definitions, so there is an optional attribute + "info:sourceAsset:subIdentifier" whose value should be used to indicate + a particular shader definition from a source asset file. + * If set to "sourceCode", the value of "info:sourceCode" attribute + corresponding to the desired implementation (or source type) is used as + the shader source. + """ + customData = { + string apiName = "implementationSource" + } + ) + + uniform token info:id ( + doc = """The id is an identifier for the type or purpose of the + shader. E.g.: Texture or FractalFloat. + The use of this id will depend on the render context: some will turn it + into an actual shader path, some will use it to generate shader source + code dynamically. + + \\sa SetShaderId() + """ + customData = { + string apiName = "id" + } + ) +} + +class "ConnectableAPI" +( + inherits = + doc = """UsdShadeConnectableAPI is an API schema that provides a common + interface for creating outputs and making connections between shading + parameters and outputs. The interface is common to all UsdShade schemas + that support Inputs and Outputs, which currently includes UsdShadeShader, + UsdShadeNodeGraph, and UsdShadeMaterial . + + One can construct a UsdShadeConnectableAPI directly from a UsdPrim, or + from objects of any of the schema classes listed above. If it seems + onerous to need to construct a secondary schema object to interact with + Inputs and Outputs, keep in mind that any function whose purpose is either + to walk material/shader networks via their connections, or to create such + networks, can typically be written entirely in terms of + UsdShadeConnectableAPI objects, without needing to care what the underlying + prim type is. + + Additionally, the most common UsdShadeConnectableAPI behaviors + (creating Inputs and Outputs, and making connections) are wrapped as + convenience methods on the prim schema classes (creation) and + UsdShadeInput and UsdShadeOutput. + """ + customData = { + token apiSchemaType = "nonApplied" + string extraIncludes = ''' +#include "pxr/usd/usd/typed.h" +#include "pxr/usd/usdShade/input.h" +#include "pxr/usd/usdShade/output.h" +#include "pxr/usd/usdShade/tokens.h" +#include "pxr/usd/usdShade/types.h"''' + } +) +{ +} + +class "MaterialBindingAPI" +( + inherits = + doc = """UsdShadeMaterialBindingAPI is an API schema that provides an + interface for binding materials to prims or collections of prims + (represented by UsdCollectionAPI objects). + + In the USD shading model, each renderable gprim computes a single + resolved Material that will be used to shade the gprim (exceptions, + of course, for gprims that possess UsdGeomSubsets, as each subset can be + shaded by a different Material). A gprim and each of its ancestor + prims can possess, through the MaterialBindingAPI, both a + direct binding to a Material, and any number of + collection-based bindings to Materials; each binding can be generic + or declared for a particular purpose, and given a specific binding + strength. It is the process of "material resolution" (see + \\ref UsdShadeMaterialBindingAPI_MaterialResolution) that examines all of + these bindings, and selects the one Material that best matches the + client's needs. + + The intent of purpose is that each gprim should be able to resolve a + Material for any given purpose, which implies it can have differently bound + materials for different purposes. There are two special values of + purpose defined in UsdShade, although the API fully supports + specifying arbitrary values for it, for the sake of extensibility: +
  • UsdShadeTokens->full: to be used when the purpose of the + render is entirely to visualize the truest representation of a scene, + considering all lighting and material information, at highest fidelity.
  • +
  • UsdShadeTokens->preview: to be used when the render is in + service of a goal other than a high fidelity "full" render (such as scene + manipulation, modeling, or realtime playback). Latency and speed are + generally of greater concern for preview renders, therefore preview + materials are generally designed to be "lighterweight" compared to full + materials.
+ A binding can also have no specific purpose at all, in which + case, it is considered to be the fallback or all-purpose binding (denoted + by the empty-valued token UsdShadeTokens->allPurpose). + + The purpose of a material binding is encoded in the name of the + binding relationship. +
  • + In the case of a direct binding, the allPurpose binding is + represented by the relationship named material:binding. + Special-purpose direct bindings are represented by relationships named + material:binding:purpose. A direct binding relationship + must have a single target path that points to a UsdShadeMaterial.
  • +
  • + In the case of a collection-based binding, the allPurpose binding is + represented by a relationship named + material:binding:collection:bindingName, where + bindingName establishes an identity for the binding that is unique + on the prim. Attempting to establish two collection bindings of the same + name on the same prim will result in the first binding simply being + overridden. A special-purpose collection-based binding is represented by a + relationship named material:binding:collection:purpose:bindingName. + A collection-based binding relationship must have exacly two targets, one of + which should be a collection-path (see + \ref UsdCollectionAPI::GetCollectionPath()) and the other should point to a + UsdShadeMaterial. In the future, we may allow a single collection + binding to target multiple collections, if we can establish a reasonable + round-tripping pattern for applications that only allow a single collection + to be associated with each Material. +
  • +
+ + Note: Both bindingName and purpose must be + non-namespaced tokens. This allows us to know the role of a binding + relationship simply from the number of tokens in it. +
  • Two tokens: the fallback, "all purpose", direct binding, + material:binding
  • +
  • Three tokens: a purpose-restricted, direct, fallback binding, + e.g. material:binding:preview
  • +
  • Four tokens: an all-purpose, collection-based binding, e.g. + material:binding:collection:metalBits
  • +
  • Five tokens: a purpose-restricted, collection-based binding, + e.g. material:binding:collection:full:metalBits
  • +
+ + A binding-strength value is used to specify whether a binding + authored on a prim should be weaker or stronger than bindings that appear + lower in namespace. We encode the binding strength with as token-valued + metadata 'bindMaterialAs' for future flexibility, even though for + now, there are only two possible values: + UsdShadeTokens->weakerThanDescendants and + UsdShadeTokens->strongerThanDescendants. When binding-strength is + not authored (i.e. empty) on a binding-relationship, the default behavior + matches UsdShadeTokens->weakerThanDescendants. + + \\note If a material binding relationship is a built-in property defined as + part of a typed prim's schema, a fallback value should not be provided for + it. This is because the "material resolution" algorithm only conisders + authored properties. + """ + customData = { + string extraIncludes = """ +#include "pxr/usd/usd/collectionAPI.h" +#include "pxr/usd/usdGeom/subset.h" +#include "pxr/usd/usdShade/material.h" +#include """ + dictionary schemaTokens = { + dictionary materialBinding = { + string value = "material:binding" + string doc = """ + The relationship name on non-shading prims to + denote a binding to a UsdShadeMaterial. + """ + } + dictionary materialBindingCollection = { + string value = "material:binding:collection" + string doc = """ + The relationship name on non-shading prims to + denote a collection-based binding to a UsdShadeMaterial. + """ + } + dictionary allPurpose = { + string value = "" + string doc = """Possible value for the 'materialPurpose' parameter + in the various methods available in UsdShadeMaterialBindingAPI. + Its value is empty and its purpose is to represent a general + purpose material-binding that applies in the absence of a + specific-purpose binding. + """ + } + dictionary preview = { + string doc = """Possible value for the 'materialPurpose' + parameter in UsdShadeMaterialBindingAPI, to be used when the + render is in service of a goal other than a high fidelity "full" + render (such as scene manipulation, modeling, or realtime + playback). Latency and speed are generally of greater concern + for preview renders, therefore preview materials are generally + designed to be "lighterweight" compared to full materials. + """ + } + + dictionary full = { + string doc= """Possible value for the 'materialPurpose' + parameter in UsdShadeMaterialBindingAPI, to be used when the + purpose of the render is entirely about visualizing the truest + representation of a scene, considering all lighting and material + information, at highest fidelity. + """ + } + dictionary bindMaterialAs = { + string doc = """Token valued metadata key authored on a material + binding relationship to indicate the strength of the binding + relative to bindings authored on descendants. + """ + } + dictionary weakerThanDescendants = { + string doc = """Possible value for 'bindMaterialAs' metadata on the + collection-based material binding relationship. Indicates + that the binding represented by the relationship is weaker than + any bindings authored on the descendants.""" + } + dictionary strongerThanDescendants = { + string doc = """Possible value for 'bindMaterialAs' metadata on the + collection-based material binding relationship. Indicates + that the binding represented by the relationship is stronger than + any bindings authored on the descendants.""" + } + dictionary fallbackStrength = { + string doc = """Sentinal value to be used for 'bindMaterialAs' + metadata's default value. Clients should pass this in for the + 'bindingStrength' argument to UsdShadeMaterialBindingAPI::Bind(), + if they want to author the default value (weakerThanDescendants) + sparsely. The value "fallbackStrength" never gets authored + into scene description.""" + } + } + } +) +{ + +} + +class "CoordSysAPI" +( + inherits = + doc = """UsdShadeCoordSysAPI provides a way to designate, name, + and discover coordinate systems. + + Coordinate systems are implicitly established by UsdGeomXformable + prims, using their local space. That coordinate system may be + bound (i.e., named) from another prim. The binding is encoded + as a single-target relationship. + Coordinate system bindings apply to descendants of the prim + where the binding is expressed, but names may be re-bound by + descendant prims. + + CoordSysAPI is a multi-apply API schema, where instance names + signify the named coordinate systems. The instance names are + used with the "coordSys:" namespace to determine the binding + to the UsdGeomXformable prim. + + Named coordinate systems are useful in shading (and other) workflows. + An example is projection paint, which projects a texture + from a certain view (the paint coordinate system), encoded as + (e.g.) "rel coordSys:paint:binding". Using the paint coordinate frame + avoids the need to assign a UV set to the object, and can be a + concise way to project paint across a collection of objects with + a single shared paint coordinate system. + """ + customData = { + token apiSchemaType = "multipleApply" + token propertyNamespacePrefix = "coordSys" + string extraIncludes = ''' +#include "pxr/usd/usdGeom/xformable.h"''' + } +) +{ + rel binding ( + displayName = "Bound Coordinate System" + doc = "Prim binding expressing the appropriate coordinate systems." + ) +} +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdShadersDiscoveryPlugin" : { + "bases": ["NdrDiscoveryPlugin"], + "displayName": "USD-based shader definition discovery plugin." + } + }, + # Allow usdShaders/shaders to be accessible by hio/glslfx.cpp's + # ShaderResourceRegistry + "ShaderResources": "shaders" + }, + "LibraryPath": "", + "Name": "usdShaders", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +#import $TOOLS/hdSt/shaders/surfaceHelpers.glslfx + +-- configuration +{ + "techniques": { + "default": { + "displacementShader": { + "source": [ "Preview.Displacement" ] + }, + "surfaceShader": { + "source": [ "Preview.LightStructures", + "SurfaceHelpers.Lighting", + "Preview.Lighting", + "Preview.LightIntegration", + "SurfaceHelpers.TangentSpace", + "Preview.NormalMapping", + "Preview.Surface" ] + } + } + } +} + + +-- glsl Preview.Displacement + +vec4 +displacementShader(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) +{ + // Calculate scalar displacement. + float texDisplacement = HdGetScalar_displacement(index); + return Peye + vec4(Neye*texDisplacement, 0); +} + + +-- glsl Preview.Surface + +vec4 +surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + float clearcoatAmount = HdGetScalar_clearcoat(); + float clearcoatRoughness = HdGetScalar_clearcoatRoughness(); + vec3 diffuseColor = HdGet_diffuseColor().xyz; + vec3 emissiveColor = HdGet_emissiveColor().xyz; + float ior = HdGetScalar_ior(); + float metallic = HdGetScalar_metallic(); + float occlusion = HdGetScalar_occlusion(); + float opacity = HdGetScalar_opacity(); + float opacityThreshold = HdGetScalar_opacityThreshold(); + float roughness = HdGetScalar_roughness(); + vec3 specularColor = HdGet_specularColor().xyz; + bool useSpecularWorkflow = (HdGetScalar_useSpecularWorkflow() == 1); + + vec3 clearcoatColor = vec3(1.0); + float specularAmount = 1.0; + +#ifdef HD_MATERIAL_TAG_MASKED + if (opacity < opacityThreshold) { + discard; + return vec4(1.0); + } + opacity = 1.0; +#endif + + // Selection highlighting. + vec4 colorAndOpacity = vec4(diffuseColor, opacity); + diffuseColor = ApplyColorOverrides(colorAndOpacity).rgb; + + // Pre-multiply diffuse color by opacity if not done so already +#ifndef diffuseColor_IS_PREMULTIPLIED + diffuseColor *= opacity; +#endif + + // Evaluate all lights. + vec3 c = evaluateLights( + emissiveColor, + diffuseColor, + useSpecularWorkflow, + ior, + metallic, + specularAmount, + specularColor, + roughness, + clearcoatAmount, + clearcoatColor, + clearcoatRoughness, + occlusion, + Peye, + perturbFragmentNormal(Peye.xyz, Neye)); + + return vec4(c, colorAndOpacity.a); +} + + +-- glsl Preview.LightStructures + +struct LightingContributions +{ + vec3 diffuse; + vec3 specular; +}; + + +-- glsl Preview.Lighting + +#define EPSILON 0.001 + + +float +SchlickFresnel(float EdotH) +{ + return pow(max(0.0, 1.0 - EdotH), 5.0); +} + +float +NormalDistribution(float specularRoughness, float NdotH) +{ + float alpha = specularRoughness * specularRoughness; + float alpha2 = alpha * alpha; + float NdotH2 = NdotH * NdotH; + float DDenom = (NdotH2 * (alpha2 - 1.0)) + 1.0; + DDenom *= DDenom; + DDenom *= PI; + float D = (alpha2 + EPSILON) / DDenom; + return D; +} + +float +Geometric( + float specularRoughness, + float NdotL, + float NdotE, + float NdotH, + float EdotH) +{ + float alpha = specularRoughness * specularRoughness; + float k = alpha * 0.5; + float G = NdotE / (NdotE * (1.0 - k) + k); + G *= NdotL / (NdotL * (1.0 - k) + k); + return G; +} + +vec3 +evaluateDirectDiffuse() +{ + return vec3(1.0 / PI); +} + +vec3 +evaluateDirectSpecular( + vec3 specularColorF0, + vec3 specularColorF90, + float specularRoughness, + float fresnel, + float NdotL, + float NdotE, + float NdotH, + float EdotH) +{ + vec3 F = mix(specularColorF0, specularColorF90, fresnel); + float D = NormalDistribution(specularRoughness, NdotH); + float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH); + vec3 RNum = F * G * D; + float RDenom = 4.0f * NdotL * NdotE + EPSILON; + return RNum / RDenom; +} + +LightingContributions +evaluateLight( + vec3 diffuseColor, + bool useSpecularWorkflow, + float ior, + float metallic, + float specularAmount, + vec3 specularColor, + float specularRoughness, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + float occlusion, + float NdotL, + float NdotE, + float NdotH, + float EdotH, + vec3 lightDiffuseIrradiance, + vec3 lightSpecularIrradiance) +{ + specularRoughness = max(0.001, specularRoughness); + clearcoatRoughness = max(0.001, clearcoatRoughness); + + float fresnel = SchlickFresnel(EdotH); + + // Evaluate diffuse + vec3 d = diffuseColor * evaluateDirectDiffuse(); + + // Evaluate specular first lobe + vec3 s1 = vec3(0.0); + const float R = (1.0 - ior) / (1.0 + ior); + if (specularAmount > 0.0) { + vec3 F0 = specularColor; + vec3 F90 = vec3(1.0); + + if (!useSpecularWorkflow) { + vec3 specColor = mix(vec3(1.0), diffuseColor, metallic); + F0 = mix(R * R * specColor, specColor, metallic); + F90 = specColor; + + // For metallic workflows, pure metals have no diffuse + d *= 1.0 - metallic; + } + + s1 = specularAmount * evaluateDirectSpecular( + F0, // Specular color 0 + F90, // Specular color 90 + specularRoughness, // Roughness + fresnel, // Fresnel + NdotL, NdotE, NdotH, EdotH); // Dot products needed for lights + + // Adjust the diffuse so glazing angles have less diffuse + d *= (1.0 - mix(F0, F90, fresnel)); + } + + // Evaluate clearcoat + vec3 s2 = vec3(0.0); + if (clearcoatAmount > 0.0) { + s2 = clearcoatAmount * evaluateDirectSpecular( + R * R * clearcoatColor, // Clearcoat color 0 + clearcoatColor, // Clearcoat color 90 + clearcoatRoughness, // Roughness + fresnel, // Fresnel + NdotL, NdotE, NdotH, EdotH); // Dot products needed for lights + } + + LightingContributions lightingContrib; + + lightingContrib.diffuse = + occlusion * NdotL * d * lightDiffuseIrradiance; + + lightingContrib.specular = + occlusion * NdotL * (s1 + s2) * lightSpecularIrradiance; + + return lightingContrib; +} + + +-- glsl Preview.LightIntegration + +mat4 GetDomeLightTransform(mat4 worldToLightTransform) +{ + // transform from view space to light space + mat4 worldToViewInverse = GetWorldToViewInverseMatrix(); + return worldToLightTransform * worldToViewInverse; +} + +LightingContributions +evaluateIndirectLighting( + vec3 diffuseColor, + vec3 specularColor, + vec3 Neye, + vec3 Reye, + float NdotE, + float EdotH, + float ior, + float metallic, + float occlusion, + float roughness, + bool useSpecularWorkflow, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + mat4 worldToLightTransform) +{ + LightingContributions indirect; + indirect.diffuse = vec3(0.0); + indirect.specular = vec3(0.0); + +#ifdef HD_HAS_domeLightIrradiance + vec3 F0 = specularColor; + vec3 F90 = vec3(1.0); + vec3 d = diffuseColor; + const float R = (1.0 - ior) / (1.0 + ior); + if (!useSpecularWorkflow) { + vec3 specColor = mix(vec3(1.0), diffuseColor, metallic); + F0 = mix(R * R * specColor, specColor, metallic); + F90 = specColor; + + // For metallic workflows, pure metals have no diffuse + d *= 1.0 - metallic; + } + // Adjust the diffuse so glazing angles have less diffuse + float fresnel = SchlickFresnel(EdotH); + vec3 F = mix(F0, F90, fresnel); + d *= (1.0 - F); + + mat4 transformationMatrix = GetDomeLightTransform(worldToLightTransform); + + // Diffuse Component + vec3 dir = normalize((transformationMatrix * vec4(Neye,0.0)).xyz); + vec2 coord = ProjectToLatLong(dir); + vec3 diffuse = HdGet_domeLightIrradiance(coord).rgb; + + // Specular Component + const float MAX_REFLECTION_LOD = + textureQueryLevels(HdGetSampler_domeLightPrefilter()); + float lod = roughness * MAX_REFLECTION_LOD; + vec3 Rdir = normalize((transformationMatrix * vec4(Reye,0.0)).xyz); + vec2 Rcoord = ProjectToLatLong(Rdir); + vec3 prefilter = HdTextureLod_domeLightPrefilter(Rcoord, lod).rgb; + + vec2 brdf = HdGet_domeLightBRDF(vec2(NdotE, roughness)).rg; + + vec3 specular = prefilter * (F * brdf.x + brdf.y); + + // Clearcoat Component + vec3 clearcoat = vec3(0.0); + if (clearcoatAmount > 0.0) { + const vec3 clearcoatF = clearcoatAmount * mix( + R * R * clearcoatColor, // Clearcoat F0 + clearcoatColor, // Clearcoat F90 + fresnel); + lod = clearcoatRoughness * MAX_REFLECTION_LOD; + prefilter = HdTextureLod_domeLightPrefilter(Rcoord, lod).rgb; + clearcoat = prefilter * (clearcoatF * brdf.x + brdf.y); + } + + // Indirect Lighting + indirect.diffuse = (d * diffuse) * occlusion; + indirect.specular = (specular + clearcoat) * occlusion; + +#endif + + return indirect; +} + +vec3 +evaluateLights( + vec3 emissiveColor, + vec3 diffuseColor, + bool useSpecularWorkflow, + float ior, + float metallic, + float specularAmount, + vec3 specularColor, + float specularRoughness, + float clearcoatAmount, + vec3 clearcoatColor, + float clearcoatRoughness, + float occlusion, + vec4 Peye, + vec3 Neye) +{ + vec3 n = Neye; + vec3 e = normalize(-Peye.xyz); + float NdotE = max(0.0, dot(n, e)); + + vec3 Reye = reflect(-e, n); + + vec3 directLight = vec3(0.0); + vec3 indirectLight = vec3(0.0); + +#if NUM_LIGHTS > 0 + for (int i = 0; i < NUM_LIGHTS; ++i) { + LightSource light = GetLightSource(i); + + // Calculate necessary vector information for lighting + vec4 Plight = light.isIndirectLight + ? vec4(0,0,0,1) + : light.position; + vec3 l = (Plight.w == 0.0) + ? normalize(Plight.xyz) + : normalize(Plight - Peye).xyz; + vec3 h = normalize(e + l); + float NdotL = max(0.0, dot(n, l)); + float NdotH = max(0.0, dot(n, h)); + float EdotH = max(0.0, dot(e, h)); + + // Calculate light intensity + float atten = lightDistanceAttenuation(Peye, i); + float spot = lightSpotAttenuation(l, i); + + // Calculate the shadow factor + float shadow = 1.0; + #if USE_SHADOWS + shadow = light.hasShadow ? + shadowing(/*lightIndex=*/i, Peye) : 1.0; + #endif + + float intensity = atten * spot * shadow; + + vec3 lightDiffuseIrradiance = intensity * light.diffuse.rgb; + vec3 lightSpecularIrradiance = intensity * light.specular.rgb; + + LightingContributions lightingContrib = evaluateLight( + diffuseColor, + useSpecularWorkflow, + ior, + metallic, + specularAmount, + specularColor, + specularRoughness, + clearcoatAmount, + clearcoatColor, + clearcoatRoughness, + occlusion, + NdotL, + NdotE, + NdotH, + EdotH, + lightDiffuseIrradiance, + lightSpecularIrradiance); + + // calculate the indirect light (DomeLight) + if (light.isIndirectLight) { + + LightingContributions indirectLightContrib = + evaluateIndirectLighting(diffuseColor, specularColor, + Neye, Reye, NdotE, EdotH, ior, metallic, occlusion, + specularRoughness, useSpecularWorkflow, + clearcoatAmount, clearcoatColor, clearcoatRoughness, + light.worldToLightTransform); + indirectLight = (indirectLightContrib.diffuse * light.diffuse.rgb + + indirectLightContrib.specular * light.specular.rgb); + } + // all other light sources contribute to the direct lighting + else { + directLight += (lightingContrib.diffuse + lightingContrib.specular); + } + } +#endif + + return (emissiveColor + directLight + indirectLight); +} + + +-- glsl Preview.NormalMapping + +vec3 +perturbFragmentNormal(vec3 P, vec3 N) +{ +#ifdef HD_HAS_COORD_normal + vec3 Nt = normalize(HdGet_normal().xyz); + vec2 st = HdGetCoord_normal().xy; + return PerturbNormal(P, N, st, Nt); +#endif + return N; +} + + +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 + +def Shader "UsdPreviewSurface" ( + doc = "Preview surface specification" +) +{ + uniform token info:id = "UsdPreviewSurface" + uniform token info:implementationSource = "sourceAsset" + + # XXX: This doesn't resolve if it's defined as a search path. + # Might require special resolver configuration, to include the resources + # directory. + uniform asset info:glslfx:sourceAsset = @./previewSurface.glslfx@ + + # Outputs + token outputs:surface ( + sdrMetadata = { + string renderType = "terminal surface" + } + ) + token outputs:displacement ( + sdrMetadata = { + string renderType = "terminal displacement" + } + ) + + # Inputs + color3f inputs:diffuseColor = (0.18, 0.18, 0.18) ( + doc = """Parameter used as diffuseColor when using the specular + workflow, when using metallic workflow this is interpreted + as albedo.""" + ) + + color3f inputs:emissiveColor = (0.0, 0.0, 0.0) ( + doc = """Emissive component.""" + ) + + int inputs:useSpecularWorkflow = 0 ( + connectability = "interfaceOnly" + doc = """This node can fundamentally operate in two modes : + Specular workflow where you provide a texture/value to the + "specularColor" input. Or, Metallic workflow where you + provide a texture/value to the "metallic" input.""" + ) + + color3f inputs:specularColor = (0.0, 0.0, 0.0) ( + doc = """Used only in the specular workflow. + Specular color to be used. + This is the color at 0 incidence. Edge color is assumed white. + Transition between the two colors according to Schlick fresnel + approximation.""" + ) + + float inputs:metallic = 0.0 ( + doc = """Used only in the metalness workflow. + 1 for metallic surfaces and 0 for non-metallic. + - If metallic is 1, then both F0 (reflectivity at 0 degree + incidence) and edge F90 reflectivity will simply be the Albedo. + - If metallic is 0, then Albedo is ignored in the calculation of F0 + and F90; F0 is derived from ior via ( (1-ior)/(1+ior) )^2 and F90 is + white. + In between, we interpolate.""" + ) + + float inputs:roughness = 0.5 ( + doc = """Roughness for the specular lobe. The value ranges from 0 to 1, + which goes from a perfectly specular surface at 0.0 to maximum roughness + of the specular lobe. This value is usually squared before use with a + GGX or Beckmann lobe.""" + ) + + float inputs:clearcoat = 0.0 ( + doc = """Second specular lobe amount. The color is white.""" + ) + + float inputs:clearcoatRoughness = 0.01 ( + doc = """Roughness for the second specular lobe.""" + ) + + float inputs:opacity = 1.0 ( + doc = """Opacity of the material.""" + ) + + float inputs:opacityThreshold = 0.0 ( + connectability = "interfaceOnly" + doc = """Threshold used to determine opacity values that will be + considered fully transparent. A value of 0.0 indicates that no masking + is applied to the opacity input, while a value greater than 0.0 indicates + that rendering of the surface is limited to the areas where the opacity + is greater or equal to that value. Note that when opacityThreshold is + greater than zero, the opacity values less than the opacityThreshold will + not be rendered, and the opacity values greater than or equal to the + opacityThreshold will be fully visible.""" + ) + + float inputs:ior = 1.5 ( + doc = """Index of Refraction to be used for translucent objects.""" + ) + + normal3f inputs:normal = (0.0, 0.0, 1.0) ( + doc = """Expects normal in tangent space [(-1,-1,-1), (1,1,1)] + This means your texture reader implementation should provide + data to this node that is properly scaled and ready + to be consumed as a tangent space normal. + If the texture has 8 bits per component, then scale and bias must be + adjusted to be (2.0, 2.0, 2.0, 1.0) and (-1, -1, -1, 0) respectively + in order to satisfy tangent space requirements. + Normal map data is commonly expected to be linearly encoded. + However, many image-writing tools automatically set the profile of + three-channel, 8-bit images to SRGB. To prevent an unwanted + transformation, the sourceColorSpace must also be set to "raw".""" + ) + + float inputs:displacement = 0.0 ( + doc = """Displacement in the direction of the normal. """ + ) + + float inputs:occlusion = 1.0 ( + doc = """Occlusion signal. This provides extra information about the + occlusion of different parts of the mesh that this material is applied + to. Occlusion only makes sense as a surface-varying signal, and + pathtracers will likely choose to ignore it. An occlusion value of 0.0 + means the surface point is fully occluded by other parts of the surface, + and a value of 1.0 means the surface point is completely unoccluded by + other parts of the surface. """ + ) +} + +def Shader "UsdUVTexture" ( + doc = """Texture Node Specification represents a node that can be used to + read UV textures, including tiled textures such as Mari UDIM's. + + Reads from a texture file and outputs one or more values. If the texture has + 8 bits per component, [0, 255] values will first be converted to floating + point in the range [0, 1] and then any transformations (bias, scale) + indicated are applied. Otherwise any indicated transformation (bias, + scale) is just applied. If a single-channel texture is fed into a + UsdUVTexture, the r, g, and b components of the rgb output will repeat the + channel's value, while the single 'a' output will be set to 1.0. If a + two-channel texture is fed into a UsdUVTexture, the r, g, and b components + of the rgb output will repeat the first channel's value, while the single + 'a' output will be set to the second channel's value. If a three-channel + texture is fed into a UsdUVTexture, the r, g, and b components of the rgb + outputs will contain the assigned texture channel's value, while the single + 'a' output will be set to 1.0. +""" + sdrMetadata = { + token role = "texture" + } +) +{ + uniform token info:id = "UsdUVTexture" + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./uvTexture.glslfx@ + + asset inputs:file = @@ ( + connectability = "interfaceOnly" + doc = """Path to the texture this node uses.""" + ) + + float2 inputs:st = (0.0, 0.0) ( + doc = """This input provides the texture coordinates. It is usually + connected to a (primvar) node that will provide the texture + coords.""" + ) + + token inputs:wrapS = "useMetadata" ( + allowedTokens = ["black", "clamp", "repeat", "mirror", "useMetadata"] + connectability = "interfaceOnly" + doc = """ black, clamp, repeat, mirror, useMetadata.""" + ) + + token inputs:wrapT = "useMetadata" ( + allowedTokens = ["black", "clamp", "repeat", "mirror", "useMetadata"] + connectability = "interfaceOnly" + doc = """ black, clamp, repeat, mirror, useMetadata.""" + ) + + float4 inputs:fallback = (0.0, 0.0, 0.0, 1.0) ( + doc = """Fallback value to be used when no texture is connected.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float4 inputs:scale = (1.0, 1.0, 1.0, 1.0) ( + connectability = "interfaceOnly" + doc = """Scale to be applied to all components of the texture. + value * scale + bias. + Please see UsdPreviewSurface.inputs:normal for special + considerations for reading normal maps.""" + ) + + float4 inputs:bias = (0.0, 0.0, 0.0, 0.0) ( + connectability = "interfaceOnly" + doc = """Bias to be applied to all components of the texture. + value * scale + bias). + Please see UsdPreviewSurface.inputs:normal for special + considerations for reading normal maps.""" + ) + + token inputs:sourceColorSpace = "auto" ( + connectability = "interfaceOnly" + allowedTokens = ["raw", "sRGB", "auto"] + doc = """ raw, sRGB, auto. Flag indicating the color + space in which the source texture is encoded. If set to sRGB, + the texture will be read using the sRGB transfer curve, but + not filtered against the sRGB gamut. Please see + UsdPreviewSurface.inputs:normal for special considerations for + reading normal maps.""" + ) + + float outputs:r ( + doc = "Outputs the red channel." + sdrMetadata = { + token swizzle = "x" + } + ) + + float outputs:g ( + doc = "Outputs the green channel." + sdrMetadata = { + token swizzle = "y" + } + ) + + float outputs:b ( + doc = "Outputs the blue channnel." + sdrMetadata = { + token swizzle = "z" + } + ) + + float outputs:a ( + doc = "Outputs the alpha channnel." + sdrMetadata = { + token swizzle = "w" + } + ) + + float3 outputs:rgb ( + doc = "Outputs the red, green and blue channels." + sdrMetadata = { + token swizzle = "xyz" + } + ) +} + +class "UsdPrimvarReader" ( + sdrMetadata = { + token role = "primvar" + } +) +{ + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./primvarReader.glslfx@ + string inputs:varname = "" ( + connectability = "interfaceOnly" + doc = """Name of the primvar to be fetched from the geometry.""" + sdrMetadata = { + token primvarProperty = "1" + } + ) +} + +def Shader "UsdPrimvarReader_float" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float" + + float inputs:fallback = 0.0 ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float outputs:result +} + +def Shader "UsdPrimvarReader_float2" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float2" + + float2 inputs:fallback = (0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float2 outputs:result +} + +def Shader "UsdPrimvarReader_float3" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float3" + + float3 inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float3 outputs:result +} + +def Shader "UsdPrimvarReader_float4" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_float4" + + float4 inputs:fallback = (0.0, 0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + float4 outputs:result +} + +def Shader "UsdPrimvarReader_int" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_int" + + int inputs:fallback = 0 ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + int outputs:result +} + +def Shader "UsdPrimvarReader_string" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_string" + + string inputs:fallback = "" ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + string outputs:result +} + +def Shader "UsdPrimvarReader_normal" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_normal" + + normal3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + normal3f outputs:result +} + +def Shader "UsdPrimvarReader_point" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_point" + + point3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + point3f outputs:result +} + +def Shader "UsdPrimvarReader_vector" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_vector" + + vector3f inputs:fallback = (0.0, 0.0, 0.0) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + vector3f outputs:result +} + +def Shader "UsdPrimvarReader_matrix" ( + inherits = +) +{ + uniform token info:id = "UsdPrimvarReader_matrix" + + matrix4d inputs:fallback = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ) ( + doc = """Fallback value to be returned when fetch failed.""" + sdrMetadata = { + token defaultInput = "1" + } + ) + + matrix4d outputs:result +} + +def Shader "UsdTransform2d" ( + doc = """Transform 2d represents a node that can be used to + transform 2d data (for instance, texture coordinates). + The node applies the following transformation : + in * scale * rotate + translation""" + sdrMetadata = { + token role = "math" + } +) +{ + uniform token info:id = "UsdTransform2d" + uniform token info:implementationSource = "sourceAsset" + uniform asset info:glslfx:sourceAsset = @./transform2d.glslfx@ + + float2 inputs:in = (0.0, 0.0) ( + doc = """This input provides the data. It is usually + connected to a UsdPrimvarReader_float2 that + will provide the data.""" + ) + + float inputs:rotation = 0.0 ( + connectability = "interfaceOnly" + doc = """Counter-clockwise rotation in degrees around the origin to be applied + to all components of the data.""" + ) + + float2 inputs:scale = (1.0, 1.0) ( + connectability = "interfaceOnly" + doc = """Scale around the origin to be applied to all components of the data.""" + ) + + float2 inputs:translation = (0.0, 0.0) ( + connectability = "interfaceOnly" + doc = """Translation to be applied to all components of the data.""" + ) + + float2 outputs:result ( + doc = "Outputs transformed float2 values." + ) +} +-- glslfx version 0.1 + +// +// Copyright 2020 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +-- glslfx version 0.1 + +// +// Copyright 2018 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// + +-- configuration +{ + "techniques": { + "default": { + } + } +} + +-- This file is intentionally empty. +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class SkelRoot "SkelRoot" ( + doc = '''Boundable prim type used to identify a scope beneath which + skeletally-posed primitives are defined. + + A SkelRoot must be defined at or above a skinned primitive for any skinning + behaviors in UsdSkel. + + See the extended "Skel Root Schema" documentation for + more information.''' +) +{ + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Skeleton "Skeleton" ( + doc = '''Describes a skeleton. + + See the extended "Skeleton Schema" documentation for + more information. + ''' +) +{ + uniform matrix4d[] bindTransforms ( + doc = """Specifies the bind-pose transforms of each joint in + **world space**, in the ordering imposed by *joints*.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token[] jointNames ( + doc = """If authored, provides a unique name per joint. This may be + optionally set to provide better names when translating to DCC apps + that require unique joint names.""" + ) + uniform token[] joints ( + doc = """An array of path tokens identifying the set of joints that make + up the skeleton, and their order. Each token in the array must be valid + when parsed as an SdfPath. The parent-child relationships of the + corresponding paths determine the parent-child relationships of each + joint. It is not required that the name at the end of each path be + unique, but rather only that the paths themselves be unique.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + uniform matrix4d[] restTransforms ( + doc = """Specifies the rest-pose transforms of each joint in + **local space**, in the ordering imposed by *joints*. This provides + fallback values for joint transforms when a Skeleton either has no + bound animation source, or when that animation source only contains + animation for a subset of a Skeleton's joints.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class SkelAnimation "SkelAnimation" ( + doc = '''Describes a skel animation, where joint animation is stored in a + vectorized form. + + See the extended "Skel Animation" + documentation for more information. + ''' +) +{ + uniform token[] blendShapes ( + doc = """Array of tokens identifying which blend shapes this + animation's data applies to. The tokens for blendShapes correspond to + the tokens set in the *skel:blendShapes* binding property of the + UsdSkelBindingAPI.""" + ) + float[] blendShapeWeights ( + doc = """Array of weight values for each blend shape. Each weight value + is associated with the corresponding blend shape identified within the + *blendShapes* token array, and therefore must have the same length as + *blendShapes.""" + ) + uniform token[] joints ( + doc = """Array of tokens identifying which joints this animation's + data applies to. The tokens for joints correspond to the tokens of + Skeleton primitives. The order of the joints as listed here may + vary from the order of joints on the Skeleton itself.""" + ) + quatf[] rotations ( + doc = """Joint-local unit quaternion rotations of all affected joints, + in 32-bit precision. Array length should match the size of the + *joints* attribute.""" + ) + half3[] scales ( + doc = """Joint-local scales of all affected joints, in + 16 bit precision. Array length should match the size of the *joints* + attribute.""" + ) + float3[] translations ( + doc = """Joint-local translations of all affected joints. Array length + should match the size of the *joints* attribute.""" + ) +} + +class "SkelBindingAPI" ( + doc = '''Provides API for authoring and extracting all the skinning-related + data that lives in the "geometry hierarchy" of prims and models that want + to be skeletally deformed. + + See the extended "UsdSkelBindingAPI schema" + documentation for more about bindings and how they apply in a scene graph. + ''' +) +{ + matrix4d primvars:skel:geomBindTransform ( + doc = '''Encodes the bind-time world space transforms of the prim. + If the transform is identical for a group of gprims that share a common + ancestor, the transform may be authored on the ancestor, to "inherit" + down to all the leaf gprims. If this transform is unset, an identity + transform is used instead.''' + ) + int[] primvars:skel:jointIndices ( + doc = """Indices into the *joints* attribute of the closest + (in namespace) bound Skeleton that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joint influences + apply to each point. Indices must point be valid. Null influences should + be defined by setting values in jointWeights to zero. + See UsdGeomPrimvar for more information on interpolation and + elementSize.""" + ) + float[] primvars:skel:jointWeights ( + doc = """Weights for the joints that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joints influences + apply to each point. The length, interpolation, and elementSize of + *jointWeights* must match that of *jointIndices*. See UsdGeomPrimvar + for more information on interpolation and elementSize.""" + ) + uniform token primvars:skel:skinningMethod = "classicLinear" ( + allowedTokens = ["classicLinear", "dualQuaternion"] + doc = "The skinningMethod specifies the skinning method for the prim." + ) + rel skel:animationSource ( + doc = """Animation source to be bound to Skeleton primitives at or + beneath the location at which this property is defined. + """ + ) + uniform token[] skel:blendShapes ( + doc = """An array of tokens defining the order onto which blend shape + weights from an animation source map onto the *skel:blendShapeTargets* + rel of a binding site. If authored, the number of elements must be equal + to the number of targets in the _blendShapeTargets_ rel. This property + is not inherited hierarchically, and is expected to be authored directly + on the skinnable primitive to which the blend shapes apply.""" + ) + rel skel:blendShapeTargets ( + doc = """Ordered list of all target blend shapes. This property is not + inherited hierarchically, and is expected to be authored directly on + the skinnable primitive to which the the blend shapes apply.""" + ) + uniform token[] skel:joints ( + doc = """An (optional) array of tokens defining the list of + joints to which jointIndices apply. If not defined, jointIndices applies + to the ordered list of joints defined in the bound Skeleton's *joints* + attribute. If undefined on a primitive, the primitive inherits the + value of the nearest ancestor prim, if any.""" + ) + rel skel:skeleton ( + doc = """Skeleton to be bound to this prim and its descendents that + possess a mapping and weighting to the joints of the identified + Skeleton.""" + ) +} + +class BlendShape "BlendShape" ( + doc = '''Describes a target blend shape, possibly containing inbetween + shapes. + + See the extended "Blend Shape Schema + documentation for information. + ''' +) +{ + uniform vector3f[] normalOffsets ( + doc = """**Required property**. Normal offsets which, when added to the + base pose, provides the normals of the target shape.""" + ) + uniform vector3f[] offsets ( + doc = """**Required property**. Position offsets which, when added to the + base pose, provides the target shape.""" + ) + uniform int[] pointIndices ( + doc = """**Optional property**. Indices into the original mesh that + correspond to the values in *offsets* and of any inbetween shapes. If + authored, the number of elements must be equal to the number of elements + in the *offsets* array.""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "SdfMetadata": { + "weight": { + "appliesTo": [ + "attributes" + ], + "default": 0, + "displayGroup": "BlendShape", + "documentation": "The weight value at which an inbeteen shape is applied.", + "type": "float" + } + }, + "Types": { + "UsdSkelAnimation": { + "alias": { + "UsdSchemaBase": "SkelAnimation" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdSkelBindingAPI": { + "alias": { + "UsdSchemaBase": "SkelBindingAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "UsdSkelBlendShape": { + "alias": { + "UsdSchemaBase": "BlendShape" + }, + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaKind": "concreteTyped" + }, + "UsdSkelRoot": { + "alias": { + "UsdSchemaBase": "SkelRoot" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + }, + "UsdSkelSkeleton": { + "alias": { + "UsdSchemaBase": "Skeleton" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomBoundable" + ], + "implementsComputeExtent": true, + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdSkel", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 +( + """ This file contains a schema for supporting skeletal animations in USD. + """ + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdSkel" + string libraryPath = "pxr/usd/usdSkel" + + dictionary libraryTokens = { + dictionary weight = { + string doc = """UsdSkelInbetweenShape - The weight location at + which the inbetween shape applies.""" + } + } + } +) { +} + + +class SkelRoot "SkelRoot" ( + inherits = + doc = """Boundable prim type used to identify a scope beneath which + skeletally-posed primitives are defined. + + A SkelRoot must be defined at or above a skinned primitive for any skinning + behaviors in UsdSkel. + + See the extended \\ref UsdSkel_SkelRoot "Skel Root Schema" documentation for + more information.""" + customData = { + string className = "Root" + + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + } +) { +} + + +class Skeleton "Skeleton" ( + inherits = + doc = """Describes a skeleton. + + See the extended \\ref UsdSkel_Skeleton "Skeleton Schema" documentation for + more information. + """ + customData = { + dictionary extraPlugInfo = { + bool implementsComputeExtent = true + } + + string extraIncludes = """ +#include "pxr/usd/usdSkel/topology.h" """ + } +) { + uniform token[] joints ( + doc = """An array of path tokens identifying the set of joints that make + up the skeleton, and their order. Each token in the array must be valid + when parsed as an SdfPath. The parent-child relationships of the + corresponding paths determine the parent-child relationships of each + joint. It is not required that the name at the end of each path be + unique, but rather only that the paths themselves be unique.""" + ) + + uniform token[] jointNames ( + doc = """If authored, provides a unique name per joint. This may be + optionally set to provide better names when translating to DCC apps + that require unique joint names.""" + ) + + uniform matrix4d[] bindTransforms ( + doc = """Specifies the bind-pose transforms of each joint in + **world space**, in the ordering imposed by *joints*.""" + ) + uniform matrix4d[] restTransforms ( + doc = """Specifies the rest-pose transforms of each joint in + **local space**, in the ordering imposed by *joints*. This provides + fallback values for joint transforms when a Skeleton either has no + bound animation source, or when that animation source only contains + animation for a subset of a Skeleton's joints.""" + ) +} + + +class SkelAnimation "SkelAnimation" ( + inherits = + doc = """Describes a skel animation, where joint animation is stored in a + vectorized form. + + See the extended \\ref UsdSkel_SkelAnimation "Skel Animation" + documentation for more information. + """ + customData = { + string className = "Animation" + } +) { + uniform token[] joints ( + doc = """Array of tokens identifying which joints this animation's + data applies to. The tokens for joints correspond to the tokens of + Skeleton primitives. The order of the joints as listed here may + vary from the order of joints on the Skeleton itself.""" + ) + + float3[] translations ( + doc = """Joint-local translations of all affected joints. Array length + should match the size of the *joints* attribute.""" + ) + + quatf[] rotations ( + doc = """Joint-local unit quaternion rotations of all affected joints, + in 32-bit precision. Array length should match the size of the + *joints* attribute.""" + ) + + half3[] scales ( + doc = """Joint-local scales of all affected joints, in + 16 bit precision. Array length should match the size of the *joints* + attribute.""" + ) + + uniform token[] blendShapes ( + doc = """Array of tokens identifying which blend shapes this + animation's data applies to. The tokens for blendShapes correspond to + the tokens set in the *skel:blendShapes* binding property of the + UsdSkelBindingAPI.""" + ) + + float[] blendShapeWeights ( + doc = """Array of weight values for each blend shape. Each weight value + is associated with the corresponding blend shape identified within the + *blendShapes* token array, and therefore must have the same length as + *blendShapes.""" + ) +} + +class "SkelBindingAPI" ( + inherits = + doc = """Provides API for authoring and extracting all the skinning-related + data that lives in the "geometry hierarchy" of prims and models that want + to be skeletally deformed. + + See the extended \\ref UsdSkel_BindingAPI "UsdSkelBindingAPI schema" + documentation for more about bindings and how they apply in a scene graph. + """ + customData = { + string className = "BindingAPI" + string extraIncludes = """ +#include "pxr/base/tf/span.h" +#include "pxr/usd/usdGeom/primvar.h" +#include "pxr/usd/usdSkel/skeleton.h" """ + } +) +{ + rel skel:animationSource ( + customData = { + string apiName = "animationSource" + } + doc = """Animation source to be bound to Skeleton primitives at or + beneath the location at which this property is defined. + """ + ) + + rel skel:skeleton ( + customData = { + string apiName = "skeleton" + } + doc = """Skeleton to be bound to this prim and its descendents that + possess a mapping and weighting to the joints of the identified + Skeleton.""" + ) + + uniform token primvars:skel:skinningMethod = "classicLinear" ( + customData = { + string apiName = "skinningMethod" + } + allowedTokens = ["classicLinear", "dualQuaternion"] + doc = """The skinningMethod specifies the skinning method for the prim.""" + ) + + matrix4d primvars:skel:geomBindTransform ( + customData = { + string apiName = "geomBindTransform" + } + doc = """Encodes the bind-time world space transforms of the prim. + If the transform is identical for a group of gprims that share a common + ancestor, the transform may be authored on the ancestor, to "inherit" + down to all the leaf gprims. If this transform is unset, an identity + transform is used instead.""" + ) + + uniform token[] skel:joints ( + customData = { + string apiName = "joints" + } + doc = """An (optional) array of tokens defining the list of + joints to which jointIndices apply. If not defined, jointIndices applies + to the ordered list of joints defined in the bound Skeleton's *joints* + attribute. If undefined on a primitive, the primitive inherits the + value of the nearest ancestor prim, if any.""" + ) + + int[] primvars:skel:jointIndices ( + customData = { + string apiName = "jointIndices" + } + doc = """Indices into the *joints* attribute of the closest + (in namespace) bound Skeleton that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joint influences + apply to each point. Indices must point be valid. Null influences should + be defined by setting values in jointWeights to zero. + See UsdGeomPrimvar for more information on interpolation and + elementSize.""" + ) + + float[] primvars:skel:jointWeights ( + customData = { + string apiName = "jointWeights" + } + doc = """Weights for the joints that affect each point of a PointBased + gprim. The primvar can have either *constant* or *vertex* interpolation. + This primvar's *elementSize* will determine how many joints influences + apply to each point. The length, interpolation, and elementSize of + *jointWeights* must match that of *jointIndices*. See UsdGeomPrimvar + for more information on interpolation and elementSize.""" + ) + + uniform token[] skel:blendShapes ( + customData = { + string apiName = "blendShapes" + } + doc = """An array of tokens defining the order onto which blend shape + weights from an animation source map onto the *skel:blendShapeTargets* + rel of a binding site. If authored, the number of elements must be equal + to the number of targets in the _blendShapeTargets_ rel. This property + is not inherited hierarchically, and is expected to be authored directly + on the skinnable primitive to which the blend shapes apply.""" + ) + rel skel:blendShapeTargets ( + customData = { + string apiName= "blendShapeTargets" + } + doc = """Ordered list of all target blend shapes. This property is not + inherited hierarchically, and is expected to be authored directly on + the skinnable primitive to which the the blend shapes apply.""" + ) +} + + +class BlendShape "BlendShape" ( + inherits = + doc = """Describes a target blend shape, possibly containing inbetween + shapes. + + See the extended \\ref UsdSkel_BlendShape "Blend Shape Schema + documentation for information. + """ + customData = { + string extraIncludes = """ +#include "pxr/base/tf/span.h" +#include "pxr/usd/usdSkel/inbetweenShape.h" """ + } +) +{ + uniform vector3f[] offsets ( + doc = """**Required property**. Position offsets which, when added to the + base pose, provides the target shape.""" + ) + + uniform vector3f[] normalOffsets ( + doc = """**Required property**. Normal offsets which, when added to the + base pose, provides the normals of the target shape.""" + ) + + uniform int[] pointIndices ( + doc = """**Optional property**. Indices into the original mesh that + correspond to the values in *offsets* and of any inbetween shapes. If + authored, the number of elements must be equal to the number of elements + in the *offsets* array.""" + ) +} +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class Volume "Volume" ( + doc = """A renderable volume primitive. A volume is made up of any number + of FieldBase primitives bound together in this volume. Each + FieldBase primitive is specified as a relationship with a + namespace prefix of \"field\". + + The relationship name is used by the renderer to associate + individual fields with the named input parameters on the volume + shader. Using this indirect approach to connecting fields to + shader parameters (rather than using the field prim's name) + allows a single field to be reused for different shader inputs, or + to be used as different shader parameters when rendering different + Volumes. This means that the name of the field prim is not + relevant to its contribution to the volume prims which refer to + it. Nor does the field prim's location in the scene graph have + any relevance, and Volumes may refer to fields anywhere in the + scene graph. **However**, unless Field prims need to be shared + by multiple Volumes, a Volume's Field prims should be located + under the Volume in namespace, for enhanced organization.""" +) +{ + uniform bool doubleSided = 0 ( + doc = """Although some renderers treat all parametric or polygonal + surfaces as if they were effectively laminae with outward-facing + normals on both sides, some renderers derive significant optimizations + by considering these surfaces to have only a single outward side, + typically determined by control-point winding order and/or + orientation. By doing so they can perform \"backface culling\" to + avoid drawing the many polygons of most closed surfaces that face away + from the viewer. + + However, it is often advantageous to model thin objects such as paper + and cloth as single, open surfaces that must be viewable from both + sides, always. Setting a gprim's doubleSided attribute to + \\c true instructs all renderers to disable optimizations such as + backface culling for the gprim, and attempt (not all renderers are able + to do so, but the USD reference GL renderer always will) to provide + forward-facing normals on each side of the surface for lighting + calculations.""" + ) + float3[] extent ( + doc = """Extent is a three dimensional range measuring the geometric + extent of the authored gprim in its own local space (i.e. its own + transform not applied), without accounting for any shader-induced + displacement. If __any__ extent value has been authored for a given + Boundable, then it should be authored at every timeSample at which + geometry-affecting properties are authored, to ensure correct + evaluation via ComputeExtent(). If __no__ extent value has been + authored, then ComputeExtent() will call the Boundable's registered + ComputeExtentFunction(), which may be expensive, which is why we + strongly encourage proper authoring of extent. + \\sa ComputeExtent() + \\sa \\ref UsdGeom_Boundable_Extent. + + An authored extent on a prim which has children is expected to include + the extent of all children, as they will be pruned from BBox computation + during traversal.""" + ) + uniform token orientation = "rightHanded" ( + allowedTokens = ["rightHanded", "leftHanded"] + doc = """Orientation specifies whether the gprim's surface normal + should be computed using the right hand rule, or the left hand rule. + Please see for a deeper explanation and + generalization of orientation to composed scenes with transformation + hierarchies.""" + ) + color3f[] primvars:displayColor ( + doc = '''It is useful to have an "official" colorSet that can be used + as a display or modeling color, even in the absence of any specified + shader for a gprim. DisplayColor serves this role; because it is a + UsdGeomPrimvar, it can also be used as a gprim override for any shader + that consumes a displayColor parameter.''' + ) + float[] primvars:displayOpacity ( + doc = """Companion to displayColor that specifies opacity, broken + out as an independent attribute rather than an rgba color, both so that + each can be independently overridden, and because shaders rarely consume + rgba parameters.""" + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "FieldBase" ( + doc = "Base class for field primitives." +) +{ + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class "FieldAsset" ( + doc = "Base class for field primitives defined by an external file." +) +{ + token fieldDataType ( + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens is specified with the specific asset type. + A missing value is considered an error.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class Field3DAsset "Field3DAsset" ( + doc = """Field3D field primitive. The FieldAsset filePath attribute must + specify a file in the Field3D format on disk.""" +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", "half3", "float3", "double3"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for Field3d + volumes.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + token fieldPurpose ( + doc = """Optional token which can be used to indicate the purpose or + grouping of an individual field. Clients which consume Field3D + files should treat this as the Field3D field name.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +class OpenVDBAsset "OpenVDBAsset" ( + doc = """OpenVDB field primitive. The FieldAsset filePath attribute must + specify a file in the OpenVDB format on disk.""" +) +{ + token fieldClass ( + allowedTokens = ["levelSet", "fogVolume", "staggered", "unknown"] + doc = """Optional token which can be used to indicate the class of + an individual grid. This is a mapping to openvdb::GridClass + where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, + GRID_STAGGERED, and GRID_UNKNOWN.""" + ) + token fieldDataType ( + allowedTokens = ["half", "float", "double", "int", "uint", "int64", "half2", "float2", "double2", "int2", "half3", "float3", "double3", "int3", "matrix3d", "matrix4d", "quatd", "bool", "mask", "string"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for OpenVDB + volumes.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + rel proxyPrim ( + doc = '''The proxyPrim relationship allows us to link a + prim whose purpose is "render" to its (single target) + purpose="proxy" prim. This is entirely optional, but can be + useful in several scenarios: + + - In a pipeline that does pruning (for complexity management) + by deactivating prims composed from asset references, when we + deactivate a purpose="render" prim, we will be able to discover + and additionally deactivate its associated purpose="proxy" prim, + so that preview renders reflect the pruning accurately. + + - DCC importers may be able to make more aggressive optimizations + for interactive processing and display if they can discover the proxy + for a given render prim. + + - With a little more work, a Hydra-based application will be able + to map a picked proxy prim back to its render geometry for selection. + + \\note It is only valid to author the proxyPrim relationship on + prims whose purpose is "render".''' + ) + uniform token purpose = "default" ( + allowedTokens = ["default", "render", "proxy", "guide"] + doc = """Purpose is a classification of geometry into categories that + can each be independently included or excluded from traversals of prims + on a stage, such as rendering or bounding-box computation traversals. + + See for more detail about how + purpose is computed and used.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) + token visibility = "inherited" ( + allowedTokens = ["inherited", "invisible"] + doc = '''Visibility is meant to be the simplest form of "pruning" + visibility that is supported by most DCC apps. Visibility is + animatable, allowing a sub-tree of geometry to be present for some + segment of a shot, and absent from others; unlike the action of + deactivating geometry prims, invisible geometry is still + available for inspection, for positioning, for defining volumes, etc.''' + ) + uniform token[] xformOpOrder ( + doc = """Encodes the sequence of transformation operations in the + order in which they should be pushed onto a transform stack while + visiting a UsdStage's prims in a graph traversal that will effect + the desired positioning for this prim and its descendant prims. + + You should rarely, if ever, need to manipulate this attribute directly. + It is managed by the AddXformOp(), SetResetXformStack(), and + SetXformOpOrder(), and consulted by GetOrderedXformOps() and + GetLocalTransformation().""" + ) +} + +# Portions of this file auto-generated by usdGenSchema. +# Edits will survive regeneration except for comments and +# changes to types with autoGenerated=true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "UsdVolField3DAsset": { + "alias": { + "UsdSchemaBase": "Field3DAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldAsset" + ], + "schemaKind": "concreteTyped" + }, + "UsdVolFieldAsset": { + "alias": { + "UsdSchemaBase": "FieldAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldBase" + ], + "schemaKind": "abstractTyped" + }, + "UsdVolFieldBase": { + "alias": { + "UsdSchemaBase": "FieldBase" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomXformable" + ], + "schemaKind": "abstractTyped" + }, + "UsdVolOpenVDBAsset": { + "alias": { + "UsdSchemaBase": "OpenVDBAsset" + }, + "autoGenerated": true, + "bases": [ + "UsdVolFieldAsset" + ], + "schemaKind": "concreteTyped" + }, + "UsdVolVolume": { + "alias": { + "UsdSchemaBase": "Volume" + }, + "autoGenerated": true, + "bases": [ + "UsdGeomGprim" + ], + "schemaKind": "concreteTyped" + } + } + }, + "LibraryPath": "", + "Name": "usdVol", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} +#usda 1.0 + +( + subLayers = [ + @usdGeom/schema.usda@ + ] +) + +over "GLOBAL" ( + customData = { + string libraryName = "usdVol" + string libraryPath = "pxr/usd/usdVol" + dictionary libraryTokens = { + dictionary field = { + string doc = """This is the namespace prefix used to + specify the fields that make up a volume primitive.""" + } + } + } +) +{ +} + +class Volume "Volume" ( + inherits = + doc = """A renderable volume primitive. A volume is made up of any number + of FieldBase primitives bound together in this volume. Each + FieldBase primitive is specified as a relationship with a + namespace prefix of "field". + + The relationship name is used by the renderer to associate + individual fields with the named input parameters on the volume + shader. Using this indirect approach to connecting fields to + shader parameters (rather than using the field prim's name) + allows a single field to be reused for different shader inputs, or + to be used as different shader parameters when rendering different + Volumes. This means that the name of the field prim is not + relevant to its contribution to the volume prims which refer to + it. Nor does the field prim's location in the scene graph have + any relevance, and Volumes may refer to fields anywhere in the + scene graph. **However**, unless Field prims need to be shared + by multiple Volumes, a Volume's Field prims should be located + under the Volume in namespace, for enhanced organization.""" +) +{ +} + +class "FieldBase" ( + inherits = + doc = """Base class for field primitives.""" +) +{ +} + +class "FieldAsset" ( + doc = "Base class for field primitives defined by an external file." + inherits = +) +{ + asset filePath ( + doc = """An asset path attribute that points to a file on disk. + For each supported file format, a separate FieldAsset + subclass is required. + + This attribute's value can be animated over time, as most + volume asset formats represent just a single timeSample of + a volume. However, it does not, at this time, support + any pattern substitutions like \"$F\". """ + ) + token fieldName ( + doc = """Name of an individual field within the file specified by + the filePath attribute.""" + ) + int fieldIndex ( + doc = """A file can contain multiple fields with the same + name. This optional attribute is an index used to + disambiguate between these multiple fields with the same + name.""" + ) + token fieldDataType ( + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens is specified with the specific asset type. + A missing value is considered an error.""" + ) + token vectorDataRoleHint = "None" ( + allowedTokens = ["None", "Point", "Normal", "Vector", "Color"] + doc = """Optional token which is used to indicate the role of a vector + valued field. This can drive the data type in which fields + are made available in a renderer or whether the vector values + are to be transformed.""" + ) +} + +class Field3DAsset "Field3DAsset" ( + doc = """Field3D field primitive. The FieldAsset filePath attribute must + specify a file in the Field3D format on disk.""" + inherits = +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", + "half3", "float3", "double3"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for Field3d + volumes.""" + ) + token fieldPurpose ( + doc = """Optional token which can be used to indicate the purpose or + grouping of an individual field. Clients which consume Field3D + files should treat this as the Field3D field \\em name.""" + ) +} + +class OpenVDBAsset "OpenVDBAsset" ( + doc = """OpenVDB field primitive. The FieldAsset filePath attribute must + specify a file in the OpenVDB format on disk.""" + inherits = +) +{ + token fieldDataType ( + allowedTokens = ["half", "float", "double", "int", "uint", "int64", + "half2", "float2", "double2", "int2", + "half3", "float3", "double3", "int3", + "matrix3d", "matrix4d", "quatd", + "bool", "mask", "string"] + doc = """Token which is used to indicate the data type of an + individual field. Authors use this to tell consumers more + about the field without opening the file on disk. The list of + allowed tokens reflects the available choices for OpenVDB + volumes.""" + ) + token fieldClass ( + allowedTokens = ["levelSet", "fogVolume", "staggered", "unknown"] + doc = """Optional token which can be used to indicate the class of + an individual grid. This is a mapping to openvdb::GridClass + where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, + GRID_STAGGERED, and GRID_UNKNOWN.""" + ) +} + diff --git a/web/threeVisualizer/external/emHdBindings.js b/web/threeVisualizer/external/emHdBindings.js new file mode 100644 index 0000000..0df0321 --- /dev/null +++ b/web/threeVisualizer/external/emHdBindings.js @@ -0,0 +1,12022 @@ +var getUsdModule = ((args) => { + var _scriptDir = + typeof document !== "undefined" && document.currentScript + ? document.currentScript.src + : undefined; + if (typeof __filename !== "undefined") _scriptDir = _scriptDir || __filename; + return function (moduleArg = { + // module overrides can be supplied here + locateFile: (path, prefix) => { + if (!prefix && _scriptDir) prefix = _scriptDir.substr(0, _scriptDir.lastIndexOf('/') + 1); + return prefix + path; + }, + ...args +}) { + function GROWABLE_HEAP_I8() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP8; + } + function GROWABLE_HEAP_U8() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU8; + } + function GROWABLE_HEAP_I16() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP16; + } + function GROWABLE_HEAP_U16() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU16; + } + function GROWABLE_HEAP_I32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAP32; + } + function GROWABLE_HEAP_U32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPU32; + } + function GROWABLE_HEAP_F32() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPF32; + } + function GROWABLE_HEAP_F64() { + if (wasmMemory.buffer != HEAP8.buffer) { + updateMemoryViews(); + } + return HEAPF64; + } + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + Module["ready"] = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + if (!Module.expectedDataFileDownloads) { + Module.expectedDataFileDownloads = 0; + } + Module.expectedDataFileDownloads++; + (function () { + if (Module["ENVIRONMENT_IS_PTHREAD"] || Module["$ww"]) return; + var loadPackage = function (metadata) { + var PACKAGE_PATH = ""; + if (typeof window === "object") { + PACKAGE_PATH = window["encodeURIComponent"]( + window.location.pathname + .toString() + .substring( + 0, + window.location.pathname.toString().lastIndexOf("/"), + ) + "/", + ); + } else if ( + typeof process === "undefined" && + typeof location !== "undefined" + ) { + PACKAGE_PATH = encodeURIComponent( + location.pathname + .toString() + .substring(0, location.pathname.toString().lastIndexOf("/")) + + "/", + ); + } + var PACKAGE_NAME = "emHdBindings.data"; + var REMOTE_PACKAGE_BASE = "emHdBindings.data"; + if ( + typeof Module["locateFilePackage"] === "function" && + !Module["locateFile"] + ) { + Module["locateFile"] = Module["locateFilePackage"]; + err( + "warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)", + ); + } + var REMOTE_PACKAGE_NAME = Module["locateFile"] + ? Module["locateFile"](REMOTE_PACKAGE_BASE, "") + : REMOTE_PACKAGE_BASE; + var REMOTE_PACKAGE_SIZE = metadata["remote_package_size"]; + function fetchRemotePackage( + packageName, + packageSize, + callback, + errback, + ) { + if ( + typeof process === "object" && + typeof process.versions === "object" && + typeof process.versions.node === "string" + ) { + require("fs").readFile(packageName, function (err, contents) { + if (err) { + errback(err); + } else { + callback(contents.buffer); + } + }); + return; + } + var xhr = new XMLHttpRequest(); + xhr.open("GET", packageName, true); + xhr.responseType = "arraybuffer"; + xhr.onprogress = function (event) { + var url = packageName; + var size = packageSize; + if (event.total) size = event.total; + if (event.loaded) { + if (!xhr.addedTotal) { + xhr.addedTotal = true; + if (!Module.dataFileDownloads) Module.dataFileDownloads = {}; + Module.dataFileDownloads[url] = { + loaded: event.loaded, + total: size, + }; + } else { + Module.dataFileDownloads[url].loaded = event.loaded; + } + var total = 0; + var loaded = 0; + var num = 0; + for (var download in Module.dataFileDownloads) { + var data = Module.dataFileDownloads[download]; + total += data.total; + loaded += data.loaded; + num++; + } + total = Math.ceil( + (total * Module.expectedDataFileDownloads) / num, + ); + if (Module["setStatus"]) + Module["setStatus"](`Downloading data... (${loaded}/${total})`); + } else if (!Module.dataFileDownloads) { + if (Module["setStatus"]) + Module["setStatus"]("Downloading data..."); + } + }; + xhr.onerror = function (event) { + throw new Error("NetworkError for: " + packageName); + }; + xhr.onload = function (event) { + if ( + xhr.status == 200 || + xhr.status == 304 || + xhr.status == 206 || + (xhr.status == 0 && xhr.response) + ) { + var packageData = xhr.response; + callback(packageData); + } else { + throw new Error(xhr.statusText + " : " + xhr.responseURL); + } + }; + xhr.send(null); + } + function handleError(error) { + console.error("package error:", error); + } + var fetchedCallback = null; + var fetched = Module["getPreloadedPackage"] + ? Module["getPreloadedPackage"]( + REMOTE_PACKAGE_NAME, + REMOTE_PACKAGE_SIZE, + ) + : null; + if (!fetched) + fetchRemotePackage( + REMOTE_PACKAGE_NAME, + REMOTE_PACKAGE_SIZE, + function (data) { + if (fetchedCallback) { + fetchedCallback(data); + fetchedCallback = null; + } else { + fetched = data; + } + }, + handleError, + ); + function runWithFS() { + function assert(check, msg) { + if (!check) throw msg + new Error().stack; + } + Module["FS_createPath"]("/", "usd", true, true); + Module["FS_createPath"]("/usd", "ar", true, true); + Module["FS_createPath"]("/usd/ar", "resources", true, true); + Module["FS_createPath"]("/usd", "hd", true, true); + Module["FS_createPath"]("/usd/hd", "resources", true, true); + Module["FS_createPath"]( + "/usd/hd/resources", + "codegenTemplates", + true, + true, + ); + Module["FS_createPath"]("/usd", "httpResolver", true, true); + Module["FS_createPath"]("/usd/httpResolver", "resources", true, true); + Module["FS_createPath"]("/usd", "ndr", true, true); + Module["FS_createPath"]("/usd/ndr", "resources", true, true); + Module["FS_createPath"]("/usd", "sdf", true, true); + Module["FS_createPath"]("/usd/sdf", "resources", true, true); + Module["FS_createPath"]("/usd", "usd", true, true); + Module["FS_createPath"]("/usd/usd", "resources", true, true); + Module["FS_createPath"]( + "/usd/usd/resources", + "codegenTemplates", + true, + true, + ); + Module["FS_createPath"]("/usd/usd/resources", "usd", true, true); + Module["FS_createPath"]("/usd", "usdGeom", true, true); + Module["FS_createPath"]("/usd/usdGeom", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdGeom/resources", + "usdGeom", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdHydra", true, true); + Module["FS_createPath"]("/usd/usdHydra", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdHydra/resources", + "shaders", + true, + true, + ); + Module["FS_createPath"]( + "/usd/usdHydra/resources", + "usdHydra", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdImaging", true, true); + Module["FS_createPath"]("/usd/usdImaging", "resources", true, true); + Module["FS_createPath"]("/usd", "usdLux", true, true); + Module["FS_createPath"]("/usd/usdLux", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdLux/resources", + "usdLux", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdRender", true, true); + Module["FS_createPath"]("/usd/usdRender", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdRender/resources", + "usdRender", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdShade", true, true); + Module["FS_createPath"]("/usd/usdShade", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdShade/resources", + "usdShade", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdShaders", true, true); + Module["FS_createPath"]("/usd/usdShaders", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdShaders/resources", + "shaders", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdSkel", true, true); + Module["FS_createPath"]("/usd/usdSkel", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdSkel/resources", + "usdSkel", + true, + true, + ); + Module["FS_createPath"]("/usd", "usdVol", true, true); + Module["FS_createPath"]("/usd/usdVol", "resources", true, true); + Module["FS_createPath"]( + "/usd/usdVol/resources", + "usdVol", + true, + true, + ); + function DataRequest(start, end, audio) { + this.start = start; + this.end = end; + this.audio = audio; + } + DataRequest.prototype = { + requests: {}, + open: function (mode, name) { + this.name = name; + this.requests[name] = this; + Module["addRunDependency"](`fp ${this.name}`); + }, + send: function () {}, + onload: function () { + var byteArray = this.byteArray.subarray(this.start, this.end); + this.finish(byteArray); + }, + finish: function (byteArray) { + var that = this; + Module["FS_createDataFile"]( + this.name, + null, + byteArray, + true, + true, + true, + ); + Module["removeRunDependency"](`fp ${that.name}`); + this.requests[this.name] = null; + }, + }; + var files = metadata["files"]; + for (var i = 0; i < files.length; ++i) { + new DataRequest( + files[i]["start"], + files[i]["end"], + files[i]["audio"] || 0, + ).open("GET", files[i]["filename"]); + } + function processPackageData(arrayBuffer) { + assert(arrayBuffer, "Loading data file failed."); + assert( + arrayBuffer.constructor.name === ArrayBuffer.name, + "bad input to processPackageData", + ); + var byteArray = new Uint8Array(arrayBuffer); + DataRequest.prototype.byteArray = byteArray; + var files = metadata["files"]; + for (var i = 0; i < files.length; ++i) { + DataRequest.prototype.requests[files[i].filename].onload(); + } + Module["removeRunDependency"]("datafile_emHdBindings.data"); + } + Module["addRunDependency"]("datafile_emHdBindings.data"); + if (!Module.preloadResults) Module.preloadResults = {}; + Module.preloadResults[PACKAGE_NAME] = { fromCache: false }; + if (fetched) { + processPackageData(fetched); + fetched = null; + } else { + fetchedCallback = processPackageData; + } + } + if (Module["calledRun"]) { + runWithFS(); + } else { + if (!Module["preRun"]) Module["preRun"] = []; + Module["preRun"].push(runWithFS); + } + }; + loadPackage({ + files: [ + { filename: "/usd/ar/resources/plugInfo.json", start: 0, end: 589 }, + { + filename: "/usd/hd/resources/codegenTemplates/schemaClass.cpp", + start: 589, + end: 9620, + }, + { + filename: "/usd/hd/resources/codegenTemplates/schemaClass.h", + start: 9620, + end: 20258, + }, + { + filename: "/usd/hd/resources/plugInfo.json", + start: 20258, + end: 20483, + }, + { + filename: "/usd/httpResolver/resources/plugInfo.json", + start: 20483, + end: 20823, + }, + { + filename: "/usd/ndr/resources/plugInfo.json", + start: 20823, + end: 21397, + }, + { filename: "/usd/plugInfo.json", start: 21397, end: 21448 }, + { + filename: "/usd/sdf/resources/plugInfo.json", + start: 21448, + end: 22544, + }, + { + filename: "/usd/usd/resources/codegenTemplates/api.h", + start: 22544, + end: 24646, + }, + { + filename: "/usd/usd/resources/codegenTemplates/plugInfo.json", + start: 24646, + end: 25003, + }, + { + filename: "/usd/usd/resources/codegenTemplates/schemaClass.cpp", + start: 25003, + end: 37342, + }, + { + filename: "/usd/usd/resources/codegenTemplates/schemaClass.h", + start: 37342, + end: 54229, + }, + { + filename: "/usd/usd/resources/codegenTemplates/tokens.cpp", + start: 54229, + end: 55817, + }, + { + filename: "/usd/usd/resources/codegenTemplates/tokens.h", + start: 55817, + end: 59072, + }, + { + filename: "/usd/usd/resources/codegenTemplates/wrapSchemaClass.cpp", + start: 59072, + end: 68578, + }, + { + filename: "/usd/usd/resources/codegenTemplates/wrapTokens.cpp", + start: 68578, + end: 71099, + }, + { + filename: "/usd/usd/resources/generatedSchema.usda", + start: 71099, + end: 86803, + }, + { + filename: "/usd/usd/resources/plugInfo.json", + start: 86803, + end: 92530, + }, + { + filename: "/usd/usd/resources/usd/schema.usda", + start: 92530, + end: 110774, + }, + { + filename: "/usd/usdGeom/resources/generatedSchema.usda", + start: 110774, + end: 355640, + }, + { + filename: "/usd/usdGeom/resources/plugInfo.json", + start: 355640, + end: 371761, + }, + { + filename: "/usd/usdGeom/resources/usdGeom/schema.usda", + start: 371761, + end: 500520, + }, + { + filename: "/usd/usdHydra/resources/generatedSchema.usda", + start: 500520, + end: 501538, + }, + { + filename: "/usd/usdHydra/resources/plugInfo.json", + start: 501538, + end: 502826, + }, + { + filename: "/usd/usdHydra/resources/shaders/empty.glslfx", + start: 502826, + end: 504049, + }, + { + filename: "/usd/usdHydra/resources/shaders/shaderDefs.usda", + start: 504049, + end: 510806, + }, + { + filename: "/usd/usdHydra/resources/usdHydra/schema.usda", + start: 510806, + end: 518107, + }, + { + filename: "/usd/usdImaging/resources/plugInfo.json", + start: 518107, + end: 531776, + }, + { + filename: "/usd/usdLux/resources/generatedSchema.usda", + start: 531776, + end: 610666, + }, + { + filename: "/usd/usdLux/resources/plugInfo.json", + start: 610666, + end: 620463, + }, + { + filename: "/usd/usdLux/resources/usdLux/schema.usda", + start: 620463, + end: 662394, + }, + { + filename: "/usd/usdRender/resources/generatedSchema.usda", + start: 662394, + end: 685685, + }, + { + filename: "/usd/usdRender/resources/plugInfo.json", + start: 685685, + end: 688784, + }, + { + filename: "/usd/usdRender/resources/usdRender/schema.usda", + start: 688784, + end: 705492, + }, + { + filename: "/usd/usdShade/resources/generatedSchema.usda", + start: 705492, + end: 721492, + }, + { + filename: "/usd/usdShade/resources/plugInfo.json", + start: 721492, + end: 727378, + }, + { + filename: "/usd/usdShade/resources/usdShade/schema.usda", + start: 727378, + end: 754223, + }, + { + filename: "/usd/usdShaders/resources/plugInfo.json", + start: 754223, + end: 754902, + }, + { + filename: "/usd/usdShaders/resources/shaders/previewSurface.glslfx", + start: 754902, + end: 768823, + }, + { + filename: "/usd/usdShaders/resources/shaders/primvarReader.glslfx", + start: 768823, + end: 770046, + }, + { + filename: "/usd/usdShaders/resources/shaders/shaderDefs.usda", + start: 770046, + end: 784976, + }, + { + filename: "/usd/usdShaders/resources/shaders/transform2d.glslfx", + start: 784976, + end: 786199, + }, + { + filename: "/usd/usdShaders/resources/shaders/uvTexture.glslfx", + start: 786199, + end: 787422, + }, + { + filename: "/usd/usdSkel/resources/generatedSchema.usda", + start: 787422, + end: 802913, + }, + { + filename: "/usd/usdSkel/resources/plugInfo.json", + start: 802913, + end: 805907, + }, + { + filename: "/usd/usdSkel/resources/usdSkel/schema.usda", + start: 805907, + end: 816312, + }, + { + filename: "/usd/usdVol/resources/generatedSchema.usda", + start: 816312, + end: 840757, + }, + { + filename: "/usd/usdVol/resources/plugInfo.json", + start: 840757, + end: 843193, + }, + { + filename: "/usd/usdVol/resources/usdVol/schema.usda", + start: 843193, + end: 849069, + }, + ], + remote_package_size: 849069, + }); + })(); + if (!Module["ENVIRONMENT_IS_PTHREAD"]) { + function isMobileDevice() { + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( + navigator.userAgent, + ); + } + const MAX_MEMORY_MOBILE = 1024 * 1024 * 1024; + const MAX_MEMORY_DESKTOP = 4 * 1024 * 1024 * 1024; + const MAX_DEVICE_MEMORY = isMobileDevice() + ? MAX_MEMORY_MOBILE + : MAX_MEMORY_DESKTOP; + Module["wasmMemory"] = new WebAssembly.Memory({ + initial: 16777216 / 65536, + maximum: MAX_DEVICE_MEMORY / 65536, + shared: true, + }); + } + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var ENVIRONMENT_IS_WEB = typeof window == "object"; + var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + var ENVIRONMENT_IS_NODE = + typeof process == "object" && + typeof process.versions == "object" && + typeof process.versions.node == "string"; + var ENVIRONMENT_IS_PTHREAD = Module["ENVIRONMENT_IS_PTHREAD"] || false; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var read_, readAsync, readBinary; + if (ENVIRONMENT_IS_NODE) { + var fs = require("fs"); + var nodePath = require("path"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = nodePath.dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + read_ = (filename, binary) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename) => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + return ret; + }; + readAsync = (filename, onload, onerror, binary = true) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + fs.readFile(filename, binary ? undefined : "utf8", (err, data) => { + if (err) onerror(err); + else onload(binary ? data.buffer : data); + }); + }; + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; + Module["inspect"] = () => "[Emscripten Module object]"; + let nodeWorkerThreads; + try { + nodeWorkerThreads = require("worker_threads"); + } catch (e) { + console.error( + 'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?', + ); + throw e; + } + global.Worker = nodeWorkerThreads.Worker; + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } else { + scriptDirectory = ""; + } + if (!ENVIRONMENT_IS_NODE) { + read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }; + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + }; + } + } else { + } + if (ENVIRONMENT_IS_NODE) { + if (typeof performance == "undefined") { + global.performance = require("perf_hooks").performance; + } + } + var defaultPrint = console.log.bind(console); + var defaultPrintErr = console.error.bind(console); + if (ENVIRONMENT_IS_NODE) { + defaultPrint = (...args) => fs.writeSync(1, args.join(" ") + "\n"); + defaultPrintErr = (...args) => fs.writeSync(2, args.join(" ") + "\n"); + } + var out = Module["print"] || defaultPrint; + var err = Module["printErr"] || defaultPrintErr; + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + if (Module["arguments"]) arguments_ = Module["arguments"]; + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + if (Module["quit"]) quit_ = Module["quit"]; + var wasmBinary; + if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); + } + var wasmMemory; + var wasmModule; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + } + var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + assert( + INITIAL_MEMORY >= 5242880, + "INITIAL_MEMORY should be larger than STACK_SIZE, was " + + INITIAL_MEMORY + + "! (STACK_SIZE=" + + 5242880 + + ")", + ); + if (ENVIRONMENT_IS_PTHREAD) { + wasmMemory = Module["wasmMemory"]; + } else { + if (Module["wasmMemory"]) { + wasmMemory = Module["wasmMemory"]; + } else { + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + maximum: 4294967296 / 65536, + shared: true, + }); + if (!(wasmMemory.buffer instanceof SharedArrayBuffer)) { + err( + "requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag", + ); + if (ENVIRONMENT_IS_NODE) { + err( + "(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)", + ); + } + throw Error("bad memory"); + } + } + } + updateMemoryViews(); + INITIAL_MEMORY = wasmMemory.buffer.byteLength; + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATPOSTRUN__ = []; + var runtimeInitialized = false; + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); + } + function initRuntime() { + runtimeInitialized = true; + if (ENVIRONMENT_IS_PTHREAD) return; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + function postRun() { + if (ENVIRONMENT_IS_PTHREAD) return; + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); + } + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + function getUniqueRunDependency(id) { + return id; + } + function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + } + function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + what = "Aborted(" + what + ")"; + err(what); + // ABORT = true; // this does not allow anything to work after being set, however we're actually okay to try other assets so we shouldn't do this + EXITSTATUS = 1; + what += ". Build with -sASSERTIONS for more info."; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + var dataURIPrefix = "data:application/octet-stream;base64,"; + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + var isFileURI = (filename) => filename.startsWith("file://"); + var wasmBinaryFile; + wasmBinaryFile = "emHdBindings.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + function getBinaryPromise(binaryFile) { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(binaryFile)) { + return fetch(binaryFile, { credentials: "same-origin" }) + .then((response) => { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + binaryFile + "'"; + } + return response["arrayBuffer"](); + }) + .catch(() => getBinarySync(binaryFile)); + } else if (readAsync) { + return new Promise((resolve, reject) => { + readAsync( + binaryFile, + (response) => resolve(new Uint8Array(response)), + reject, + ); + }); + } + } + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => WebAssembly.instantiate(binary, imports)) + .then((instance) => instance) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + abort(reason); + }); + } + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == "function" && + !isDataURI(binaryFile) && + !isFileURI(binaryFile) && + !ENVIRONMENT_IS_NODE && + typeof fetch == "function" + ) { + return fetch(binaryFile, { credentials: "same-origin" }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + function createWasm() { + var info = { a: wasmImports }; + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + registerTLSInit(wasmExports["Hd"]); + wasmTable = wasmExports["Dd"]; + addOnInit(wasmExports["Bd"]); + wasmModule = module; + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + function receiveInstantiationResult(result) { + receiveInstance(result["instance"], result["module"]); + } + if (Module["instantiateWasm"]) { + try { + return Module["instantiateWasm"](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + readyPromiseReject(e); + } + } + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + var tempDouble; + var tempI64; + function __asyncjs__fetch_asset(route, dataPtr) { + return Asyncify.handleAsync(async () => { + const routeString = UTF8ToString(route); + const absoluteUrl = new URL(routeString); + try { + const response = await fetch(absoluteUrl); + if (!response.ok) + throw new Error("Fetch failed: " + response.statusText); + const buffer = await response.arrayBuffer(); + const length = buffer.byteLength; + const ptr = _malloc(length); + GROWABLE_HEAP_U8().set(new Uint8Array(buffer), ptr >>> 0); + Module.HEAP32[dataPtr >> 2] = ptr; + Module.HEAP32[(dataPtr >> 2) + 1] = length; + } catch (err) { + console.error("Error in fetch_asset: ", err); + Module.HEAP32[dataPtr >> 2] = 0; + Module.HEAP32[(dataPtr >> 2) + 1] = 0; + } + }); + } + function addToLoadedFiles(path) { + if (typeof self !== "undefined") { + if (typeof self.loadedFiles === "undefined") { + self.loadedFiles = []; + } + } else { + console.log("Neither window nor self is defined"); + } + self.loadedFiles.push(UTF8ToString(path)); + } + function downloadJS(data, filenamedata) { + const text = UTF8ToString(data); + const filename = UTF8ToString(filenamedata); + let element = document.createElement("a"); + element.setAttribute( + "href", + "data:text/plain;charset=utf-8," + encodeURIComponent(text), + ); + element.setAttribute("download", filename); + element.style.display = "none"; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + } + function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + var terminateWorker = (worker) => { + worker.terminate(); + worker.onmessage = (e) => {}; + }; + var killThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + delete PThread.pthreads[pthread_ptr]; + terminateWorker(worker); + __emscripten_thread_free_data(pthread_ptr); + PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker), 1); + worker.pthread_ptr = 0; + }; + var cancelThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + worker.postMessage({ cmd: "cancel" }); + }; + var cleanupThread = (pthread_ptr) => { + var worker = PThread.pthreads[pthread_ptr]; + assert(worker); + PThread.returnWorkerToPool(worker); + }; + var zeroMemory = (address, size) => { + GROWABLE_HEAP_U8().fill(0, address, address + size); + return address; + }; + var spawnThread = (threadParams) => { + var worker = PThread.getNewWorker(); + if (!worker) { + return 6; + } + PThread.runningWorkers.push(worker); + PThread.pthreads[threadParams.pthread_ptr] = worker; + worker.pthread_ptr = threadParams.pthread_ptr; + var msg = { + cmd: "run", + start_routine: threadParams.startRoutine, + arg: threadParams.arg, + pthread_ptr: threadParams.pthread_ptr, + }; + if (ENVIRONMENT_IS_NODE) { + worker.unref(); + } + worker.postMessage(msg, threadParams.transferList); + return 0; + }; + var runtimeKeepaliveCounter = 0; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: function () { + var paths = Array.prototype.slice.call(arguments); + return PATH.normalize(paths.join("/")); + }, + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => { + if ( + typeof crypto == "object" && + typeof crypto["getRandomValues"] == "function" + ) { + return (view) => ( + view.set(crypto.getRandomValues(new Uint8Array(view.byteLength))), + view + ); + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + var randomFillSync = crypto_module["randomFillSync"]; + if (randomFillSync) { + return (view) => crypto_module["randomFillSync"](view); + } + var randomBytes = crypto_module["randomBytes"]; + return (view) => (view.set(randomBytes(view.byteLength)), view); + } catch (e) {} + } + abort("initRandomDevice"); + }; + var randomFill = (view) => (randomFill = initRandomFill())(view); + var PATH_FS = { + resolve: function () { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { + idx >>>= 0; + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.slice(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + outIdx >>>= 0; + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++ >>> 0] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++ >>> 0] = 192 | (u >> 6); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++ >>> 0] = 224 | (u >> 12); + heap[outIdx++ >>> 0] = 128 | ((u >> 6) & 63); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++ >>> 0] = 240 | (u >> 18); + heap[outIdx++ >>> 0] = 128 | ((u >> 12) & 63); + heap[outIdx++ >>> 0] = 128 | ((u >> 6) & 63); + heap[outIdx++ >>> 0] = 128 | (u & 63); + } + } + heap[outIdx >>> 0] = 0; + return outIdx - startIdx; + }; + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; + else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + var alignMemory = (size, alignment) => + Math.ceil(size / alignment) * alignment; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + return zeroMemory(ptr, size); + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = [".", ".."]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === GROWABLE_HEAP_I8().buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === GROWABLE_HEAP_I8().buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + GROWABLE_HEAP_I8().set(contents, ptr >>> 0); + } + return { ptr: ptr, allocated: allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ""; + readAsync( + url, + (arrayBuffer) => { + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (event) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + if (onload) onload(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, (byteArray) => processData(byteArray), onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + if (!path) return { path: "", node: null }; + var defaults = { follow_mount: true, recurse_count: 0 }; + opts = Object.assign(defaults, opts); + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + if (!FS.FSStream) { + FS.FSStream = function () { + this.shared = {}; + }; + FS.FSStream.prototype = {}; + Object.defineProperties(FS.FSStream.prototype, { + object: { + get() { + return this.node; + }, + set(val) { + this.node = val; + }, + }, + isRead: { + get() { + return (this.flags & 2097155) !== 1; + }, + }, + isWrite: { + get() { + return (this.flags & 2097155) !== 0; + }, + }, + isAppend: { + get() { + return this.flags & 1024; + }, + }, + flags: { + get() { + return this.shared.flags; + }, + set(val) { + this.shared.flags = val; + }, + }, + position: { + get() { + return this.shared.position; + }, + set(val) { + this.shared.position = val; + }, + }, + }); + } + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [], + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { timestamp: Date.now() }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { size: len, timestamp: Date.now() }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); + }, + open(path, flags, mode) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { follow: !(flags & 131072) }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + munmap: (stream) => 0, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams() { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + }, + ensureErrnoError() { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.name = "ErrnoError"; + this.node = node; + this.setErrno = function (errno) { + this.errno = errno; + }; + this.setErrno(errno); + this.message = "FS error"; + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit() { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS: MEMFS }; + }, + init(input, output, error) { + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit() { + FS.init.initialized = false; + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = + function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = + function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + }, + }, + chunkSize: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + }, + }, + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, GROWABLE_HEAP_I8(), ptr, length, position); + return { ptr: ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + ptr >>>= 0; + return ptr + ? UTF8ArrayToString(GROWABLE_HEAP_U8(), ptr, maxBytesToRead) + : ""; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if ( + e && + e.node && + PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node)) + ) { + return -54; + } + throw e; + } + GROWABLE_HEAP_I32()[(buf >>> 2) >>> 0] = stat.dev; + GROWABLE_HEAP_I32()[((buf + 4) >>> 2) >>> 0] = stat.mode; + GROWABLE_HEAP_U32()[((buf + 8) >>> 2) >>> 0] = stat.nlink; + GROWABLE_HEAP_I32()[((buf + 12) >>> 2) >>> 0] = stat.uid; + GROWABLE_HEAP_I32()[((buf + 16) >>> 2) >>> 0] = stat.gid; + GROWABLE_HEAP_I32()[((buf + 20) >>> 2) >>> 0] = stat.rdev; + (tempI64 = [ + stat.size >>> 0, + ((tempDouble = stat.size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 24) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 28) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_I32()[((buf + 32) >>> 2) >>> 0] = 4096; + GROWABLE_HEAP_I32()[((buf + 36) >>> 2) >>> 0] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + (tempI64 = [ + Math.floor(atime / 1e3) >>> 0, + ((tempDouble = Math.floor(atime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 40) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 44) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 48) >>> 2) >>> 0] = (atime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(mtime / 1e3) >>> 0, + ((tempDouble = Math.floor(mtime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 56) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 60) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 64) >>> 2) >>> 0] = (mtime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(ctime / 1e3) >>> 0, + ((tempDouble = Math.floor(ctime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 72) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 76) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_U32()[((buf + 80) >>> 2) >>> 0] = (ctime % 1e3) * 1e3; + (tempI64 = [ + stat.ino >>> 0, + ((tempDouble = stat.ino), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((buf + 88) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((buf + 92) >>> 2) >>> 0] = tempI64[1]); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = GROWABLE_HEAP_U8().slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + varargs: undefined, + get() { + var ret = GROWABLE_HEAP_I32()[(+SYSCALLS.varargs >>> 2) >>> 0]; + SYSCALLS.varargs += 4; + return ret; + }, + getp() { + return SYSCALLS.get(); + }, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + }; + function _proc_exit(code) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(0, 1, code); + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + PThread.terminateAllThreads(); + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + } + var exitJS = (status, implicit) => { + EXITSTATUS = status; + if (ENVIRONMENT_IS_PTHREAD) { + exitOnMainThread(status); + throw "unwind"; + } + _proc_exit(status); + }; + var _exit = exitJS; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); + }; + var PThread = { + unusedWorkers: [], + runningWorkers: [], + tlsInitFunctions: [], + pthreads: {}, + init() { + if (ENVIRONMENT_IS_PTHREAD) { + PThread.initWorker(); + } else { + PThread.initMainThread(); + } + }, + initMainThread() { + var pthreadPoolSize = 10; + while (pthreadPoolSize--) { + PThread.allocateUnusedWorker(); + } + addOnPreRun(() => { + addRunDependency("loading-workers"); + PThread.loadWasmModuleToAllWorkers(() => + removeRunDependency("loading-workers"), + ); + }); + }, + initWorker() { + noExitRuntime = false; + }, + setExitStatus: (status) => { + EXITSTATUS = status; + }, + terminateAllThreads__deps: ["$terminateWorker"], + terminateAllThreads: () => { + for (var worker of PThread.runningWorkers) { + terminateWorker(worker); + } + for (var worker of PThread.unusedWorkers) { + terminateWorker(worker); + } + PThread.unusedWorkers = []; + PThread.runningWorkers = []; + PThread.pthreads = []; + }, + returnWorkerToPool: (worker) => { + var pthread_ptr = worker.pthread_ptr; + delete PThread.pthreads[pthread_ptr]; + PThread.unusedWorkers.push(worker); + PThread.runningWorkers.splice( + PThread.runningWorkers.indexOf(worker), + 1, + ); + worker.pthread_ptr = 0; + __emscripten_thread_free_data(pthread_ptr); + }, + receiveObjectTransfer(data) {}, + threadInitTLS() { + PThread.tlsInitFunctions.forEach((f) => f()); + }, + loadWasmModuleToWorker: (worker) => + new Promise((onFinishedLoading) => { + worker.onmessage = (e) => { + var d = e["data"]; + var cmd = d["cmd"]; + if (d["targetThread"] && d["targetThread"] != _pthread_self()) { + var targetWorker = PThread.pthreads[d["targetThread"]]; + if (targetWorker) { + targetWorker.postMessage(d, d["transferList"]); + } else { + err( + `Internal error! Worker sent a message "${cmd}" to target pthread ${d["targetThread"]}, but that thread no longer exists!`, + ); + } + return; + } + if (cmd === "checkMailbox") { + checkMailbox(); + } else if (cmd === "spawnThread") { + spawnThread(d); + } else if (cmd === "cleanupThread") { + cleanupThread(d["thread"]); + } else if (cmd === "killThread") { + killThread(d["thread"]); + } else if (cmd === "cancelThread") { + cancelThread(d["thread"]); + } else if (cmd === "loaded") { + worker.loaded = true; + if (ENVIRONMENT_IS_NODE && !worker.pthread_ptr) { + worker.unref(); + } + onFinishedLoading(worker); + } else if (cmd === "alert") { + alert(`Thread ${d["threadId"]}: ${d["text"]}`); + } else if (d.target === "setimmediate") { + worker.postMessage(d); + } else if (cmd === "callHandler") { + Module[d["handler"]](...d["args"]); + } else if (cmd) { + err(`worker sent an unknown command ${cmd}`); + } + }; + worker.onerror = (e) => { + var message = "worker sent an error!"; + err(`${message} ${e.filename}:${e.lineno}: ${e.message}`); + throw e; + }; + if (ENVIRONMENT_IS_NODE) { + worker.on("message", (data) => worker.onmessage({ data: data })); + worker.on("error", (e) => worker.onerror(e)); + } + var handlers = []; + var knownHandlers = ["onExit", "onAbort", "print", "printErr"]; + for (var handler of knownHandlers) { + if (Module.hasOwnProperty(handler)) { + handlers.push(handler); + } + } + worker.postMessage({ + cmd: "load", + handlers: handlers, + urlOrBlob: Module["mainScriptUrlOrBlob"] || _scriptDir, + wasmMemory: wasmMemory, + wasmModule: wasmModule, + }); + }), + loadWasmModuleToAllWorkers(onMaybeReady) { + if (ENVIRONMENT_IS_PTHREAD) { + return onMaybeReady(); + } + let pthreadPoolReady = Promise.all( + PThread.unusedWorkers.map(PThread.loadWasmModuleToWorker), + ); + pthreadPoolReady.then(onMaybeReady); + }, + allocateUnusedWorker() { + var worker; + var pthreadMainJs = locateFile("emHdBindings.worker.js"); + worker = new Worker(pthreadMainJs); + PThread.unusedWorkers.push(worker); + }, + getNewWorker() { + if (PThread.unusedWorkers.length == 0) { + PThread.allocateUnusedWorker(); + PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]); + } + return PThread.unusedWorkers.pop(); + }, + }; + Module["PThread"] = PThread; + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var establishStackSpace = () => { + var pthread_ptr = _pthread_self(); + var stackHigh = GROWABLE_HEAP_U32()[((pthread_ptr + 52) >>> 2) >>> 0]; + var stackSize = GROWABLE_HEAP_U32()[((pthread_ptr + 56) >>> 2) >>> 0]; + var stackLow = stackHigh - stackSize; + _emscripten_stack_set_limits(stackHigh, stackLow); + stackRestore(stackHigh); + }; + Module["establishStackSpace"] = establishStackSpace; + function exitOnMainThread(returnCode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(1, 0, returnCode); + _exit(returnCode); + } + var invokeEntryPoint = (ptr, arg) => { + var result = ((a1) => dynCall_ii.apply(null, [ptr, a1]))(arg); + function finish(result) { + if (keepRuntimeAlive()) { + PThread.setExitStatus(result); + } else { + __emscripten_thread_exit(result); + } + } + finish(result); + }; + Module["invokeEntryPoint"] = invokeEntryPoint; + var noExitRuntime = Module["noExitRuntime"] || true; + var registerTLSInit = (tlsInitFunc) => { + PThread.tlsInitFunctions.push(tlsInitFunc); + }; + var convertI32PairToI53Checked = (lo, hi) => + (hi + 2097152) >>> 0 < 4194305 - !!lo + ? (lo >>> 0) + hi * 4294967296 + : NaN; + var ___call_sighandler = function (fp, sig) { + fp >>>= 0; + return ((a1) => dynCall_vi.apply(null, [fp, a1]))(sig); + }; + var exceptionCaught = []; + var uncaughtExceptionCount = 0; + function ___cxa_begin_catch(ptr) { + ptr >>>= 0; + var info = new ExceptionInfo(ptr); + if (!info.get_caught()) { + info.set_caught(true); + uncaughtExceptionCount--; + } + info.set_rethrown(false); + exceptionCaught.push(info); + ___cxa_increment_exception_refcount(info.excPtr); + return info.get_exception_ptr(); + } + var exceptionLast = 0; + var ___cxa_end_catch = () => { + _setThrew(0, 0); + var info = exceptionCaught.pop(); + ___cxa_decrement_exception_refcount(info.excPtr); + exceptionLast = 0; + }; + function ExceptionInfo(excPtr) { + this.excPtr = excPtr; + this.ptr = excPtr - 24; + this.set_type = function (type) { + GROWABLE_HEAP_U32()[((this.ptr + 4) >>> 2) >>> 0] = type; + }; + this.get_type = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 4) >>> 2) >>> 0]; + }; + this.set_destructor = function (destructor) { + GROWABLE_HEAP_U32()[((this.ptr + 8) >>> 2) >>> 0] = destructor; + }; + this.get_destructor = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 8) >>> 2) >>> 0]; + }; + this.set_caught = function (caught) { + caught = caught ? 1 : 0; + GROWABLE_HEAP_I8()[((this.ptr + 12) >>> 0) >>> 0] = caught; + }; + this.get_caught = function () { + return GROWABLE_HEAP_I8()[((this.ptr + 12) >>> 0) >>> 0] != 0; + }; + this.set_rethrown = function (rethrown) { + rethrown = rethrown ? 1 : 0; + GROWABLE_HEAP_I8()[((this.ptr + 13) >>> 0) >>> 0] = rethrown; + }; + this.get_rethrown = function () { + return GROWABLE_HEAP_I8()[((this.ptr + 13) >>> 0) >>> 0] != 0; + }; + this.init = function (type, destructor) { + this.set_adjusted_ptr(0); + this.set_type(type); + this.set_destructor(destructor); + }; + this.set_adjusted_ptr = function (adjustedPtr) { + GROWABLE_HEAP_U32()[((this.ptr + 16) >>> 2) >>> 0] = adjustedPtr; + }; + this.get_adjusted_ptr = function () { + return GROWABLE_HEAP_U32()[((this.ptr + 16) >>> 2) >>> 0]; + }; + this.get_exception_ptr = function () { + var isPointer = ___cxa_is_pointer_type(this.get_type()); + if (isPointer) { + return GROWABLE_HEAP_U32()[(this.excPtr >>> 2) >>> 0]; + } + var adjusted = this.get_adjusted_ptr(); + if (adjusted !== 0) return adjusted; + return this.excPtr; + }; + } + function ___resumeException(ptr) { + ptr >>>= 0; + if (!exceptionLast) { + exceptionLast = ptr; + } + throw exceptionLast; + } + var findMatchingCatch = (args) => { + var thrown = exceptionLast; + if (!thrown) { + setTempRet0(0); + return 0; + } + var info = new ExceptionInfo(thrown); + info.set_adjusted_ptr(thrown); + var thrownType = info.get_type(); + if (!thrownType) { + setTempRet0(0); + return thrown; + } + for (var arg in args) { + var caughtType = args[arg]; + if (caughtType === 0 || caughtType === thrownType) { + break; + } + var adjusted_ptr_addr = info.ptr + 16; + if (___cxa_can_catch(caughtType, thrownType, adjusted_ptr_addr)) { + setTempRet0(caughtType); + return thrown; + } + } + setTempRet0(thrownType); + return thrown; + }; + function ___cxa_find_matching_catch_2() { + return findMatchingCatch([]); + } + function ___cxa_find_matching_catch_3(arg0) { + arg0 >>>= 0; + return findMatchingCatch([arg0]); + } + function ___cxa_find_matching_catch_4(arg0, arg1) { + arg0 >>>= 0; + arg1 >>>= 0; + return findMatchingCatch([arg0, arg1]); + } + function ___cxa_get_exception_ptr(ptr) { + ptr >>>= 0; + var rtn = new ExceptionInfo(ptr).get_exception_ptr(); + return rtn; + } + var ___cxa_rethrow = () => { + var info = exceptionCaught.pop(); + if (!info) { + abort("no exception to throw"); + } + var ptr = info.excPtr; + if (!info.get_rethrown()) { + exceptionCaught.push(info); + info.set_rethrown(true); + info.set_caught(false); + uncaughtExceptionCount++; + } + exceptionLast = ptr; + throw exceptionLast; + }; + function ___cxa_rethrow_primary_exception(ptr) { + ptr >>>= 0; + if (!ptr) return; + var info = new ExceptionInfo(ptr); + exceptionCaught.push(info); + info.set_rethrown(true); + ___cxa_rethrow(); + } + function ___cxa_throw(ptr, type, destructor) { + ptr >>>= 0; + type >>>= 0; + destructor >>>= 0; + var info = new ExceptionInfo(ptr); + info.init(type, destructor); + exceptionLast = ptr; + uncaughtExceptionCount++; + throw exceptionLast; + } + var ___cxa_uncaught_exceptions = () => uncaughtExceptionCount; + function ___emscripten_init_main_thread_js(tb) { + tb >>>= 0; + __emscripten_thread_init( + tb, + !ENVIRONMENT_IS_WORKER, + 1, + !ENVIRONMENT_IS_WEB, + 2097152, + false, + ); + PThread.threadInitTLS(); + } + function ___emscripten_thread_cleanup(thread) { + thread >>>= 0; + if (!ENVIRONMENT_IS_PTHREAD) cleanupThread(thread); + else postMessage({ cmd: "cleanupThread", thread: thread }); + } + function pthreadCreateProxied(pthread_ptr, attr, startRoutine, arg) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(2, 1, pthread_ptr, attr, startRoutine, arg); + return ___pthread_create_js(pthread_ptr, attr, startRoutine, arg); + } + function ___pthread_create_js(pthread_ptr, attr, startRoutine, arg) { + pthread_ptr >>>= 0; + attr >>>= 0; + startRoutine >>>= 0; + arg >>>= 0; + if (typeof SharedArrayBuffer == "undefined") { + err( + "Current environment does not support SharedArrayBuffer, pthreads are not available!", + ); + return 6; + } + var transferList = []; + var error = 0; + if (ENVIRONMENT_IS_PTHREAD && (transferList.length === 0 || error)) { + return pthreadCreateProxied(pthread_ptr, attr, startRoutine, arg); + } + if (error) return error; + var threadParams = { + startRoutine: startRoutine, + pthread_ptr: pthread_ptr, + arg: arg, + transferList: transferList, + }; + if (ENVIRONMENT_IS_PTHREAD) { + threadParams.cmd = "spawnThread"; + postMessage(threadParams, transferList); + return 0; + } + return spawnThread(threadParams); + } + function ___syscall_chmod(path, mode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(3, 1, path, mode); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_faccessat(dirfd, path, amode, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(4, 1, dirfd, path, amode, flags); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fadvise64(fd, offset, len, advice) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(5, 0, fd, offset, len, advice); + return 0; + } + function ___syscall_fchmod(fd, mode) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(6, 1, fd, mode); + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var setErrNo = (value) => { + GROWABLE_HEAP_I32()[(___errno_location() >>> 2) >>> 0] = value; + return value; + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(7, 1, fd, cmd, varargs); + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.createStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = SYSCALLS.getp(); + var offset = 0; + GROWABLE_HEAP_I16()[((arg + offset) >>> 1) >>> 0] = 2; + return 0; + } + case 6: + case 7: + return 0; + case 16: + case 8: + return -28; + case 9: + setErrNo(28); + return -1; + default: { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(8, 1, fd, buf); + buf >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => + stringToUTF8Array(str, GROWABLE_HEAP_U8(), outPtr, maxBytesToWrite); + function ___syscall_getcwd(buf, size) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(9, 1, buf, size); + buf >>>= 0; + size >>>= 0; + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_getdents64(fd, dirp, count) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(10, 1, fd, dirp, count); + dirp >>>= 0; + count >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (!stream.getdents) { + stream.getdents = FS.readdir(stream.path); + } + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var idx = Math.floor(off / struct_size); + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { parent: true }); + id = lookup.node.id; + type = 4; + } else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) + ? 2 + : FS.isDir(child.mode) + ? 4 + : FS.isLink(child.mode) + ? 10 + : 8; + } + (tempI64 = [ + id >>> 0, + ((tempDouble = id), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((dirp + pos) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((dirp + pos + 4) >>> 2) >>> 0] = tempI64[1]); + (tempI64 = [ + ((idx + 1) * struct_size) >>> 0, + ((tempDouble = (idx + 1) * struct_size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((dirp + pos + 8) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((dirp + pos + 12) >>> 2) >>> 0] = tempI64[1]); + GROWABLE_HEAP_I16()[((dirp + pos + 16) >>> 1) >>> 0] = 280; + GROWABLE_HEAP_I8()[((dirp + pos + 18) >>> 0) >>> 0] = type; + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(11, 1, fd, op, varargs); + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0] = termios.c_iflag || 0; + GROWABLE_HEAP_I32()[((argp + 4) >>> 2) >>> 0] = + termios.c_oflag || 0; + GROWABLE_HEAP_I32()[((argp + 8) >>> 2) >>> 0] = + termios.c_cflag || 0; + GROWABLE_HEAP_I32()[((argp + 12) >>> 2) >>> 0] = + termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + GROWABLE_HEAP_I8()[((argp + i + 17) >>> 0) >>> 0] = + termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = SYSCALLS.getp(); + var c_iflag = GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0]; + var c_oflag = GROWABLE_HEAP_I32()[((argp + 4) >>> 2) >>> 0]; + var c_cflag = GROWABLE_HEAP_I32()[((argp + 8) >>> 2) >>> 0]; + var c_lflag = GROWABLE_HEAP_I32()[((argp + 12) >>> 2) >>> 0]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(GROWABLE_HEAP_I8()[((argp + i + 17) >>> 0) >>> 0]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag: c_iflag, + c_oflag: c_oflag, + c_cflag: c_cflag, + c_lflag: c_lflag, + c_cc: c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I32()[(argp >>> 2) >>> 0] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = SYSCALLS.getp(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = SYSCALLS.getp(); + GROWABLE_HEAP_I16()[(argp >>> 1) >>> 0] = winsize[0]; + GROWABLE_HEAP_I16()[((argp + 2) >>> 1) >>> 0] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_lstat64(path, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(12, 1, path, buf); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_mkdirat(dirfd, path, mode) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(13, 1, dirfd, path, mode); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + path = PATH.normalize(path); + if (path[path.length - 1] === "/") + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_newfstatat(dirfd, path, buf, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(14, 1, dirfd, path, buf, flags); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(15, 1, dirfd, path, flags, varargs); + path >>>= 0; + varargs >>>= 0; + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? SYSCALLS.get() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(16, 1, dirfd, path, buf, bufsize); + path >>>= 0; + buf >>>= 0; + bufsize >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = GROWABLE_HEAP_I8()[(buf + len) >>> 0]; + stringToUTF8(ret, buf, bufsize + 1); + GROWABLE_HEAP_I8()[(buf + len) >>> 0] = endChar; + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(17, 1, olddirfd, oldpath, newdirfd, newpath); + oldpath >>>= 0; + newpath >>>= 0; + try { + oldpath = SYSCALLS.getStr(oldpath); + newpath = SYSCALLS.getStr(newpath); + oldpath = SYSCALLS.calculateAt(olddirfd, oldpath); + newpath = SYSCALLS.calculateAt(newdirfd, newpath); + FS.rename(oldpath, newpath); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_stat64(path, buf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(18, 1, path, buf); + path >>>= 0; + buf >>>= 0; + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_unlinkat(dirfd, path, flags) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(19, 1, dirfd, path, flags); + path >>>= 0; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __embind_register_bigint( + primitiveType, + name, + size, + minRange, + maxRange, + ) { + primitiveType >>>= 0; + name >>>= 0; + size >>>= 0; + } + var embind_init_charCodes = () => { + var codes = new Array(256); + for (var i = 0; i < 256; ++i) { + codes[i] = String.fromCharCode(i); + } + embind_charCodes = codes; + }; + var embind_charCodes; + var readLatin1String = (ptr) => { + var ret = ""; + var c = ptr; + while (GROWABLE_HEAP_U8()[c >>> 0]) { + ret += embind_charCodes[GROWABLE_HEAP_U8()[c++ >>> 0]]; + } + return ret; + }; + var awaitingDependencies = {}; + var registeredTypes = {}; + var typeDependencies = {}; + var BindingError; + var throwBindingError = (message) => { + throw new BindingError(message); + }; + var InternalError; + var throwInternalError = (message) => { + throw new InternalError(message); + }; + var whenDependentTypesAreResolved = ( + myTypes, + dependentTypes, + getTypeConverters, + ) => { + myTypes.forEach(function (type) { + typeDependencies[type] = dependentTypes; + }); + function onComplete(typeConverters) { + var myTypeConverters = getTypeConverters(typeConverters); + if (myTypeConverters.length !== myTypes.length) { + throwInternalError("Mismatched type converter count"); + } + for (var i = 0; i < myTypes.length; ++i) { + registerType(myTypes[i], myTypeConverters[i]); + } + } + var typeConverters = new Array(dependentTypes.length); + var unregisteredTypes = []; + var registered = 0; + dependentTypes.forEach((dt, i) => { + if (registeredTypes.hasOwnProperty(dt)) { + typeConverters[i] = registeredTypes[dt]; + } else { + unregisteredTypes.push(dt); + if (!awaitingDependencies.hasOwnProperty(dt)) { + awaitingDependencies[dt] = []; + } + awaitingDependencies[dt].push(() => { + typeConverters[i] = registeredTypes[dt]; + ++registered; + if (registered === unregisteredTypes.length) { + onComplete(typeConverters); + } + }); + } + }); + if (0 === unregisteredTypes.length) { + onComplete(typeConverters); + } + }; + function sharedRegisterType(rawType, registeredInstance, options = {}) { + var name = registeredInstance.name; + if (!rawType) { + throwBindingError( + `type "${name}" must have a positive integer typeid pointer`, + ); + } + if (registeredTypes.hasOwnProperty(rawType)) { + if (options.ignoreDuplicateRegistrations) { + return; + } else { + throwBindingError(`Cannot register type '${name}' twice`); + } + } + registeredTypes[rawType] = registeredInstance; + delete typeDependencies[rawType]; + if (awaitingDependencies.hasOwnProperty(rawType)) { + var callbacks = awaitingDependencies[rawType]; + delete awaitingDependencies[rawType]; + callbacks.forEach((cb) => cb()); + } + } + function registerType(rawType, registeredInstance, options = {}) { + if (!("argPackAdvance" in registeredInstance)) { + throw new TypeError( + "registerType registeredInstance requires argPackAdvance", + ); + } + return sharedRegisterType(rawType, registeredInstance, options); + } + var GenericWireTypeSize = 8; + function __embind_register_bool(rawType, name, trueValue, falseValue) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: function (wt) { + return !!wt; + }, + toWireType: function (destructors, o) { + return o ? trueValue : falseValue; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: function (pointer) { + return this["fromWireType"](GROWABLE_HEAP_U8()[pointer >>> 0]); + }, + destructorFunction: null, + }); + } + var shallowCopyInternalPointer = (o) => ({ + count: o.count, + deleteScheduled: o.deleteScheduled, + preservePointerOnDelete: o.preservePointerOnDelete, + ptr: o.ptr, + ptrType: o.ptrType, + smartPtr: o.smartPtr, + smartPtrType: o.smartPtrType, + }); + var throwInstanceAlreadyDeleted = (obj) => { + function getInstanceTypeName(handle) { + return handle.$$.ptrType.registeredClass.name; + } + throwBindingError(getInstanceTypeName(obj) + " instance already deleted"); + }; + var finalizationRegistry = false; + var detachFinalizer = (handle) => {}; + var runDestructor = ($$) => { + if ($$.smartPtr) { + $$.smartPtrType.rawDestructor($$.smartPtr); + } else { + $$.ptrType.registeredClass.rawDestructor($$.ptr); + } + }; + var releaseClassHandle = ($$) => { + $$.count.value -= 1; + var toDelete = 0 === $$.count.value; + if (toDelete) { + runDestructor($$); + } + }; + var downcastPointer = (ptr, ptrClass, desiredClass) => { + if (ptrClass === desiredClass) { + return ptr; + } + if (undefined === desiredClass.baseClass) { + return null; + } + var rv = downcastPointer(ptr, ptrClass, desiredClass.baseClass); + if (rv === null) { + return null; + } + return desiredClass.downcast(rv); + }; + var registeredPointers = {}; + var getInheritedInstanceCount = () => + Object.keys(registeredInstances).length; + var getLiveInheritedInstances = () => { + var rv = []; + for (var k in registeredInstances) { + if (registeredInstances.hasOwnProperty(k)) { + rv.push(registeredInstances[k]); + } + } + return rv; + }; + var deletionQueue = []; + var flushPendingDeletes = () => { + while (deletionQueue.length) { + var obj = deletionQueue.pop(); + obj.$$.deleteScheduled = false; + obj["delete"](); + } + }; + var delayFunction; + var setDelayFunction = (fn) => { + delayFunction = fn; + if (deletionQueue.length && delayFunction) { + delayFunction(flushPendingDeletes); + } + }; + var init_embind = () => { + Module["getInheritedInstanceCount"] = getInheritedInstanceCount; + Module["getLiveInheritedInstances"] = getLiveInheritedInstances; + Module["flushPendingDeletes"] = flushPendingDeletes; + Module["setDelayFunction"] = setDelayFunction; + }; + var registeredInstances = {}; + var getBasestPointer = (class_, ptr) => { + if (ptr === undefined) { + throwBindingError("ptr should not be undefined"); + } + while (class_.baseClass) { + ptr = class_.upcast(ptr); + class_ = class_.baseClass; + } + return ptr; + }; + var getInheritedInstance = (class_, ptr) => { + ptr = getBasestPointer(class_, ptr); + return registeredInstances[ptr]; + }; + var makeClassHandle = (prototype, record) => { + if (!record.ptrType || !record.ptr) { + throwInternalError("makeClassHandle requires ptr and ptrType"); + } + var hasSmartPtrType = !!record.smartPtrType; + var hasSmartPtr = !!record.smartPtr; + if (hasSmartPtrType !== hasSmartPtr) { + throwInternalError("Both smartPtrType and smartPtr must be specified"); + } + record.count = { value: 1 }; + return attachFinalizer( + Object.create(prototype, { $$: { value: record } }), + ); + }; + function RegisteredPointer_fromWireType(ptr) { + var rawPointer = this.getPointee(ptr); + if (!rawPointer) { + this.destructor(ptr); + return null; + } + var registeredInstance = getInheritedInstance( + this.registeredClass, + rawPointer, + ); + if (undefined !== registeredInstance) { + if (0 === registeredInstance.$$.count.value) { + registeredInstance.$$.ptr = rawPointer; + registeredInstance.$$.smartPtr = ptr; + return registeredInstance["clone"](); + } else { + var rv = registeredInstance["clone"](); + this.destructor(ptr); + return rv; + } + } + function makeDefaultHandle() { + if (this.isSmartPointer) { + return makeClassHandle(this.registeredClass.instancePrototype, { + ptrType: this.pointeeType, + ptr: rawPointer, + smartPtrType: this, + smartPtr: ptr, + }); + } else { + return makeClassHandle(this.registeredClass.instancePrototype, { + ptrType: this, + ptr: ptr, + }); + } + } + var actualType = this.registeredClass.getActualType(rawPointer); + var registeredPointerRecord = registeredPointers[actualType]; + if (!registeredPointerRecord) { + return makeDefaultHandle.call(this); + } + var toType; + if (this.isConst) { + toType = registeredPointerRecord.constPointerType; + } else { + toType = registeredPointerRecord.pointerType; + } + var dp = downcastPointer( + rawPointer, + this.registeredClass, + toType.registeredClass, + ); + if (dp === null) { + return makeDefaultHandle.call(this); + } + if (this.isSmartPointer) { + return makeClassHandle(toType.registeredClass.instancePrototype, { + ptrType: toType, + ptr: dp, + smartPtrType: this, + smartPtr: ptr, + }); + } else { + return makeClassHandle(toType.registeredClass.instancePrototype, { + ptrType: toType, + ptr: dp, + }); + } + } + var attachFinalizer = (handle) => { + if ("undefined" === typeof FinalizationRegistry) { + attachFinalizer = (handle) => handle; + return handle; + } + finalizationRegistry = new FinalizationRegistry((info) => { + releaseClassHandle(info.$$); + }); + attachFinalizer = (handle) => { + var $$ = handle.$$; + var hasSmartPtr = !!$$.smartPtr; + if (hasSmartPtr) { + var info = { $$: $$ }; + finalizationRegistry.register(handle, info, handle); + } + return handle; + }; + detachFinalizer = (handle) => finalizationRegistry.unregister(handle); + return attachFinalizer(handle); + }; + var init_ClassHandle = () => { + Object.assign(ClassHandle.prototype, { + isAliasOf(other) { + if (!(this instanceof ClassHandle)) { + return false; + } + if (!(other instanceof ClassHandle)) { + return false; + } + var leftClass = this.$$.ptrType.registeredClass; + var left = this.$$.ptr; + other.$$ = other.$$; + var rightClass = other.$$.ptrType.registeredClass; + var right = other.$$.ptr; + while (leftClass.baseClass) { + left = leftClass.upcast(left); + leftClass = leftClass.baseClass; + } + while (rightClass.baseClass) { + right = rightClass.upcast(right); + rightClass = rightClass.baseClass; + } + return leftClass === rightClass && left === right; + }, + clone() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.preservePointerOnDelete) { + this.$$.count.value += 1; + return this; + } else { + var clone = attachFinalizer( + Object.create(Object.getPrototypeOf(this), { + $$: { value: shallowCopyInternalPointer(this.$$) }, + }), + ); + clone.$$.count.value += 1; + clone.$$.deleteScheduled = false; + return clone; + } + }, + delete() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) { + throwBindingError("Object already scheduled for deletion"); + } + detachFinalizer(this); + releaseClassHandle(this.$$); + if (!this.$$.preservePointerOnDelete) { + this.$$.smartPtr = undefined; + this.$$.ptr = undefined; + } + }, + isDeleted() { + return !this.$$.ptr; + }, + deleteLater() { + if (!this.$$.ptr) { + throwInstanceAlreadyDeleted(this); + } + if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) { + throwBindingError("Object already scheduled for deletion"); + } + deletionQueue.push(this); + if (deletionQueue.length === 1 && delayFunction) { + delayFunction(flushPendingDeletes); + } + this.$$.deleteScheduled = true; + return this; + }, + }); + }; + function ClassHandle() {} + var char_0 = 48; + var char_9 = 57; + var makeLegalFunctionName = (name) => { + if (undefined === name) { + return "_unknown"; + } + name = name.replace(/[^a-zA-Z0-9_]/g, "$"); + var f = name.charCodeAt(0); + if (f >= char_0 && f <= char_9) { + return `_${name}`; + } + return name; + }; + function createNamedFunction(name, body) { + name = makeLegalFunctionName(name); + return { + [name]: function () { + return body.apply(this, arguments); + }, + }[name]; + } + var ensureOverloadTable = (proto, methodName, humanName) => { + if (undefined === proto[methodName].overloadTable) { + var prevFunc = proto[methodName]; + proto[methodName] = function () { + if ( + !proto[methodName].overloadTable.hasOwnProperty(arguments.length) + ) { + throwBindingError( + `Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`, + ); + } + return proto[methodName].overloadTable[arguments.length].apply( + this, + arguments, + ); + }; + proto[methodName].overloadTable = []; + proto[methodName].overloadTable[prevFunc.argCount] = prevFunc; + } + }; + var exposePublicSymbol = (name, value, numArguments) => { + if (Module.hasOwnProperty(name)) { + if ( + undefined === numArguments || + (undefined !== Module[name].overloadTable && + undefined !== Module[name].overloadTable[numArguments]) + ) { + throwBindingError(`Cannot register public name '${name}' twice`); + } + ensureOverloadTable(Module, name, name); + if (Module.hasOwnProperty(numArguments)) { + throwBindingError( + `Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`, + ); + } + Module[name].overloadTable[numArguments] = value; + } else { + Module[name] = value; + if (undefined !== numArguments) { + Module[name].numArguments = numArguments; + } + } + }; + function RegisteredClass( + name, + constructor, + instancePrototype, + rawDestructor, + baseClass, + getActualType, + upcast, + downcast, + ) { + this.name = name; + this.constructor = constructor; + this.instancePrototype = instancePrototype; + this.rawDestructor = rawDestructor; + this.baseClass = baseClass; + this.getActualType = getActualType; + this.upcast = upcast; + this.downcast = downcast; + this.pureVirtualFunctions = []; + } + var upcastPointer = (ptr, ptrClass, desiredClass) => { + while (ptrClass !== desiredClass) { + if (!ptrClass.upcast) { + throwBindingError( + `Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`, + ); + } + ptr = ptrClass.upcast(ptr); + ptrClass = ptrClass.baseClass; + } + return ptr; + }; + function constNoSmartPtrRawPointerToWireType(destructors, handle) { + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + return 0; + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + return ptr; + } + function genericPointerToWireType(destructors, handle) { + var ptr; + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + if (this.isSmartPointer) { + ptr = this.rawConstructor(); + if (destructors !== null) { + destructors.push(this.rawDestructor, ptr); + } + return ptr; + } else { + return 0; + } + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + if (!this.isConst && handle.$$.ptrType.isConst) { + throwBindingError( + `Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + if (this.isSmartPointer) { + if (undefined === handle.$$.smartPtr) { + throwBindingError("Passing raw pointer to smart pointer is illegal"); + } + switch (this.sharingPolicy) { + case 0: + if (handle.$$.smartPtrType === this) { + ptr = handle.$$.smartPtr; + } else { + throwBindingError( + `Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + break; + case 1: + ptr = handle.$$.smartPtr; + break; + case 2: + if (handle.$$.smartPtrType === this) { + ptr = handle.$$.smartPtr; + } else { + var clonedHandle = handle["clone"](); + ptr = this.rawShare( + ptr, + Emval.toHandle(() => clonedHandle["delete"]()), + ); + if (destructors !== null) { + destructors.push(this.rawDestructor, ptr); + } + } + break; + default: + throwBindingError("Unsupporting sharing policy"); + } + } + return ptr; + } + function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) { + if (handle === null) { + if (this.isReference) { + throwBindingError(`null is not a valid ${this.name}`); + } + return 0; + } + if (!handle.$$) { + throwBindingError( + `Cannot pass "${embindRepr(handle)}" as a ${this.name}`, + ); + } + if (!handle.$$.ptr) { + throwBindingError( + `Cannot pass deleted object as a pointer of type ${this.name}`, + ); + } + if (handle.$$.ptrType.isConst) { + throwBindingError( + `Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`, + ); + } + var handleClass = handle.$$.ptrType.registeredClass; + var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass); + return ptr; + } + function readPointer(pointer) { + return this["fromWireType"](GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0]); + } + var init_RegisteredPointer = () => { + Object.assign(RegisteredPointer.prototype, { + getPointee(ptr) { + if (this.rawGetPointee) { + ptr = this.rawGetPointee(ptr); + } + return ptr; + }, + destructor(ptr) { + if (this.rawDestructor) { + this.rawDestructor(ptr); + } + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: readPointer, + deleteObject(handle) { + if (handle !== null) { + handle["delete"](); + } + }, + fromWireType: RegisteredPointer_fromWireType, + }); + }; + function RegisteredPointer( + name, + registeredClass, + isReference, + isConst, + isSmartPointer, + pointeeType, + sharingPolicy, + rawGetPointee, + rawConstructor, + rawShare, + rawDestructor, + ) { + this.name = name; + this.registeredClass = registeredClass; + this.isReference = isReference; + this.isConst = isConst; + this.isSmartPointer = isSmartPointer; + this.pointeeType = pointeeType; + this.sharingPolicy = sharingPolicy; + this.rawGetPointee = rawGetPointee; + this.rawConstructor = rawConstructor; + this.rawShare = rawShare; + this.rawDestructor = rawDestructor; + if (!isSmartPointer && registeredClass.baseClass === undefined) { + if (isConst) { + this["toWireType"] = constNoSmartPtrRawPointerToWireType; + this.destructorFunction = null; + } else { + this["toWireType"] = nonConstNoSmartPtrRawPointerToWireType; + this.destructorFunction = null; + } + } else { + this["toWireType"] = genericPointerToWireType; + } + } + var replacePublicSymbol = (name, value, numArguments) => { + if (!Module.hasOwnProperty(name)) { + throwInternalError("Replacing nonexistant public symbol"); + } + if ( + undefined !== Module[name].overloadTable && + undefined !== numArguments + ) { + Module[name].overloadTable[numArguments] = value; + } else { + Module[name] = value; + Module[name].argCount = numArguments; + } + }; + var dynCallLegacy = (sig, ptr, args) => { + var f = Module["dynCall_" + sig]; + return args && args.length + ? f.apply(null, [ptr].concat(args)) + : f.call(null, ptr); + }; + var wasmTable; + var dynCall = (sig, ptr, args) => { + var rtn = dynCallLegacy(sig, ptr, args); + return rtn; + }; + var getDynCaller = (sig, ptr) => { + var argCache = []; + return function () { + argCache.length = 0; + Object.assign(argCache, arguments); + return dynCall(sig, ptr, argCache); + }; + }; + var embind__requireFunction = (signature, rawFunction) => { + signature = readLatin1String(signature); + function makeDynCaller() { + return getDynCaller(signature, rawFunction); + } + var fp = makeDynCaller(); + if (typeof fp != "function") { + throwBindingError( + `unknown function pointer with signature ${signature}: ${rawFunction}`, + ); + } + return fp; + }; + var extendError = (baseErrorType, errorName) => { + var errorClass = createNamedFunction(errorName, function (message) { + this.name = errorName; + this.message = message; + var stack = new Error(message).stack; + if (stack !== undefined) { + this.stack = + this.toString() + "\n" + stack.replace(/^Error(:[^\n]*)?\n/, ""); + } + }); + errorClass.prototype = Object.create(baseErrorType.prototype); + errorClass.prototype.constructor = errorClass; + errorClass.prototype.toString = function () { + if (this.message === undefined) { + return this.name; + } else { + return `${this.name}: ${this.message}`; + } + }; + return errorClass; + }; + var UnboundTypeError; + var getTypeName = (type) => { + var ptr = ___getTypeName(type); + var rv = readLatin1String(ptr); + _free(ptr); + return rv; + }; + var throwUnboundTypeError = (message, types) => { + var unboundTypes = []; + var seen = {}; + function visit(type) { + if (seen[type]) { + return; + } + if (registeredTypes[type]) { + return; + } + if (typeDependencies[type]) { + typeDependencies[type].forEach(visit); + return; + } + unboundTypes.push(type); + seen[type] = true; + } + types.forEach(visit); + throw new UnboundTypeError( + `${message}: ` + unboundTypes.map(getTypeName).join([", "]), + ); + }; + function __embind_register_class( + rawType, + rawPointerType, + rawConstPointerType, + baseClassRawType, + getActualTypeSignature, + getActualType, + upcastSignature, + upcast, + downcastSignature, + downcast, + name, + destructorSignature, + rawDestructor, + ) { + rawType >>>= 0; + rawPointerType >>>= 0; + rawConstPointerType >>>= 0; + baseClassRawType >>>= 0; + getActualTypeSignature >>>= 0; + getActualType >>>= 0; + upcastSignature >>>= 0; + upcast >>>= 0; + downcastSignature >>>= 0; + downcast >>>= 0; + name >>>= 0; + destructorSignature >>>= 0; + rawDestructor >>>= 0; + name = readLatin1String(name); + getActualType = embind__requireFunction( + getActualTypeSignature, + getActualType, + ); + if (upcast) { + upcast = embind__requireFunction(upcastSignature, upcast); + } + if (downcast) { + downcast = embind__requireFunction(downcastSignature, downcast); + } + rawDestructor = embind__requireFunction( + destructorSignature, + rawDestructor, + ); + var legalFunctionName = makeLegalFunctionName(name); + exposePublicSymbol(legalFunctionName, function () { + throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [ + baseClassRawType, + ]); + }); + whenDependentTypesAreResolved( + [rawType, rawPointerType, rawConstPointerType], + baseClassRawType ? [baseClassRawType] : [], + function (base) { + base = base[0]; + var baseClass; + var basePrototype; + if (baseClassRawType) { + baseClass = base.registeredClass; + basePrototype = baseClass.instancePrototype; + } else { + basePrototype = ClassHandle.prototype; + } + var constructor = createNamedFunction(legalFunctionName, function () { + if (Object.getPrototypeOf(this) !== instancePrototype) { + throw new BindingError("Use 'new' to construct " + name); + } + if (undefined === registeredClass.constructor_body) { + throw new BindingError(name + " has no accessible constructor"); + } + var body = registeredClass.constructor_body[arguments.length]; + if (undefined === body) { + throw new BindingError( + `Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`, + ); + } + return body.apply(this, arguments); + }); + var instancePrototype = Object.create(basePrototype, { + constructor: { value: constructor }, + }); + constructor.prototype = instancePrototype; + var registeredClass = new RegisteredClass( + name, + constructor, + instancePrototype, + rawDestructor, + baseClass, + getActualType, + upcast, + downcast, + ); + if (registeredClass.baseClass) { + if (registeredClass.baseClass.__derivedClasses === undefined) { + registeredClass.baseClass.__derivedClasses = []; + } + registeredClass.baseClass.__derivedClasses.push(registeredClass); + } + var referenceConverter = new RegisteredPointer( + name, + registeredClass, + true, + false, + false, + ); + var pointerConverter = new RegisteredPointer( + name + "*", + registeredClass, + false, + false, + false, + ); + var constPointerConverter = new RegisteredPointer( + name + " const*", + registeredClass, + false, + true, + false, + ); + registeredPointers[rawType] = { + pointerType: pointerConverter, + constPointerType: constPointerConverter, + }; + replacePublicSymbol(legalFunctionName, constructor); + return [referenceConverter, pointerConverter, constPointerConverter]; + }, + ); + } + var runDestructors = (destructors) => { + while (destructors.length) { + var ptr = destructors.pop(); + var del = destructors.pop(); + del(ptr); + } + }; + function newFunc(constructor, argumentList) { + if (!(constructor instanceof Function)) { + throw new TypeError( + `new_ called with constructor type ${typeof constructor} which is not a function`, + ); + } + var dummy = createNamedFunction( + constructor.name || "unknownFunctionName", + function () {}, + ); + dummy.prototype = constructor.prototype; + var obj = new dummy(); + var r = constructor.apply(obj, argumentList); + return r instanceof Object ? r : obj; + } + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + if (ENVIRONMENT_IS_PTHREAD) __emscripten_thread_exit(EXITSTATUS); + else _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (var x in imports) { + (function (x) { + var original = imports[x]; + var sig = original.sig; + if (typeof original == "function") { + var isAsyncifyImport = original.isAsync || importPattern.test(x); + } + })(x); + } + }, + instrumentWasmExports(exports) { + var ret = {}; + for (var x in exports) { + (function (x) { + var original = exports[x]; + if (typeof original == "function") { + ret[x] = function () { + Asyncify.exportCallStack.push(x); + try { + return original.apply(null, arguments); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + })(x); + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runtimeKeepalivePush(); + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve: resolve, reject: reject }; + }); + }, + allocateData() { + var ptr = _malloc(12 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + GROWABLE_HEAP_U32()[(ptr >>> 2) >>> 0] = stack; + GROWABLE_HEAP_U32()[((ptr + 4) >>> 2) >>> 0] = stack + stackSize; + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + GROWABLE_HEAP_I32()[((ptr + 8) >>> 2) >>> 0] = rewindId; + }, + getDataRewindFunc(ptr) { + var id = GROWABLE_HEAP_I32()[((ptr + 8) >>> 2) >>> 0]; + var name = Asyncify.callStackIdToName[id]; + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var start = Asyncify.getDataRewindFunc(ptr); + runtimeKeepalivePop(); + return start(); + }, + handleSleep(startAsync) { + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach((func) => callUserCallback(func)); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + function craftInvokerFunction( + humanName, + argTypes, + classType, + cppInvokerFunc, + cppTargetFunc, + isAsync, + ) { + var argCount = argTypes.length; + if (argCount < 2) { + throwBindingError( + "argTypes array size mismatch! Must at least get return value and 'this' types!", + ); + } + var isClassMethodFunc = argTypes[1] !== null && classType !== null; + var needsDestructorStack = false; + for (var i = 1; i < argTypes.length; ++i) { + if ( + argTypes[i] !== null && + argTypes[i].destructorFunction === undefined + ) { + needsDestructorStack = true; + break; + } + } + var returns = argTypes[0].name !== "void"; + var argsList = ""; + var argsListWired = ""; + for (var i = 0; i < argCount - 2; ++i) { + argsList += (i !== 0 ? ", " : "") + "arg" + i; + argsListWired += (i !== 0 ? ", " : "") + "arg" + i + "Wired"; + } + var invokerFnBody = `\n return function ${makeLegalFunctionName(humanName)}(${argsList}) {\n if (arguments.length !== ${argCount - 2}) {\n throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');\n }`; + if (needsDestructorStack) { + invokerFnBody += "var destructors = [];\n"; + } + var dtorStack = needsDestructorStack ? "destructors" : "null"; + var args1 = [ + "throwBindingError", + "invoker", + "fn", + "runDestructors", + "retType", + "classParam", + ]; + var args2 = [ + throwBindingError, + cppInvokerFunc, + cppTargetFunc, + runDestructors, + argTypes[0], + argTypes[1], + ]; + if (isClassMethodFunc) { + invokerFnBody += + "var thisWired = classParam.toWireType(" + dtorStack + ", this);\n"; + } + for (var i = 0; i < argCount - 2; ++i) { + invokerFnBody += + "var arg" + + i + + "Wired = argType" + + i + + ".toWireType(" + + dtorStack + + ", arg" + + i + + "); // " + + argTypes[i + 2].name + + "\n"; + args1.push("argType" + i); + args2.push(argTypes[i + 2]); + } + if (isClassMethodFunc) { + argsListWired = + "thisWired" + (argsListWired.length > 0 ? ", " : "") + argsListWired; + } + invokerFnBody += + (returns || isAsync ? "var rv = " : "") + + "invoker(fn" + + (argsListWired.length > 0 ? ", " : "") + + argsListWired + + ");\n"; + args1.push("Asyncify"); + args2.push(Asyncify); + invokerFnBody += "function onDone(" + (returns ? "rv" : "") + ") {\n"; + if (needsDestructorStack) { + invokerFnBody += "runDestructors(destructors);\n"; + } else { + for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) { + var paramName = i === 1 ? "thisWired" : "arg" + (i - 2) + "Wired"; + if (argTypes[i].destructorFunction !== null) { + invokerFnBody += + paramName + + "_dtor(" + + paramName + + "); // " + + argTypes[i].name + + "\n"; + args1.push(paramName + "_dtor"); + args2.push(argTypes[i].destructorFunction); + } + } + } + if (returns) { + invokerFnBody += + "var ret = retType.fromWireType(rv);\n" + "return ret;\n"; + } else { + } + invokerFnBody += "}\n"; + invokerFnBody += + "return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(" + + (returns ? "rv" : "") + + ");\n"; + invokerFnBody += "}\n"; + args1.push(invokerFnBody); + return newFunc(Function, args1).apply(null, args2); + } + var heap32VectorToArray = (count, firstElement) => { + var array = []; + for (var i = 0; i < count; i++) { + array.push(GROWABLE_HEAP_U32()[((firstElement + i * 4) >>> 2) >>> 0]); + } + return array; + }; + var getFunctionName = (signature) => { + signature = signature.trim(); + const argsIndex = signature.indexOf("("); + if (argsIndex !== -1) { + assert( + signature[signature.length - 1] == ")", + "Parentheses for argument names should match.", + ); + return signature.substr(0, argsIndex); + } else { + return signature; + } + }; + function __embind_register_class_class_function( + rawClassType, + methodName, + argCount, + rawArgTypesAddr, + invokerSignature, + rawInvoker, + fn, + isAsync, + ) { + rawClassType >>>= 0; + methodName >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + rawInvoker >>>= 0; + fn >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + methodName = readLatin1String(methodName); + methodName = getFunctionName(methodName); + rawInvoker = embind__requireFunction(invokerSignature, rawInvoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${methodName}`; + function unboundTypesHandler() { + throwUnboundTypeError( + `Cannot call ${humanName} due to unbound types`, + rawArgTypes, + ); + } + if (methodName.startsWith("@@")) { + methodName = Symbol[methodName.substring(2)]; + } + var proto = classType.registeredClass.constructor; + if (undefined === proto[methodName]) { + unboundTypesHandler.argCount = argCount - 1; + proto[methodName] = unboundTypesHandler; + } else { + ensureOverloadTable(proto, methodName, humanName); + proto[methodName].overloadTable[argCount - 1] = unboundTypesHandler; + } + whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) { + var invokerArgsArray = [argTypes[0], null].concat(argTypes.slice(1)); + var func = craftInvokerFunction( + humanName, + invokerArgsArray, + null, + rawInvoker, + fn, + isAsync, + ); + if (undefined === proto[methodName].overloadTable) { + func.argCount = argCount - 1; + proto[methodName] = func; + } else { + proto[methodName].overloadTable[argCount - 1] = func; + } + if (classType.registeredClass.__derivedClasses) { + for (const derivedClass of classType.registeredClass + .__derivedClasses) { + if (!derivedClass.constructor.hasOwnProperty(methodName)) { + derivedClass.constructor[methodName] = func; + } + } + } + return []; + }); + return []; + }); + } + var validateThis = (this_, classType, humanName) => { + if (!(this_ instanceof Object)) { + throwBindingError(`${humanName} with invalid "this": ${this_}`); + } + if (!(this_ instanceof classType.registeredClass.constructor)) { + throwBindingError( + `${humanName} incompatible with "this" of type ${this_.constructor.name}`, + ); + } + if (!this_.$$.ptr) { + throwBindingError( + `cannot call emscripten binding method ${humanName} on deleted object`, + ); + } + return upcastPointer( + this_.$$.ptr, + this_.$$.ptrType.registeredClass, + classType.registeredClass, + ); + }; + function __embind_register_class_class_property( + rawClassType, + fieldName, + rawFieldType, + rawFieldPtr, + getterSignature, + getter, + setterSignature, + setter, + ) { + rawClassType >>>= 0; + fieldName >>>= 0; + rawFieldType >>>= 0; + rawFieldPtr >>>= 0; + getterSignature >>>= 0; + getter >>>= 0; + setterSignature >>>= 0; + setter >>>= 0; + fieldName = readLatin1String(fieldName); + getter = embind__requireFunction(getterSignature, getter); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${fieldName}`; + var desc = { + get() { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [rawFieldType], + ); + }, + enumerable: true, + configurable: true, + }; + if (setter) { + desc.set = () => { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [rawFieldType], + ); + }; + } else { + desc.set = (v) => { + throwBindingError(`${humanName} is a read-only property`); + }; + } + Object.defineProperty( + classType.registeredClass.constructor, + fieldName, + desc, + ); + whenDependentTypesAreResolved([], [rawFieldType], function (fieldType) { + fieldType = fieldType[0]; + var desc = { + get() { + return fieldType["fromWireType"](getter(rawFieldPtr)); + }, + enumerable: true, + }; + if (setter) { + setter = embind__requireFunction(setterSignature, setter); + desc.set = (v) => { + var destructors = []; + setter(rawFieldPtr, fieldType["toWireType"](destructors, v)); + runDestructors(destructors); + }; + } + Object.defineProperty( + classType.registeredClass.constructor, + fieldName, + desc, + ); + return []; + }); + return []; + }); + } + function __embind_register_class_constructor( + rawClassType, + argCount, + rawArgTypesAddr, + invokerSignature, + invoker, + rawConstructor, + ) { + rawClassType >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + invoker >>>= 0; + rawConstructor >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + invoker = embind__requireFunction(invokerSignature, invoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `constructor ${classType.name}`; + if (undefined === classType.registeredClass.constructor_body) { + classType.registeredClass.constructor_body = []; + } + if ( + undefined !== classType.registeredClass.constructor_body[argCount - 1] + ) { + throw new BindingError( + `Cannot register multiple constructors with identical number of parameters (${argCount - 1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`, + ); + } + classType.registeredClass.constructor_body[argCount - 1] = () => { + throwUnboundTypeError( + `Cannot construct ${classType.name} due to unbound types`, + rawArgTypes, + ); + }; + whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => { + argTypes.splice(1, 0, null); + classType.registeredClass.constructor_body[argCount - 1] = + craftInvokerFunction( + humanName, + argTypes, + null, + invoker, + rawConstructor, + ); + return []; + }); + return []; + }); + } + function __embind_register_class_function( + rawClassType, + methodName, + argCount, + rawArgTypesAddr, + invokerSignature, + rawInvoker, + context, + isPureVirtual, + isAsync, + ) { + rawClassType >>>= 0; + methodName >>>= 0; + rawArgTypesAddr >>>= 0; + invokerSignature >>>= 0; + rawInvoker >>>= 0; + context >>>= 0; + var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + methodName = readLatin1String(methodName); + methodName = getFunctionName(methodName); + rawInvoker = embind__requireFunction(invokerSignature, rawInvoker); + whenDependentTypesAreResolved([], [rawClassType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${methodName}`; + if (methodName.startsWith("@@")) { + methodName = Symbol[methodName.substring(2)]; + } + if (isPureVirtual) { + classType.registeredClass.pureVirtualFunctions.push(methodName); + } + function unboundTypesHandler() { + throwUnboundTypeError( + `Cannot call ${humanName} due to unbound types`, + rawArgTypes, + ); + } + var proto = classType.registeredClass.instancePrototype; + var method = proto[methodName]; + if ( + undefined === method || + (undefined === method.overloadTable && + method.className !== classType.name && + method.argCount === argCount - 2) + ) { + unboundTypesHandler.argCount = argCount - 2; + unboundTypesHandler.className = classType.name; + proto[methodName] = unboundTypesHandler; + } else { + ensureOverloadTable(proto, methodName, humanName); + proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler; + } + whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) { + var memberFunction = craftInvokerFunction( + humanName, + argTypes, + classType, + rawInvoker, + context, + isAsync, + ); + if (undefined === proto[methodName].overloadTable) { + memberFunction.argCount = argCount - 2; + proto[methodName] = memberFunction; + } else { + proto[methodName].overloadTable[argCount - 2] = memberFunction; + } + return []; + }); + return []; + }); + } + function __embind_register_class_property( + classType, + fieldName, + getterReturnType, + getterSignature, + getter, + getterContext, + setterArgumentType, + setterSignature, + setter, + setterContext, + ) { + classType >>>= 0; + fieldName >>>= 0; + getterReturnType >>>= 0; + getterSignature >>>= 0; + getter >>>= 0; + getterContext >>>= 0; + setterArgumentType >>>= 0; + setterSignature >>>= 0; + setter >>>= 0; + setterContext >>>= 0; + fieldName = readLatin1String(fieldName); + getter = embind__requireFunction(getterSignature, getter); + whenDependentTypesAreResolved([], [classType], function (classType) { + classType = classType[0]; + var humanName = `${classType.name}.${fieldName}`; + var desc = { + get() { + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [getterReturnType, setterArgumentType], + ); + }, + enumerable: true, + configurable: true, + }; + if (setter) { + desc.set = () => + throwUnboundTypeError( + `Cannot access ${humanName} due to unbound types`, + [getterReturnType, setterArgumentType], + ); + } else { + desc.set = (v) => + throwBindingError(humanName + " is a read-only property"); + } + Object.defineProperty( + classType.registeredClass.instancePrototype, + fieldName, + desc, + ); + whenDependentTypesAreResolved( + [], + setter ? [getterReturnType, setterArgumentType] : [getterReturnType], + function (types) { + var getterReturnType = types[0]; + var desc = { + get() { + var ptr = validateThis(this, classType, humanName + " getter"); + return getterReturnType["fromWireType"]( + getter(getterContext, ptr), + ); + }, + enumerable: true, + }; + if (setter) { + setter = embind__requireFunction(setterSignature, setter); + var setterArgumentType = types[1]; + desc.set = function (v) { + var ptr = validateThis(this, classType, humanName + " setter"); + var destructors = []; + setter( + setterContext, + ptr, + setterArgumentType["toWireType"](destructors, v), + ); + runDestructors(destructors); + }; + } + Object.defineProperty( + classType.registeredClass.instancePrototype, + fieldName, + desc, + ); + return []; + }, + ); + return []; + }); + } + function handleAllocatorInit() { + Object.assign(HandleAllocator.prototype, { + get(id) { + return this.allocated[id]; + }, + has(id) { + return this.allocated[id] !== undefined; + }, + allocate(handle) { + var id = this.freelist.pop() || this.allocated.length; + this.allocated[id] = handle; + return id; + }, + free(id) { + this.allocated[id] = undefined; + this.freelist.push(id); + }, + }); + } + function HandleAllocator() { + this.allocated = [undefined]; + this.freelist = []; + } + var emval_handles = new HandleAllocator(); + function __emval_decref(handle) { + handle >>>= 0; + if ( + handle >= emval_handles.reserved && + 0 === --emval_handles.get(handle).refcount + ) { + emval_handles.free(handle); + } + } + var count_emval_handles = () => { + var count = 0; + for ( + var i = emval_handles.reserved; + i < emval_handles.allocated.length; + ++i + ) { + if (emval_handles.allocated[i] !== undefined) { + ++count; + } + } + return count; + }; + var init_emval = () => { + emval_handles.allocated.push( + { value: undefined }, + { value: null }, + { value: true }, + { value: false }, + ); + emval_handles.reserved = emval_handles.allocated.length; + Module["count_emval_handles"] = count_emval_handles; + }; + var Emval = { + toValue: (handle) => { + if (!handle) { + throwBindingError("Cannot use deleted val. handle = " + handle); + } + return emval_handles.get(handle).value; + }, + toHandle: (value) => { + switch (value) { + case undefined: + return 1; + case null: + return 2; + case true: + return 3; + case false: + return 4; + default: { + return emval_handles.allocate({ refcount: 1, value: value }); + } + } + }, + }; + function simpleReadValueFromPointer(pointer) { + return this["fromWireType"](GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0]); + } + var __embind_register_emval = function (rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: (handle) => { + var rv = Emval.toValue(handle); + __emval_decref(handle); + return rv; + }, + toWireType: (destructors, value) => Emval.toHandle(value), + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: simpleReadValueFromPointer, + destructorFunction: null, + }); + }; + var enumReadValueFromPointer = (name, width, signed) => { + switch (width) { + case 1: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I8()[(pointer >>> 0) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U8()[(pointer >>> 0) >>> 0], + ); + }; + case 2: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I16()[(pointer >>> 1) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U16()[(pointer >>> 1) >>> 0], + ); + }; + case 4: + return signed + ? function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0], + ); + } + : function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0], + ); + }; + default: + throw new TypeError(`invalid integer width (${width}): ${name}`); + } + }; + function __embind_register_enum(rawType, name, size, isSigned) { + rawType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + function ctor() {} + ctor.values = {}; + registerType(rawType, { + name: name, + constructor: ctor, + fromWireType: function (c) { + return this.constructor.values[c]; + }, + toWireType: (destructors, c) => c.value, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: enumReadValueFromPointer(name, size, isSigned), + destructorFunction: null, + }); + exposePublicSymbol(name, ctor); + } + var requireRegisteredType = (rawType, humanName) => { + var impl = registeredTypes[rawType]; + if (undefined === impl) { + throwBindingError( + humanName + " has unknown type " + getTypeName(rawType), + ); + } + return impl; + }; + function __embind_register_enum_value(rawEnumType, name, enumValue) { + rawEnumType >>>= 0; + name >>>= 0; + enumValue >>>= 0; + var enumType = requireRegisteredType(rawEnumType, "enum"); + name = readLatin1String(name); + var Enum = enumType.constructor; + var Value = Object.create(enumType.constructor.prototype, { + value: { value: enumValue }, + constructor: { + value: createNamedFunction( + `${enumType.name}_${name}`, + function () {}, + ), + }, + }); + Enum.values[enumValue] = Value; + Enum[name] = Value; + } + var embindRepr = (v) => { + if (v === null) { + return "null"; + } + var t = typeof v; + if (t === "object" || t === "array" || t === "function") { + return v.toString(); + } else { + return "" + v; + } + }; + var floatReadValueFromPointer = (name, width) => { + switch (width) { + case 4: + return function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_F32()[(pointer >>> 2) >>> 0], + ); + }; + case 8: + return function (pointer) { + return this["fromWireType"]( + GROWABLE_HEAP_F64()[(pointer >>> 3) >>> 0], + ); + }; + default: + throw new TypeError(`invalid float width (${width}): ${name}`); + } + }; + var __embind_register_float = function (rawType, name, size) { + rawType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + name: name, + fromWireType: (value) => value, + toWireType: (destructors, value) => value, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: floatReadValueFromPointer(name, size), + destructorFunction: null, + }); + }; + function __embind_register_function( + name, + argCount, + rawArgTypesAddr, + signature, + rawInvoker, + fn, + isAsync, + ) { + name >>>= 0; + rawArgTypesAddr >>>= 0; + signature >>>= 0; + rawInvoker >>>= 0; + fn >>>= 0; + var argTypes = heap32VectorToArray(argCount, rawArgTypesAddr); + name = readLatin1String(name); + name = getFunctionName(name); + rawInvoker = embind__requireFunction(signature, rawInvoker); + exposePublicSymbol( + name, + function () { + throwUnboundTypeError( + `Cannot call ${name} due to unbound types`, + argTypes, + ); + }, + argCount - 1, + ); + whenDependentTypesAreResolved([], argTypes, function (argTypes) { + var invokerArgsArray = [argTypes[0], null].concat(argTypes.slice(1)); + replacePublicSymbol( + name, + craftInvokerFunction( + name, + invokerArgsArray, + null, + rawInvoker, + fn, + isAsync, + ), + argCount - 1, + ); + return []; + }); + } + var integerReadValueFromPointer = (name, width, signed) => { + switch (width) { + case 1: + return signed + ? (pointer) => GROWABLE_HEAP_I8()[(pointer >>> 0) >>> 0] + : (pointer) => GROWABLE_HEAP_U8()[(pointer >>> 0) >>> 0]; + case 2: + return signed + ? (pointer) => GROWABLE_HEAP_I16()[(pointer >>> 1) >>> 0] + : (pointer) => GROWABLE_HEAP_U16()[(pointer >>> 1) >>> 0]; + case 4: + return signed + ? (pointer) => GROWABLE_HEAP_I32()[(pointer >>> 2) >>> 0] + : (pointer) => GROWABLE_HEAP_U32()[(pointer >>> 2) >>> 0]; + default: + throw new TypeError(`invalid integer width (${width}): ${name}`); + } + }; + function __embind_register_integer( + primitiveType, + name, + size, + minRange, + maxRange, + ) { + primitiveType >>>= 0; + name >>>= 0; + size >>>= 0; + name = readLatin1String(name); + if (maxRange === -1) { + maxRange = 4294967295; + } + var fromWireType = (value) => value; + if (minRange === 0) { + var bitshift = 32 - 8 * size; + fromWireType = (value) => (value << bitshift) >>> bitshift; + } + var isUnsignedType = name.includes("unsigned"); + var checkAssertions = (value, toTypeName) => {}; + var toWireType; + if (isUnsignedType) { + toWireType = function (destructors, value) { + checkAssertions(value, this.name); + return value >>> 0; + }; + } else { + toWireType = function (destructors, value) { + checkAssertions(value, this.name); + return value; + }; + } + registerType(primitiveType, { + name: name, + fromWireType: fromWireType, + toWireType: toWireType, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: integerReadValueFromPointer( + name, + size, + minRange !== 0, + ), + destructorFunction: null, + }); + } + function __embind_register_memory_view(rawType, dataTypeIndex, name) { + rawType >>>= 0; + name >>>= 0; + var typeMapping = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + ]; + var TA = typeMapping[dataTypeIndex]; + function decodeMemoryView(handle) { + var size = GROWABLE_HEAP_U32()[(handle >>> 2) >>> 0]; + var data = GROWABLE_HEAP_U32()[((handle + 4) >>> 2) >>> 0]; + return new TA(GROWABLE_HEAP_I8().buffer, data, size); + } + name = readLatin1String(name); + registerType( + rawType, + { + name: name, + fromWireType: decodeMemoryView, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: decodeMemoryView, + }, + { ignoreDuplicateRegistrations: true }, + ); + } + function __embind_register_smart_ptr( + rawType, + rawPointeeType, + name, + sharingPolicy, + getPointeeSignature, + rawGetPointee, + constructorSignature, + rawConstructor, + shareSignature, + rawShare, + destructorSignature, + rawDestructor, + ) { + rawType >>>= 0; + rawPointeeType >>>= 0; + name >>>= 0; + getPointeeSignature >>>= 0; + rawGetPointee >>>= 0; + constructorSignature >>>= 0; + rawConstructor >>>= 0; + shareSignature >>>= 0; + rawShare >>>= 0; + destructorSignature >>>= 0; + rawDestructor >>>= 0; + name = readLatin1String(name); + rawGetPointee = embind__requireFunction( + getPointeeSignature, + rawGetPointee, + ); + rawConstructor = embind__requireFunction( + constructorSignature, + rawConstructor, + ); + rawShare = embind__requireFunction(shareSignature, rawShare); + rawDestructor = embind__requireFunction( + destructorSignature, + rawDestructor, + ); + whenDependentTypesAreResolved( + [rawType], + [rawPointeeType], + function (pointeeType) { + pointeeType = pointeeType[0]; + var registeredPointer = new RegisteredPointer( + name, + pointeeType.registeredClass, + false, + false, + true, + pointeeType, + sharingPolicy, + rawGetPointee, + rawConstructor, + rawShare, + rawDestructor, + ); + return [registeredPointer]; + }, + ); + } + function __embind_register_std_string(rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + var stdStringIsUTF8 = name === "std::string"; + registerType(rawType, { + name: name, + fromWireType(value) { + var length = GROWABLE_HEAP_U32()[(value >>> 2) >>> 0]; + var payload = value + 4; + var str; + if (stdStringIsUTF8) { + var decodeStartPtr = payload; + for (var i = 0; i <= length; ++i) { + var currentBytePtr = payload + i; + if ( + i == length || + GROWABLE_HEAP_U8()[currentBytePtr >>> 0] == 0 + ) { + var maxRead = currentBytePtr - decodeStartPtr; + var stringSegment = UTF8ToString(decodeStartPtr, maxRead); + if (str === undefined) { + str = stringSegment; + } else { + str += String.fromCharCode(0); + str += stringSegment; + } + decodeStartPtr = currentBytePtr + 1; + } + } + } else { + var a = new Array(length); + for (var i = 0; i < length; ++i) { + a[i] = String.fromCharCode( + GROWABLE_HEAP_U8()[(payload + i) >>> 0], + ); + } + str = a.join(""); + } + _free(value); + return str; + }, + toWireType(destructors, value) { + if (value instanceof ArrayBuffer) { + value = new Uint8Array(value); + } + var length; + var valueIsOfTypeString = typeof value == "string"; + if ( + !( + valueIsOfTypeString || + value instanceof Uint8Array || + value instanceof Uint8ClampedArray || + value instanceof Int8Array + ) + ) { + throwBindingError("Cannot pass non-string to std::string"); + } + if (stdStringIsUTF8 && valueIsOfTypeString) { + length = lengthBytesUTF8(value); + } else { + length = value.length; + } + var base = _malloc(4 + length + 1); + var ptr = base + 4; + GROWABLE_HEAP_U32()[(base >>> 2) >>> 0] = length; + if (stdStringIsUTF8 && valueIsOfTypeString) { + stringToUTF8(value, ptr, length + 1); + } else { + if (valueIsOfTypeString) { + for (var i = 0; i < length; ++i) { + var charCode = value.charCodeAt(i); + if (charCode > 255) { + _free(ptr); + throwBindingError( + "String has UTF-16 code units that do not fit in 8 bits", + ); + } + GROWABLE_HEAP_U8()[(ptr + i) >>> 0] = charCode; + } + } else { + for (var i = 0; i < length; ++i) { + GROWABLE_HEAP_U8()[(ptr + i) >>> 0] = value[i]; + } + } + } + if (destructors !== null) { + destructors.push(_free, base); + } + return base; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: readPointer, + destructorFunction(ptr) { + _free(ptr); + }, + }); + } + var UTF16Decoder = + typeof TextDecoder != "undefined" + ? new TextDecoder("utf-16le") + : undefined; + var UTF16ToString = (ptr, maxBytesToRead) => { + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && GROWABLE_HEAP_U16()[idx >>> 0]) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) + return UTF16Decoder.decode(GROWABLE_HEAP_U8().slice(ptr, endPtr)); + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = GROWABLE_HEAP_I16()[((ptr + i * 2) >>> 1) >>> 0]; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + }; + var stringToUTF16 = (str, outPtr, maxBytesToWrite) => { + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = + maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + GROWABLE_HEAP_I16()[(outPtr >>> 1) >>> 0] = codeUnit; + outPtr += 2; + } + GROWABLE_HEAP_I16()[(outPtr >>> 1) >>> 0] = 0; + return outPtr - startPtr; + }; + var lengthBytesUTF16 = (str) => str.length * 2; + var UTF32ToString = (ptr, maxBytesToRead) => { + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = GROWABLE_HEAP_I32()[((ptr + i * 4) >>> 2) >>> 0]; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } else { + str += String.fromCharCode(utf32); + } + } + return str; + }; + var stringToUTF32 = (str, outPtr, maxBytesToWrite) => { + outPtr >>>= 0; + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = + (65536 + ((codeUnit & 1023) << 10)) | (trailSurrogate & 1023); + } + GROWABLE_HEAP_I32()[(outPtr >>> 2) >>> 0] = codeUnit; + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + GROWABLE_HEAP_I32()[(outPtr >>> 2) >>> 0] = 0; + return outPtr - startPtr; + }; + var lengthBytesUTF32 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; + }; + var __embind_register_std_wstring = function (rawType, charSize, name) { + rawType >>>= 0; + charSize >>>= 0; + name >>>= 0; + name = readLatin1String(name); + var decodeString, encodeString, getHeap, lengthBytesUTF, shift; + if (charSize === 2) { + decodeString = UTF16ToString; + encodeString = stringToUTF16; + lengthBytesUTF = lengthBytesUTF16; + getHeap = () => GROWABLE_HEAP_U16(); + shift = 1; + } else if (charSize === 4) { + decodeString = UTF32ToString; + encodeString = stringToUTF32; + lengthBytesUTF = lengthBytesUTF32; + getHeap = () => GROWABLE_HEAP_U32(); + shift = 2; + } + registerType(rawType, { + name: name, + fromWireType: (value) => { + var length = GROWABLE_HEAP_U32()[(value >>> 2) >>> 0]; + var HEAP = getHeap(); + var str; + var decodeStartPtr = value + 4; + for (var i = 0; i <= length; ++i) { + var currentBytePtr = value + 4 + i * charSize; + if (i == length || HEAP[currentBytePtr >>> shift] == 0) { + var maxReadBytes = currentBytePtr - decodeStartPtr; + var stringSegment = decodeString(decodeStartPtr, maxReadBytes); + if (str === undefined) { + str = stringSegment; + } else { + str += String.fromCharCode(0); + str += stringSegment; + } + decodeStartPtr = currentBytePtr + charSize; + } + } + _free(value); + return str; + }, + toWireType: (destructors, value) => { + if (!(typeof value == "string")) { + throwBindingError( + `Cannot pass non-string to C++ string type ${name}`, + ); + } + var length = lengthBytesUTF(value); + var ptr = _malloc(4 + length + charSize); + GROWABLE_HEAP_U32()[ptr >>> 2] = length >> shift; + encodeString(value, ptr + 4, length + charSize); + if (destructors !== null) { + destructors.push(_free, ptr); + } + return ptr; + }, + argPackAdvance: GenericWireTypeSize, + readValueFromPointer: simpleReadValueFromPointer, + destructorFunction(ptr) { + _free(ptr); + }, + }); + }; + var __embind_register_void = function (rawType, name) { + rawType >>>= 0; + name >>>= 0; + name = readLatin1String(name); + registerType(rawType, { + isVoid: true, + name: name, + argPackAdvance: 0, + fromWireType: () => undefined, + toWireType: (destructors, o) => undefined, + }); + }; + var nowIsMonotonic = true; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + function __emscripten_thread_mailbox_await(pthread_ptr) { + pthread_ptr >>>= 0; + if (typeof Atomics.waitAsync === "function") { + var wait = Atomics.waitAsync( + GROWABLE_HEAP_I32(), + pthread_ptr >>> 2, + pthread_ptr, + ); + wait.value.then(checkMailbox); + var waitingAsync = pthread_ptr + 128; + Atomics.store(GROWABLE_HEAP_I32(), waitingAsync >>> 2, 1); + } + } + Module["__emscripten_thread_mailbox_await"] = + __emscripten_thread_mailbox_await; + var checkMailbox = () => { + var pthread_ptr = _pthread_self(); + if (pthread_ptr) { + __emscripten_thread_mailbox_await(pthread_ptr); + callUserCallback(() => __emscripten_check_mailbox()); + } + }; + Module["checkMailbox"] = checkMailbox; + var __emscripten_notify_mailbox_postmessage = function ( + targetThreadId, + currThreadId, + mainThreadId, + ) { + targetThreadId >>>= 0; + currThreadId >>>= 0; + mainThreadId >>>= 0; + if (targetThreadId == currThreadId) { + setTimeout(() => checkMailbox()); + } else if (ENVIRONMENT_IS_PTHREAD) { + postMessage({ targetThread: targetThreadId, cmd: "checkMailbox" }); + } else { + var worker = PThread.pthreads[targetThreadId]; + if (!worker) { + return; + } + worker.postMessage({ cmd: "checkMailbox" }); + } + }; + var withStackSave = (f) => { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; + }; + var proxyToMainThread = function (index, sync) { + var numCallArgs = arguments.length - 2; + var outerArgs = arguments; + return withStackSave(() => { + var serializedNumCallArgs = numCallArgs; + var args = stackAlloc(serializedNumCallArgs * 8); + var b = args >>> 3; + for (var i = 0; i < numCallArgs; i++) { + var arg = outerArgs[2 + i]; + GROWABLE_HEAP_F64()[(b + i) >>> 0] = arg; + } + return __emscripten_run_on_main_thread_js( + index, + serializedNumCallArgs, + args, + sync, + ); + }); + }; + var proxiedJSCallArgs = []; + function __emscripten_receive_on_main_thread_js( + index, + callingThread, + numCallArgs, + args, + ) { + callingThread >>>= 0; + args >>>= 0; + proxiedJSCallArgs.length = numCallArgs; + var b = args >>> 3; + for (var i = 0; i < numCallArgs; i++) { + proxiedJSCallArgs[i] = GROWABLE_HEAP_F64()[(b + i) >>> 0]; + } + var func = proxiedFunctionTable[index]; + PThread.currentProxiedOperationCallerThread = callingThread; + var rtn = func.apply(null, proxiedJSCallArgs); + PThread.currentProxiedOperationCallerThread = 0; + return rtn; + } + function __emscripten_runtime_keepalive_clear() { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(20, 1); + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + } + function __emscripten_thread_set_strongref(thread) { + thread >>>= 0; + if (ENVIRONMENT_IS_NODE) { + PThread.pthreads[thread].ref(); + } + } + function __emval_as(handle, returnType, destructorsRef) { + handle >>>= 0; + returnType >>>= 0; + destructorsRef >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + var destructors = []; + var rd = Emval.toHandle(destructors); + GROWABLE_HEAP_U32()[(destructorsRef >>> 2) >>> 0] = rd; + return returnType["toWireType"](destructors, handle); + } + function __emval_as_int64(handle, returnType) { + handle >>>= 0; + returnType >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + return returnType["toWireType"](null, handle); + } + function __emval_as_uint64(handle, returnType) { + handle >>>= 0; + returnType >>>= 0; + handle = Emval.toValue(handle); + returnType = requireRegisteredType(returnType, "emval::as"); + return returnType["toWireType"](null, handle); + } + var emval_lookupTypes = (argCount, argTypes) => { + var a = new Array(argCount); + for (var i = 0; i < argCount; ++i) { + a[i] = requireRegisteredType( + GROWABLE_HEAP_U32()[((argTypes + i * 4) >>> 2) >>> 0], + "parameter " + i, + ); + } + return a; + }; + function __emval_call(handle, argCount, argTypes, argv) { + handle >>>= 0; + argTypes >>>= 0; + argv >>>= 0; + handle = Emval.toValue(handle); + var types = emval_lookupTypes(argCount, argTypes); + var args = new Array(argCount); + for (var i = 0; i < argCount; ++i) { + var type = types[i]; + args[i] = type["readValueFromPointer"](argv); + argv += type["argPackAdvance"]; + } + var rv = handle.apply(undefined, args); + return Emval.toHandle(rv); + } + var emval_symbols = {}; + var getStringOrSymbol = (address) => { + var symbol = emval_symbols[address]; + if (symbol === undefined) { + return readLatin1String(address); + } + return symbol; + }; + var emval_methodCallers = []; + function __emval_call_method( + caller, + handle, + methodName, + destructorsRef, + args, + ) { + caller >>>= 0; + handle >>>= 0; + methodName >>>= 0; + destructorsRef >>>= 0; + args >>>= 0; + caller = emval_methodCallers[caller]; + handle = Emval.toValue(handle); + methodName = getStringOrSymbol(methodName); + var destructors = []; + var result = caller(handle, methodName, destructors, args); + if (destructors.length) { + GROWABLE_HEAP_U32()[(destructorsRef >>> 2) >>> 0] = + Emval.toHandle(destructors); + } + return result; + } + function __emval_equals(first, second) { + first >>>= 0; + second >>>= 0; + first = Emval.toValue(first); + second = Emval.toValue(second); + return first == second; + } + var emval_get_global = () => { + if (typeof globalThis == "object") { + return globalThis; + } + return (function () { + return Function; + })()("return this")(); + }; + function __emval_get_global(name) { + name >>>= 0; + if (name === 0) { + return Emval.toHandle(emval_get_global()); + } else { + name = getStringOrSymbol(name); + return Emval.toHandle(emval_get_global()[name]); + } + } + var emval_addMethodCaller = (caller) => { + var id = emval_methodCallers.length; + emval_methodCallers.push(caller); + return id; + }; + function __emval_get_method_caller(argCount, argTypes) { + argTypes >>>= 0; + var types = emval_lookupTypes(argCount, argTypes); + var retType = types.shift(); + argCount--; + var params = ["retType"]; + var args = [retType]; + var argsList = ""; + for (var i = 0; i < argCount; ++i) { + argsList += (i !== 0 ? ", " : "") + "arg" + i; + params.push("argType" + i); + args.push(types[i]); + } + var signatureName = + retType.name + "_$" + types.map((t) => t.name).join("_") + "$"; + var functionName = makeLegalFunctionName("methodCaller_" + signatureName); + var functionBody = + "return function " + + functionName + + "(handle, name, destructors, args) {\n"; + var offset = 0; + for (var i = 0; i < argCount; ++i) { + functionBody += + " var arg" + + i + + " = argType" + + i + + ".readValueFromPointer(args" + + (offset ? "+" + offset : "") + + ");\n"; + offset += types[i]["argPackAdvance"]; + } + functionBody += " var rv = handle[name](" + argsList + ");\n"; + for (var i = 0; i < argCount; ++i) { + if (types[i]["deleteObject"]) { + functionBody += " argType" + i + ".deleteObject(arg" + i + ");\n"; + } + } + if (!retType.isVoid) { + functionBody += " return retType.toWireType(destructors, rv);\n"; + } + functionBody += "};\n"; + params.push(functionBody); + var invokerFunction = newFunc(Function, params).apply(null, args); + return emval_addMethodCaller(invokerFunction); + } + function __emval_get_property(handle, key) { + handle >>>= 0; + key >>>= 0; + handle = Emval.toValue(handle); + key = Emval.toValue(key); + return Emval.toHandle(handle[key]); + } + function __emval_incref(handle) { + handle >>>= 0; + if (handle > 4) { + emval_handles.get(handle).refcount += 1; + } + } + function __emval_instanceof(object, constructor) { + object >>>= 0; + constructor >>>= 0; + object = Emval.toValue(object); + constructor = Emval.toValue(constructor); + return object instanceof constructor; + } + function __emval_new_array() { + return Emval.toHandle([]); + } + function __emval_new_cstring(v) { + v >>>= 0; + return Emval.toHandle(getStringOrSymbol(v)); + } + function __emval_new_object() { + return Emval.toHandle({}); + } + function __emval_run_destructors(handle) { + handle >>>= 0; + var destructors = Emval.toValue(handle); + runDestructors(destructors); + __emval_decref(handle); + } + function __emval_set_property(handle, key, value) { + handle >>>= 0; + key >>>= 0; + value >>>= 0; + handle = Emval.toValue(handle); + key = Emval.toValue(key); + value = Emval.toValue(value); + handle[key] = value; + } + function __emval_take_value(type, arg) { + type >>>= 0; + arg >>>= 0; + type = requireRegisteredType(type, "_emval_take_value"); + var v = type["readValueFromPointer"](arg); + return Emval.toHandle(v); + } + function __emval_typeof(handle) { + handle >>>= 0; + handle = Emval.toValue(handle); + return Emval.toHandle(typeof handle); + } + function __mmap_js( + len, + prot, + flags, + fd, + offset_low, + offset_high, + allocated, + addr, + ) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 21, + 1, + len, + prot, + flags, + fd, + offset_low, + offset_high, + allocated, + addr, + ); + len >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + allocated >>>= 0; + addr >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + GROWABLE_HEAP_I32()[(allocated >>> 2) >>> 0] = res.allocated; + GROWABLE_HEAP_U32()[(addr >>> 2) >>> 0] = ptr; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset_low, offset_high) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 22, + 1, + addr, + len, + prot, + flags, + fd, + offset_low, + offset_high, + ); + addr >>>= 0; + len >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + FS.munmap(stream); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var _emscripten_get_now; + _emscripten_get_now = () => performance.timeOrigin + performance.now(); + function __setitimer_js(which, timeout_ms) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(23, 1, which, timeout_ms); + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id: id, timeout_ms: timeout_ms }; + return 0; + } + var _abort = () => { + abort(""); + }; + var warnOnce = (text) => { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } + }; + var _emscripten_check_blocking_allowed = () => {}; + var _emscripten_date_now = () => Date.now(); + var _emscripten_exit_with_live_runtime = () => { + runtimeKeepalivePush(); + throw "unwind"; + }; + function _emscripten_force_exit(status) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(24, 1, status); + __emscripten_runtime_keepalive_clear(); + _exit(status); + } + var getHeapMax = () => 4294901760; + function _emscripten_get_heap_max() { + return getHeapMax(); + } + var _emscripten_num_logical_cores = () => { + if (ENVIRONMENT_IS_NODE) return require("os").cpus().length; + return navigator["hardwareConcurrency"]; + }; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = (size - b.byteLength + 65535) / 65536; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize >>>= 0; + var oldSize = GROWABLE_HEAP_U8().length; + if (requestedSize <= oldSize) { + return false; + } + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + var alignUp = (x, multiple) => + x + ((multiple - (x % multiple)) % multiple); + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignUp(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + } + var ENV = {}; + var getExecutableName = () => thisProgram || "./this.program"; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == "object" && + navigator.languages && + navigator.languages[0]) || + "C" + ).replace("-", "_") + ".UTF-8"; + var env = { + USER: "web_user", + LOGNAME: "web_user", + PATH: "/", + PWD: "/", + HOME: "/home/web_user", + LANG: lang, + _: getExecutableName(), + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + GROWABLE_HEAP_I8()[(buffer++ >>> 0) >>> 0] = str.charCodeAt(i); + } + GROWABLE_HEAP_I8()[(buffer >>> 0) >>> 0] = 0; + }; + var _environ_get = function (__environ, environ_buf) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(25, 1, __environ, environ_buf); + __environ >>>= 0; + environ_buf >>>= 0; + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + GROWABLE_HEAP_U32()[((__environ + i * 4) >>> 2) >>> 0] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + var _environ_sizes_get = function (penviron_count, penviron_buf_size) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(26, 1, penviron_count, penviron_buf_size); + penviron_count >>>= 0; + penviron_buf_size >>>= 0; + var strings = getEnvStrings(); + GROWABLE_HEAP_U32()[(penviron_count >>> 2) >>> 0] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + GROWABLE_HEAP_U32()[(penviron_buf_size >>> 2) >>> 0] = bufSize; + return 0; + }; + function _fd_close(fd) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(27, 1, fd); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_fdstat_get(fd, pbuf) { + if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread(28, 1, fd, pbuf); + pbuf >>>= 0; + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + GROWABLE_HEAP_I8()[(pbuf >>> 0) >>> 0] = type; + GROWABLE_HEAP_I16()[((pbuf + 2) >>> 1) >>> 0] = flags; + (tempI64 = [ + rightsBase >>> 0, + ((tempDouble = rightsBase), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((pbuf + 8) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((pbuf + 12) >>> 2) >>> 0] = tempI64[1]); + (tempI64 = [ + rightsInheriting >>> 0, + ((tempDouble = rightsInheriting), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[((pbuf + 16) >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((pbuf + 20) >>> 2) >>> 0] = tempI64[1]); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = GROWABLE_HEAP_U32()[(iov >>> 2) >>> 0]; + var len = GROWABLE_HEAP_U32()[((iov + 4) >>> 2) >>> 0]; + iov += 8; + var curr = FS.read(stream, GROWABLE_HEAP_I8(), ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset !== "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 29, + 1, + fd, + iov, + iovcnt, + offset_low, + offset_high, + pnum, + ); + iov >>>= 0; + iovcnt >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + pnum >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt, offset); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = GROWABLE_HEAP_U32()[(iov >>> 2) >>> 0]; + var len = GROWABLE_HEAP_U32()[((iov + 4) >>> 2) >>> 0]; + iov += 8; + var curr = FS.write(stream, GROWABLE_HEAP_I8(), ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (typeof offset !== "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 30, + 1, + fd, + iov, + iovcnt, + offset_low, + offset_high, + pnum, + ); + iov >>>= 0; + iovcnt >>>= 0; + var offset = convertI32PairToI53Checked(offset_low, offset_high); + pnum >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt, offset); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_read(fd, iov, iovcnt, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(31, 1, fd, iov, iovcnt, pnum); + iov >>>= 0; + iovcnt >>>= 0; + pnum >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread( + 32, + 1, + fd, + offset_low, + offset_high, + whence, + newOffset, + ); + var offset = convertI32PairToI53Checked(offset_low, offset_high); + newOffset >>>= 0; + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + (tempI64 = [ + stream.position >>> 0, + ((tempDouble = stream.position), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / 4294967296, + ) >>> 0 + : 0), + ]), + (GROWABLE_HEAP_I32()[(newOffset >>> 2) >>> 0] = tempI64[0]), + (GROWABLE_HEAP_I32()[((newOffset + 4) >>> 2) >>> 0] = tempI64[1]); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_write(fd, iov, iovcnt, pnum) { + if (ENVIRONMENT_IS_PTHREAD) + return proxyToMainThread(33, 1, fd, iov, iovcnt, pnum); + iov >>>= 0; + iovcnt >>>= 0; + pnum >>>= 0; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + GROWABLE_HEAP_U32()[(pnum >>> 2) >>> 0] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _llvm_eh_typeid_for(type) { + type >>>= 0; + return type; + } + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + var arraySum = (array, index) => { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) {} + return sum; + }; + var MONTH_DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var MONTH_DAYS_REGULAR = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var addDays = (date, days) => { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = (leap ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR)[ + currentMonth + ]; + if (days > daysInCurrentMonth - newDate.getDate()) { + days -= daysInCurrentMonth - newDate.getDate() + 1; + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth + 1); + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear() + 1); + } + } else { + newDate.setDate(newDate.getDate() + days); + return newDate; + } + } + return newDate; + }; + var writeArrayToMemory = (array, buffer) => { + GROWABLE_HEAP_I8().set(array, buffer >>> 0); + }; + function _strftime(s, maxsize, format, tm) { + s >>>= 0; + maxsize >>>= 0; + format >>>= 0; + tm >>>= 0; + var tm_zone = GROWABLE_HEAP_U32()[((tm + 40) >>> 2) >>> 0]; + var date = { + tm_sec: GROWABLE_HEAP_I32()[(tm >>> 2) >>> 0], + tm_min: GROWABLE_HEAP_I32()[((tm + 4) >>> 2) >>> 0], + tm_hour: GROWABLE_HEAP_I32()[((tm + 8) >>> 2) >>> 0], + tm_mday: GROWABLE_HEAP_I32()[((tm + 12) >>> 2) >>> 0], + tm_mon: GROWABLE_HEAP_I32()[((tm + 16) >>> 2) >>> 0], + tm_year: GROWABLE_HEAP_I32()[((tm + 20) >>> 2) >>> 0], + tm_wday: GROWABLE_HEAP_I32()[((tm + 24) >>> 2) >>> 0], + tm_yday: GROWABLE_HEAP_I32()[((tm + 28) >>> 2) >>> 0], + tm_isdst: GROWABLE_HEAP_I32()[((tm + 32) >>> 2) >>> 0], + tm_gmtoff: GROWABLE_HEAP_I32()[((tm + 36) >>> 2) >>> 0], + tm_zone: tm_zone ? UTF8ToString(tm_zone) : "", + }; + var pattern = UTF8ToString(format); + var EXPANSION_RULES_1 = { + "%c": "%a %b %d %H:%M:%S %Y", + "%D": "%m/%d/%y", + "%F": "%Y-%m-%d", + "%h": "%b", + "%r": "%I:%M:%S %p", + "%R": "%H:%M", + "%T": "%H:%M:%S", + "%x": "%m/%d/%y", + "%X": "%H:%M:%S", + "%Ec": "%c", + "%EC": "%C", + "%Ex": "%m/%d/%y", + "%EX": "%H:%M:%S", + "%Ey": "%y", + "%EY": "%Y", + "%Od": "%d", + "%Oe": "%e", + "%OH": "%H", + "%OI": "%I", + "%Om": "%m", + "%OM": "%M", + "%OS": "%S", + "%Ou": "%u", + "%OU": "%U", + "%OV": "%V", + "%Ow": "%w", + "%OW": "%W", + "%Oy": "%y", + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace( + new RegExp(rule, "g"), + EXPANSION_RULES_1[rule], + ); + } + var WEEKDAYS = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ]; + var MONTHS = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ]; + function leadingSomething(value, digits, character) { + var str = typeof value == "number" ? value.toString() : value || ""; + while (str.length < digits) { + str = character[0] + str; + } + return str; + } + function leadingNulls(value, digits) { + return leadingSomething(value, digits, "0"); + } + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + var compare; + if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) { + if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) { + compare = sgn(date1.getDate() - date2.getDate()); + } + } + return compare; + } + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: + return new Date(janFourth.getFullYear() - 1, 11, 29); + case 1: + return janFourth; + case 2: + return new Date(janFourth.getFullYear(), 0, 3); + case 3: + return new Date(janFourth.getFullYear(), 0, 2); + case 4: + return new Date(janFourth.getFullYear(), 0, 1); + case 5: + return new Date(janFourth.getFullYear() - 1, 11, 31); + case 6: + return new Date(janFourth.getFullYear() - 1, 11, 30); + } + } + function getWeekBasedYear(date) { + var thisDate = addDays( + new Date(date.tm_year + 1900, 0, 1), + date.tm_yday, + ); + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear() + 1; + } + return thisDate.getFullYear(); + } + return thisDate.getFullYear() - 1; + } + var EXPANSION_RULES_2 = { + "%a": (date) => WEEKDAYS[date.tm_wday].substring(0, 3), + "%A": (date) => WEEKDAYS[date.tm_wday], + "%b": (date) => MONTHS[date.tm_mon].substring(0, 3), + "%B": (date) => MONTHS[date.tm_mon], + "%C": (date) => { + var year = date.tm_year + 1900; + return leadingNulls((year / 100) | 0, 2); + }, + "%d": (date) => leadingNulls(date.tm_mday, 2), + "%e": (date) => leadingSomething(date.tm_mday, 2, " "), + "%g": (date) => getWeekBasedYear(date).toString().substring(2), + "%G": (date) => getWeekBasedYear(date), + "%H": (date) => leadingNulls(date.tm_hour, 2), + "%I": (date) => { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; + else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + "%j": (date) => + leadingNulls( + date.tm_mday + + arraySum( + isLeapYear(date.tm_year + 1900) + ? MONTH_DAYS_LEAP + : MONTH_DAYS_REGULAR, + date.tm_mon - 1, + ), + 3, + ), + "%m": (date) => leadingNulls(date.tm_mon + 1, 2), + "%M": (date) => leadingNulls(date.tm_min, 2), + "%n": () => "\n", + "%p": (date) => { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return "AM"; + } + return "PM"; + }, + "%S": (date) => leadingNulls(date.tm_sec, 2), + "%t": () => "\t", + "%u": (date) => date.tm_wday || 7, + "%U": (date) => { + var days = date.tm_yday + 7 - date.tm_wday; + return leadingNulls(Math.floor(days / 7), 2); + }, + "%V": (date) => { + var val = Math.floor( + (date.tm_yday + 7 - ((date.tm_wday + 6) % 7)) / 7, + ); + if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) { + val++; + } + if (!val) { + val = 52; + var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7; + if ( + dec31 == 4 || + (dec31 == 5 && isLeapYear((date.tm_year % 400) - 1)) + ) { + val++; + } + } else if (val == 53) { + var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7; + if (jan1 != 4 && (jan1 != 3 || !isLeapYear(date.tm_year))) val = 1; + } + return leadingNulls(val, 2); + }, + "%w": (date) => date.tm_wday, + "%W": (date) => { + var days = date.tm_yday + 7 - ((date.tm_wday + 6) % 7); + return leadingNulls(Math.floor(days / 7), 2); + }, + "%y": (date) => (date.tm_year + 1900).toString().substring(2), + "%Y": (date) => date.tm_year + 1900, + "%z": (date) => { + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + off = (off / 60) * 100 + (off % 60); + return (ahead ? "+" : "-") + String("0000" + off).slice(-4); + }, + "%Z": (date) => date.tm_zone, + "%%": () => "%", + }; + pattern = pattern.replace(/%%/g, "\0\0"); + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace( + new RegExp(rule, "g"), + EXPANSION_RULES_2[rule](date), + ); + } + } + pattern = pattern.replace(/\0\0/g, "%"); + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + writeArrayToMemory(bytes, s); + return bytes.length - 1; + } + function _strftime_l(s, maxsize, format, tm, loc) { + s >>>= 0; + maxsize >>>= 0; + format >>>= 0; + tm >>>= 0; + loc >>>= 0; + return _strftime(s, maxsize, format, tm); + } + PThread.init(); + var FSNode = function (parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + }; + var readMode = 292 | 73; + var writeMode = 146; + Object.defineProperties(FSNode.prototype, { + read: { + get: function () { + return (this.mode & readMode) === readMode; + }, + set: function (val) { + val ? (this.mode |= readMode) : (this.mode &= ~readMode); + }, + }, + write: { + get: function () { + return (this.mode & writeMode) === writeMode; + }, + set: function (val) { + val ? (this.mode |= writeMode) : (this.mode &= ~writeMode); + }, + }, + isFolder: { + get: function () { + return FS.isDir(this.mode); + }, + }, + isDevice: { + get: function () { + return FS.isChrdev(this.mode); + }, + }, + }); + FS.FSNode = FSNode; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["FS_createPath"] = FS.createPath; + Module["FS_createDataFile"] = FS.createDataFile; + Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + Module["FS_unlink"] = FS.unlink; + Module["FS_createLazyFile"] = FS.createLazyFile; + Module["FS_createDevice"] = FS.createDevice; + embind_init_charCodes(); + BindingError = Module["BindingError"] = class BindingError extends Error { + constructor(message) { + super(message); + this.name = "BindingError"; + } + }; + InternalError = Module["InternalError"] = class InternalError extends ( + Error + ) { + constructor(message) { + super(message); + this.name = "InternalError"; + } + }; + init_ClassHandle(); + init_embind(); + init_RegisteredPointer(); + UnboundTypeError = Module["UnboundTypeError"] = extendError( + Error, + "UnboundTypeError", + ); + handleAllocatorInit(); + init_emval(); + var proxiedFunctionTable = [ + _proc_exit, + exitOnMainThread, + pthreadCreateProxied, + ___syscall_chmod, + ___syscall_faccessat, + ___syscall_fadvise64, + ___syscall_fchmod, + ___syscall_fcntl64, + ___syscall_fstat64, + ___syscall_getcwd, + ___syscall_getdents64, + ___syscall_ioctl, + ___syscall_lstat64, + ___syscall_mkdirat, + ___syscall_newfstatat, + ___syscall_openat, + ___syscall_readlinkat, + ___syscall_renameat, + ___syscall_stat64, + ___syscall_unlinkat, + __emscripten_runtime_keepalive_clear, + __mmap_js, + __munmap_js, + __setitimer_js, + _emscripten_force_exit, + _environ_get, + _environ_sizes_get, + _fd_close, + _fd_fdstat_get, + _fd_pread, + _fd_pwrite, + _fd_read, + _fd_seek, + _fd_write, + ]; + var wasmImports = { + Qb: __asyncjs__fetch_asset, + Lc: ___call_sighandler, + r: ___cxa_begin_catch, + D: ___cxa_end_catch, + b: ___cxa_find_matching_catch_2, + l: ___cxa_find_matching_catch_3, + Na: ___cxa_find_matching_catch_4, + nb: ___cxa_get_exception_ptr, + Ua: ___cxa_rethrow, + Bc: ___cxa_rethrow_primary_exception, + y: ___cxa_throw, + Cc: ___cxa_uncaught_exceptions, + Rc: ___emscripten_init_main_thread_js, + bb: ___emscripten_thread_cleanup, + Nc: ___pthread_create_js, + f: ___resumeException, + gb: ___syscall_chmod, + $c: ___syscall_faccessat, + _b: ___syscall_fadvise64, + Xc: ___syscall_fchmod, + hb: ___syscall_fcntl64, + Wc: ___syscall_fstat64, + Sc: ___syscall_getcwd, + Kc: ___syscall_getdents64, + cd: ___syscall_ioctl, + Tc: ___syscall_lstat64, + Pc: ___syscall_mkdirat, + Uc: ___syscall_newfstatat, + eb: ___syscall_openat, + Jc: ___syscall_readlinkat, + Ic: ___syscall_renameat, + Vc: ___syscall_stat64, + Ec: ___syscall_unlinkat, + cc: __embind_register_bigint, + gd: __embind_register_bool, + H: __embind_register_class, + da: __embind_register_class_class_function, + wa: __embind_register_class_class_property, + N: __embind_register_class_constructor, + z: __embind_register_class_function, + x: __embind_register_class_property, + fd: __embind_register_emval, + sb: __embind_register_enum, + Ea: __embind_register_enum_value, + jb: __embind_register_float, + ld: __embind_register_function, + oa: __embind_register_integer, + T: __embind_register_memory_view, + qa: __embind_register_smart_ptr, + ib: __embind_register_std_string, + Wa: __embind_register_std_wstring, + hd: __embind_register_void, + _c: __emscripten_get_now_is_monotonic, + Fc: __emscripten_notify_mailbox_postmessage, + Oc: __emscripten_receive_on_main_thread_js, + Mc: __emscripten_runtime_keepalive_clear, + Qc: __emscripten_thread_mailbox_await, + Zc: __emscripten_thread_set_strongref, + ra: __emval_as, + lc: __emval_as_int64, + kc: __emval_as_uint64, + Ha: __emval_call, + la: __emval_call_method, + yd: __emval_decref, + kd: __emval_equals, + od: __emval_get_global, + ka: __emval_get_method_caller, + Ad: __emval_get_property, + $a: __emval_incref, + pd: __emval_instanceof, + Ub: __emval_new_array, + Rb: __emval_new_cstring, + Tb: __emval_new_object, + Vb: __emval_run_destructors, + Sb: __emval_set_property, + F: __emval_take_value, + qd: __emval_typeof, + $b: __mmap_js, + ac: __munmap_js, + ab: __setitimer_js, + fa: _abort, + Pb: addToLoadedFiles, + rd: downloadJS, + cb: _emscripten_check_blocking_allowed, + fb: _emscripten_date_now, + Yc: _emscripten_exit_with_live_runtime, + tb: _emscripten_force_exit, + Gc: _emscripten_get_heap_max, + ba: _emscripten_get_now, + Hc: _emscripten_num_logical_cores, + Dc: _emscripten_resize_heap, + dd: _environ_get, + ed: _environ_sizes_get, + xa: _exit, + Ia: _fd_close, + db: _fd_fdstat_get, + Zb: _fd_pread, + Yb: _fd_pwrite, + bd: _fd_read, + bc: _fd_seek, + Va: _fd_write, + ub: invoke_dddd, + jd: invoke_ddiiiii, + s: invoke_di, + P: invoke_did, + nd: invoke_didii, + pa: invoke_dif, + Ta: invoke_dii, + sa: invoke_diii, + mc: invoke_dj, + Aa: invoke_fi, + Kb: invoke_fid, + Gb: invoke_fif, + mb: invoke_fii, + Sa: invoke_fiii, + xd: invoke_fiiid, + k: invoke_i, + Ab: invoke_idddii, + Bb: invoke_idddiii, + La: invoke_iddii, + Ma: invoke_iddiii, + zb: invoke_idi, + Fa: invoke_idii, + ob: invoke_idiiiiii, + Ja: invoke_idiiiiiii, + Eb: invoke_ifii, + c: invoke_ii, + Q: invoke_iid, + J: invoke_iidd, + _a: invoke_iiddddddiiii, + xb: invoke_iidi, + na: invoke_iidii, + aa: invoke_iidiii, + vd: invoke_iidiiii, + Za: invoke_iidiiiii, + M: invoke_iif, + ta: invoke_iiffi, + id: invoke_iifi, + e: invoke_iii, + q: invoke_iiid, + sd: invoke_iiidd, + ma: invoke_iiidddii, + td: invoke_iiiddi, + zd: invoke_iiiddii, + ca: invoke_iiidi, + w: invoke_iiidii, + vb: invoke_iiidiiidiiiidiif, + wb: invoke_iiidiiiii, + ya: invoke_iiiff, + Ra: invoke_iiifi, + h: invoke_iiii, + R: invoke_iiiid, + I: invoke_iiiiddd, + wd: invoke_iiiidii, + ua: invoke_iiiidiii, + md: invoke_iiiidiiii, + yb: invoke_iiiidiiiiii, + Hb: invoke_iiiifffffiiff, + m: invoke_iiiii, + L: invoke_iiiiid, + Ca: invoke_iiiiidiiii, + o: invoke_iiiiii, + Pa: invoke_iiiiiid, + B: invoke_iiiiiii, + rb: invoke_iiiiiiidddi, + C: invoke_iiiiiiii, + ud: invoke_iiiiiiiidi, + A: invoke_iiiiiiiii, + va: invoke_iiiiiiiiii, + kb: invoke_iiiiiiiiiii, + Da: invoke_iiiiiiiiiiii, + za: invoke_iiiiiiiiiiiii, + Oa: invoke_iiiiiiiiiiiiii, + Cb: invoke_iiiiiiiiiiiiiiiiiiii, + Xb: invoke_iiiiij, + dc: invoke_iiiij, + ec: invoke_iiiijii, + gc: invoke_iiiijjii, + sc: invoke_iiijj, + rc: invoke_iiijji, + jc: invoke_iij, + zc: invoke_j, + wc: invoke_ji, + pc: invoke_jii, + yc: invoke_jiii, + Wb: invoke_jiiii, + xc: invoke_jiij, + p: invoke_v, + Z: invoke_vd, + pb: invoke_vdiii, + Fb: invoke_vfiiii, + j: invoke_vi, + _: invoke_vid, + Mb: invoke_vidddi, + Jb: invoke_viddi, + Qa: invoke_vidi, + ea: invoke_vidii, + Ka: invoke_vidiii, + qb: invoke_vidiiii, + U: invoke_vif, + V: invoke_vifii, + d: invoke_vii, + W: invoke_viid, + Lb: invoke_viiddddi, + Nb: invoke_viiddi, + ja: invoke_viidi, + Xa: invoke_viidii, + t: invoke_viif, + g: invoke_viii, + Y: invoke_viiid, + Ob: invoke_viiiddddi, + O: invoke_viiidi, + ha: invoke_viiidii, + Ba: invoke_viiidiiiii, + Db: invoke_viiif, + i: invoke_viiii, + E: invoke_viiiid, + ia: invoke_viiiidi, + Ya: invoke_viiiidiiiiii, + n: invoke_viiiii, + S: invoke_viiiiid, + X: invoke_viiiiidi, + v: invoke_viiiiii, + G: invoke_viiiiiii, + Ib: invoke_viiiiiiid, + K: invoke_viiiiiiii, + $: invoke_viiiiiiiii, + ga: invoke_viiiiiiiiii, + lb: invoke_viiiiiiiiiiiii, + Ga: invoke_viiiiiiiiiiiiiii, + ic: invoke_viiiijii, + fc: invoke_viiijii, + hc: invoke_viiijjii, + vc: invoke_viij, + nc: invoke_viiji, + qc: invoke_vij, + uc: invoke_viji, + tc: invoke_vijii, + oc: invoke_vijji, + u: _llvm_eh_typeid_for, + a: wasmMemory || Module["wasmMemory"], + ad: _proc_exit, + Ac: _strftime_l, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports["Bd"])(); + var _pthread_self = (Module["_pthread_self"] = () => + (_pthread_self = Module["_pthread_self"] = wasmExports["Cd"])()); + var ___cxa_free_exception = (a0) => + (___cxa_free_exception = wasmExports["__cxa_free_exception"])(a0); + var _free = (a0) => (_free = wasmExports["Ed"])(a0); + var _malloc = (a0) => (_malloc = wasmExports["Fd"])(a0); + var ___errno_location = () => (___errno_location = wasmExports["Gd"])(); + var __emscripten_tls_init = (Module["__emscripten_tls_init"] = () => + (__emscripten_tls_init = Module["__emscripten_tls_init"] = + wasmExports["Hd"])()); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = wasmExports["Id"])(a0, a1); + var ___getTypeName = (a0) => (___getTypeName = wasmExports["Jd"])(a0); + var __embind_initialize_bindings = (Module["__embind_initialize_bindings"] = + () => + (__embind_initialize_bindings = Module["__embind_initialize_bindings"] = + wasmExports["Kd"])()); + var __emscripten_thread_init = (Module["__emscripten_thread_init"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (__emscripten_thread_init = Module["__emscripten_thread_init"] = + wasmExports["Ld"])(a0, a1, a2, a3, a4, a5)); + var __emscripten_thread_crashed = (Module["__emscripten_thread_crashed"] = + () => + (__emscripten_thread_crashed = Module["__emscripten_thread_crashed"] = + wasmExports["Md"])()); + var _emscripten_main_thread_process_queued_calls = () => + (_emscripten_main_thread_process_queued_calls = + wasmExports["emscripten_main_thread_process_queued_calls"])(); + var _emscripten_main_runtime_thread_id = () => + (_emscripten_main_runtime_thread_id = + wasmExports["emscripten_main_runtime_thread_id"])(); + var __emscripten_run_on_main_thread_js = (a0, a1, a2, a3) => + (__emscripten_run_on_main_thread_js = wasmExports["Nd"])(a0, a1, a2, a3); + var __emscripten_thread_free_data = (a0) => + (__emscripten_thread_free_data = wasmExports["Od"])(a0); + var __emscripten_thread_exit = (Module["__emscripten_thread_exit"] = (a0) => + (__emscripten_thread_exit = Module["__emscripten_thread_exit"] = + wasmExports["Pd"])(a0)); + var __emscripten_timeout = (a0, a1) => + (__emscripten_timeout = wasmExports["Qd"])(a0, a1); + var __emscripten_check_mailbox = (Module["__emscripten_check_mailbox"] = + () => + (__emscripten_check_mailbox = Module["__emscripten_check_mailbox"] = + wasmExports["Rd"])()); + var _setThrew = (a0, a1) => (_setThrew = wasmExports["Sd"])(a0, a1); + var setTempRet0 = (a0) => (setTempRet0 = wasmExports["Td"])(a0); + var _emscripten_stack_set_limits = (a0, a1) => + (_emscripten_stack_set_limits = wasmExports["Ud"])(a0, a1); + var stackSave = () => (stackSave = wasmExports["Vd"])(); + var stackRestore = (a0) => (stackRestore = wasmExports["Wd"])(a0); + var stackAlloc = (a0) => (stackAlloc = wasmExports["Xd"])(a0); + var ___cxa_decrement_exception_refcount = (a0) => + (___cxa_decrement_exception_refcount = wasmExports["Yd"])(a0); + var ___cxa_increment_exception_refcount = (a0) => + (___cxa_increment_exception_refcount = wasmExports["Zd"])(a0); + var ___cxa_can_catch = (a0, a1, a2) => + (___cxa_can_catch = wasmExports["_d"])(a0, a1, a2); + var ___cxa_is_pointer_type = (a0) => + (___cxa_is_pointer_type = wasmExports["$d"])(a0); + var dynCall_iii = (Module["dynCall_iii"] = (a0, a1, a2) => + (dynCall_iii = Module["dynCall_iii"] = wasmExports["ae"])(a0, a1, a2)); + var dynCall_iiii = (Module["dynCall_iiii"] = (a0, a1, a2, a3) => + (dynCall_iiii = Module["dynCall_iiii"] = wasmExports["be"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vi = (Module["dynCall_vi"] = (a0, a1) => + (dynCall_vi = Module["dynCall_vi"] = wasmExports["ce"])(a0, a1)); + var dynCall_ii = (Module["dynCall_ii"] = (a0, a1) => + (dynCall_ii = Module["dynCall_ii"] = wasmExports["de"])(a0, a1)); + var dynCall_iiiiii = (Module["dynCall_iiiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiiii = Module["dynCall_iiiiii"] = wasmExports["ee"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vii = (Module["dynCall_vii"] = (a0, a1, a2) => + (dynCall_vii = Module["dynCall_vii"] = wasmExports["fe"])(a0, a1, a2)); + var dynCall_i = (Module["dynCall_i"] = (a0) => + (dynCall_i = Module["dynCall_i"] = wasmExports["ge"])(a0)); + var dynCall_viiiii = (Module["dynCall_viiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiiii = Module["dynCall_viiiii"] = wasmExports["he"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_v = (Module["dynCall_v"] = (a0) => + (dynCall_v = Module["dynCall_v"] = wasmExports["ie"])(a0)); + var dynCall_viii = (Module["dynCall_viii"] = (a0, a1, a2, a3) => + (dynCall_viii = Module["dynCall_viii"] = wasmExports["je"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vid = (Module["dynCall_vid"] = (a0, a1, a2) => + (dynCall_vid = Module["dynCall_vid"] = wasmExports["ke"])(a0, a1, a2)); + var dynCall_di = (Module["dynCall_di"] = (a0, a1) => + (dynCall_di = Module["dynCall_di"] = wasmExports["le"])(a0, a1)); + var dynCall_iiiii = (Module["dynCall_iiiii"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiii = Module["dynCall_iiiii"] = wasmExports["me"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiii = (Module["dynCall_viiii"] = (a0, a1, a2, a3, a4) => + (dynCall_viiii = Module["dynCall_viiii"] = wasmExports["ne"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viid = (Module["dynCall_viid"] = (a0, a1, a2, a3) => + (dynCall_viid = Module["dynCall_viid"] = wasmExports["oe"])( + a0, + a1, + a2, + a3, + )); + var dynCall_dii = (Module["dynCall_dii"] = (a0, a1, a2) => + (dynCall_dii = Module["dynCall_dii"] = wasmExports["pe"])(a0, a1, a2)); + var dynCall_viiid = (Module["dynCall_viiid"] = (a0, a1, a2, a3, a4) => + (dynCall_viiid = Module["dynCall_viiid"] = wasmExports["qe"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiid = (Module["dynCall_iiiid"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiid = Module["dynCall_iiiid"] = wasmExports["re"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiii = (Module["dynCall_iiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiiiiii = Module["dynCall_iiiiiiii"] = wasmExports["se"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiiii = (Module["dynCall_viiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiiii = Module["dynCall_viiiiii"] = wasmExports["te"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiiiii = (Module["dynCall_iiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiiii = Module["dynCall_iiiiiii"] = wasmExports["ue"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_diii = (Module["dynCall_diii"] = (a0, a1, a2, a3) => + (dynCall_diii = Module["dynCall_diii"] = wasmExports["ve"])( + a0, + a1, + a2, + a3, + )); + var dynCall_j = (Module["dynCall_j"] = (a0) => + (dynCall_j = Module["dynCall_j"] = wasmExports["we"])(a0)); + var dynCall_iiid = (Module["dynCall_iiid"] = (a0, a1, a2, a3) => + (dynCall_iiid = Module["dynCall_iiid"] = wasmExports["xe"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiiid = (Module["dynCall_iiiiid"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiiid = Module["dynCall_iiiiid"] = wasmExports["ye"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vd = (Module["dynCall_vd"] = (a0, a1) => + (dynCall_vd = Module["dynCall_vd"] = wasmExports["ze"])(a0, a1)); + var dynCall_iiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_iiiiiiiiiiii = Module["dynCall_iiiiiiiiiiii"] = + wasmExports["Ae"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iid = (Module["dynCall_iid"] = (a0, a1, a2) => + (dynCall_iid = Module["dynCall_iid"] = wasmExports["Be"])(a0, a1, a2)); + var dynCall_viidi = (Module["dynCall_viidi"] = (a0, a1, a2, a3, a4) => + (dynCall_viidi = Module["dynCall_viidi"] = wasmExports["Ce"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iidiii = (Module["dynCall_iidiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iidiii = Module["dynCall_iidiii"] = wasmExports["De"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiiiiiii = (Module["dynCall_iiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiiiiiii = Module["dynCall_iiiiiiiii"] = wasmExports["Ee"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiiiiiiii = (Module["dynCall_iiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiiiiii = Module["dynCall_iiiiiiiiii"] = wasmExports["Fe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiidi = (Module["dynCall_iiidi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiidi = Module["dynCall_iiidi"] = wasmExports["Ge"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fiii = (Module["dynCall_fiii"] = (a0, a1, a2, a3) => + (dynCall_fiii = Module["dynCall_fiii"] = wasmExports["He"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiifi = (Module["dynCall_iiifi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiifi = Module["dynCall_iiifi"] = wasmExports["Ie"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viif = (Module["dynCall_viif"] = (a0, a1, a2, a3) => + (dynCall_viif = Module["dynCall_viif"] = wasmExports["Je"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiffi = (Module["dynCall_iiffi"] = (a0, a1, a2, a3, a4) => + (dynCall_iiffi = Module["dynCall_iiffi"] = wasmExports["Ke"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fif = (Module["dynCall_fif"] = (a0, a1, a2) => + (dynCall_fif = Module["dynCall_fif"] = wasmExports["Le"])(a0, a1, a2)); + var dynCall_iif = (Module["dynCall_iif"] = (a0, a1, a2) => + (dynCall_iif = Module["dynCall_iif"] = wasmExports["Me"])(a0, a1, a2)); + var dynCall_dif = (Module["dynCall_dif"] = (a0, a1, a2) => + (dynCall_dif = Module["dynCall_dif"] = wasmExports["Ne"])(a0, a1, a2)); + var dynCall_viiiiiii = (Module["dynCall_viiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiiiiii = Module["dynCall_viiiiiii"] = wasmExports["Oe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiiiiii = (Module["dynCall_viiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiiiiii = Module["dynCall_viiiiiiii"] = wasmExports["Pe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iidii = (Module["dynCall_iidii"] = (a0, a1, a2, a3, a4) => + (dynCall_iidii = Module["dynCall_iidii"] = wasmExports["Qe"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiidiiiii = (Module["dynCall_viiidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiidiiiii = Module["dynCall_viiidiiiii"] = wasmExports["Re"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiiidi = (Module["dynCall_viiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiidi = Module["dynCall_viiiidi"] = wasmExports["Se"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiidii = (Module["dynCall_viiidii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiidii = Module["dynCall_viiidii"] = wasmExports["Te"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiiid = (Module["dynCall_viiiid"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiiid = Module["dynCall_viiiid"] = wasmExports["Ue"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiidiii = (Module["dynCall_iiiidiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiidiii = Module["dynCall_iiiidiii"] = wasmExports["Ve"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iiiiidiiii = (Module["dynCall_iiiiidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiidiiii = Module["dynCall_iiiiidiiii"] = wasmExports["We"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiiiid = (Module["dynCall_viiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viiiiid = Module["dynCall_viiiiid"] = wasmExports["Xe"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiiiidi = (Module["dynCall_viiiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiiiidi = Module["dynCall_viiiiidi"] = wasmExports["Ye"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_viiiddddi = (Module["dynCall_viiiddddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiddddi = Module["dynCall_viiiddddi"] = wasmExports["Ze"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiddi = (Module["dynCall_viiddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiddi = Module["dynCall_viiddi"] = wasmExports["_e"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_vidddi = (Module["dynCall_vidddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vidddi = Module["dynCall_vidddi"] = wasmExports["$e"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viiddddi = (Module["dynCall_viiddddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiddddi = Module["dynCall_viiddddi"] = wasmExports["af"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_fid = (Module["dynCall_fid"] = (a0, a1, a2) => + (dynCall_fid = Module["dynCall_fid"] = wasmExports["bf"])(a0, a1, a2)); + var dynCall_iiiiiid = (Module["dynCall_iiiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiiid = Module["dynCall_iiiiiid"] = wasmExports["cf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vif = (Module["dynCall_vif"] = (a0, a1, a2) => + (dynCall_vif = Module["dynCall_vif"] = wasmExports["df"])(a0, a1, a2)); + var dynCall_viiidi = (Module["dynCall_viiidi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiidi = Module["dynCall_viiidi"] = wasmExports["ef"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viddi = (Module["dynCall_viddi"] = (a0, a1, a2, a3, a4) => + (dynCall_viddi = Module["dynCall_viddi"] = wasmExports["ff"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiid = (Module["dynCall_viiiiiiid"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiiiiid = Module["dynCall_viiiiiiid"] = wasmExports["gf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_jiij = (Module["dynCall_jiij"] = (a0, a1, a2, a3, a4) => + (dynCall_jiij = Module["dynCall_jiij"] = wasmExports["hf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_ji = (Module["dynCall_ji"] = (a0, a1) => + (dynCall_ji = Module["dynCall_ji"] = wasmExports["jf"])(a0, a1)); + var dynCall_iiiifffffiiff = (Module["dynCall_iiiifffffiiff"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) => + (dynCall_iiiifffffiiff = Module["dynCall_iiiifffffiiff"] = + wasmExports["kf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + )); + var dynCall_jif = (Module["dynCall_jif"] = (a0, a1, a2) => + (dynCall_jif = Module["dynCall_jif"] = wasmExports["lf"])(a0, a1, a2)); + var dynCall_vifii = (Module["dynCall_vifii"] = (a0, a1, a2, a3, a4) => + (dynCall_vifii = Module["dynCall_vifii"] = wasmExports["mf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vfiiii = (Module["dynCall_vfiiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vfiiii = Module["dynCall_vfiiii"] = wasmExports["nf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_ifii = (Module["dynCall_ifii"] = (a0, a1, a2, a3) => + (dynCall_ifii = Module["dynCall_ifii"] = wasmExports["of"])( + a0, + a1, + a2, + a3, + )); + var dynCall_jiiijji = (Module["dynCall_jiiijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_jiiijji = Module["dynCall_jiiijji"] = wasmExports["pf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiif = (Module["dynCall_viiif"] = (a0, a1, a2, a3, a4) => + (dynCall_viiif = Module["dynCall_viiif"] = wasmExports["qf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiiiiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiiiiiiiiii"] = + ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ) => + (dynCall_iiiiiiiiiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiiiiiiiiii"] = + wasmExports["rf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + )); + var dynCall_viiiiiiiiii = (Module["dynCall_viiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_viiiiiiiiii = Module["dynCall_viiiiiiiiii"] = wasmExports["sf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_viiiiiiiii = (Module["dynCall_viiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiiiiiiii = Module["dynCall_viiiiiiiii"] = wasmExports["tf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) => + (dynCall_iiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiii"] = + wasmExports["uf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + )); + var dynCall_ff = (Module["dynCall_ff"] = (a0, a1) => + (dynCall_ff = Module["dynCall_ff"] = wasmExports["vf"])(a0, a1)); + var dynCall_fff = (Module["dynCall_fff"] = (a0, a1, a2) => + (dynCall_fff = Module["dynCall_fff"] = wasmExports["wf"])(a0, a1, a2)); + var dynCall_iiijiii = (Module["dynCall_iiijiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiijiii = Module["dynCall_iiijiii"] = wasmExports["xf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_jii = (Module["dynCall_jii"] = (a0, a1, a2) => + (dynCall_jii = Module["dynCall_jii"] = wasmExports["yf"])(a0, a1, a2)); + var dynCall_iiij = (Module["dynCall_iiij"] = (a0, a1, a2, a3, a4) => + (dynCall_iiij = Module["dynCall_iiij"] = wasmExports["zf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiji = (Module["dynCall_iiiji"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiji = Module["dynCall_iiiji"] = wasmExports["Af"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiiiiiiiiiiiii = (Module["dynCall_iiiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) => + (dynCall_iiiiiiiiiiiiii = Module["dynCall_iiiiiiiiiiiiii"] = + wasmExports["Bf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + )); + var dynCall_iiddddddiiii = (Module["dynCall_iiddddddiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_iiddddddiiii = Module["dynCall_iiddddddiiii"] = + wasmExports["Cf"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iidiiiii = (Module["dynCall_iidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iidiiiii = Module["dynCall_iidiiiii"] = wasmExports["Df"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iddiii = (Module["dynCall_iddiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iddiii = Module["dynCall_iddiii"] = wasmExports["Ef"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iddii = (Module["dynCall_iddii"] = (a0, a1, a2, a3, a4) => + (dynCall_iddii = Module["dynCall_iddii"] = wasmExports["Ff"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_idddiii = (Module["dynCall_idddiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_idddiii = Module["dynCall_idddiii"] = wasmExports["Gf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_idddii = (Module["dynCall_idddii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_idddii = Module["dynCall_idddii"] = wasmExports["Hf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_idii = (Module["dynCall_idii"] = (a0, a1, a2, a3) => + (dynCall_idii = Module["dynCall_idii"] = wasmExports["If"])( + a0, + a1, + a2, + a3, + )); + var dynCall_idi = (Module["dynCall_idi"] = (a0, a1, a2) => + (dynCall_idi = Module["dynCall_idi"] = wasmExports["Jf"])(a0, a1, a2)); + var dynCall_fiiid = (Module["dynCall_fiiid"] = (a0, a1, a2, a3, a4) => + (dynCall_fiiid = Module["dynCall_fiiid"] = wasmExports["Kf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iidi = (Module["dynCall_iidi"] = (a0, a1, a2, a3) => + (dynCall_iidi = Module["dynCall_iidi"] = wasmExports["Lf"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiidii = (Module["dynCall_iiiidii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiidii = Module["dynCall_iiiidii"] = wasmExports["Mf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiidiiiiii = (Module["dynCall_iiiidiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiidiiiiii = Module["dynCall_iiiidiiiiii"] = wasmExports["Nf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_iiidiiiii = (Module["dynCall_iiidiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiidiiiii = Module["dynCall_iiidiiiii"] = wasmExports["Of"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiidiiidiiiidiif = (Module["dynCall_iiidiiidiiiidiif"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) => + (dynCall_iiidiiidiiiidiif = Module["dynCall_iiidiiidiiiidiif"] = + wasmExports["Pf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + )); + var dynCall_dddd = (Module["dynCall_dddd"] = (a0, a1, a2, a3) => + (dynCall_dddd = Module["dynCall_dddd"] = wasmExports["Qf"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iidiiii = (Module["dynCall_iidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iidiiii = Module["dynCall_iidiiii"] = wasmExports["Rf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiddii = (Module["dynCall_iiiddii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiddii = Module["dynCall_iiiddii"] = wasmExports["Sf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiiiiiiidi = (Module["dynCall_iiiiiiiidi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiiiidi = Module["dynCall_iiiiiiiidi"] = wasmExports["Tf"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiddi = (Module["dynCall_iiiddi"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiddi = Module["dynCall_iiiddi"] = wasmExports["Uf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiidd = (Module["dynCall_iiidd"] = (a0, a1, a2, a3, a4) => + (dynCall_iiidd = Module["dynCall_iiidd"] = wasmExports["Vf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiif = (Module["dynCall_iiiif"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiif = Module["dynCall_iiiif"] = wasmExports["Wf"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_fi = (Module["dynCall_fi"] = (a0, a1) => + (dynCall_fi = Module["dynCall_fi"] = wasmExports["Xf"])(a0, a1)); + var dynCall_did = (Module["dynCall_did"] = (a0, a1, a2) => + (dynCall_did = Module["dynCall_did"] = wasmExports["Yf"])(a0, a1, a2)); + var dynCall_iiidii = (Module["dynCall_iiidii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiidii = Module["dynCall_iiidii"] = wasmExports["Zf"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiidddii = (Module["dynCall_iiidddii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiidddii = Module["dynCall_iiidddii"] = wasmExports["_f"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_didii = (Module["dynCall_didii"] = (a0, a1, a2, a3, a4) => + (dynCall_didii = Module["dynCall_didii"] = wasmExports["$f"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiiiidddi = (Module["dynCall_iiiiiiidddi"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiiiiidddi = Module["dynCall_iiiiiiidddi"] = wasmExports["ag"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_iidd = (Module["dynCall_iidd"] = (a0, a1, a2, a3) => + (dynCall_iidd = Module["dynCall_iidd"] = wasmExports["bg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_viij = (Module["dynCall_viij"] = (a0, a1, a2, a3, a4) => + (dynCall_viij = Module["dynCall_viij"] = wasmExports["cg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viji = (Module["dynCall_viji"] = (a0, a1, a2, a3, a4) => + (dynCall_viji = Module["dynCall_viji"] = wasmExports["dg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vijii = (Module["dynCall_vijii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vijii = Module["dynCall_vijii"] = wasmExports["eg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_iiijj = (Module["dynCall_iiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiijj = Module["dynCall_iiijj"] = wasmExports["fg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iiijji = (Module["dynCall_iiijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiijji = Module["dynCall_iiijji"] = wasmExports["gg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_vij = (Module["dynCall_vij"] = (a0, a1, a2, a3) => + (dynCall_vij = Module["dynCall_vij"] = wasmExports["hg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vijji = (Module["dynCall_vijji"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_vijji = Module["dynCall_vijji"] = wasmExports["ig"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viiji = (Module["dynCall_viiji"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viiji = Module["dynCall_viiji"] = wasmExports["jg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_jiii = (Module["dynCall_jiii"] = (a0, a1, a2, a3) => + (dynCall_jiii = Module["dynCall_jiii"] = wasmExports["kg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiiddd = (Module["dynCall_iiiiddd"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiddd = Module["dynCall_iiiiddd"] = wasmExports["lg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vidii = (Module["dynCall_vidii"] = (a0, a1, a2, a3, a4) => + (dynCall_vidii = Module["dynCall_vidii"] = wasmExports["mg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_vidiiii = (Module["dynCall_vidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_vidiiii = Module["dynCall_vidiiii"] = wasmExports["ng"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_vidiii = (Module["dynCall_vidiii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_vidiii = Module["dynCall_vidiii"] = wasmExports["og"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_dj = (Module["dynCall_dj"] = (a0, a1, a2) => + (dynCall_dj = Module["dynCall_dj"] = wasmExports["pg"])(a0, a1, a2)); + var dynCall_vdiii = (Module["dynCall_vdiii"] = (a0, a1, a2, a3, a4) => + (dynCall_vdiii = Module["dynCall_vdiii"] = wasmExports["qg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_idiiiiii = (Module["dynCall_idiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_idiiiiii = Module["dynCall_idiiiiii"] = wasmExports["rg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_idiiiiiii = (Module["dynCall_idiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_idiiiiiii = Module["dynCall_idiiiiiii"] = wasmExports["sg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiidiiii = (Module["dynCall_iiiidiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiidiiii = Module["dynCall_iiiidiiii"] = wasmExports["tg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiiidiiiiii = (Module["dynCall_viiiidiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_viiiidiiiiii = Module["dynCall_viiiidiiiiii"] = + wasmExports["ug"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iiiff = (Module["dynCall_iiiff"] = (a0, a1, a2, a3, a4) => + (dynCall_iiiff = Module["dynCall_iiiff"] = wasmExports["vg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiiiiii = (Module["dynCall_viiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) => + (dynCall_viiiiiiiiiii = Module["dynCall_viiiiiiiiiii"] = + wasmExports["wg"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); + var dynCall_iij = (Module["dynCall_iij"] = (a0, a1, a2, a3) => + (dynCall_iij = Module["dynCall_iij"] = wasmExports["xg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_vidi = (Module["dynCall_vidi"] = (a0, a1, a2, a3) => + (dynCall_vidi = Module["dynCall_vidi"] = wasmExports["yg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_fii = (Module["dynCall_fii"] = (a0, a1, a2) => + (dynCall_fii = Module["dynCall_fii"] = wasmExports["zg"])(a0, a1, a2)); + var dynCall_viiiiiiiiiiiii = (Module["dynCall_viiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) => + (dynCall_viiiiiiiiiiiii = Module["dynCall_viiiiiiiiiiiii"] = + wasmExports["Ag"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + )); + var dynCall_iiiiiiiiiii = (Module["dynCall_iiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) => + (dynCall_iiiiiiiiiii = Module["dynCall_iiiiiiiiiii"] = wasmExports["Bg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + )); + var dynCall_viidii = (Module["dynCall_viidii"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_viidii = Module["dynCall_viidii"] = wasmExports["Cg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_viiiijii = (Module["dynCall_viiiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_viiiijii = Module["dynCall_viiiijii"] = wasmExports["Dg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_viiijjii = (Module["dynCall_viiijjii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_viiijjii = Module["dynCall_viiijjii"] = wasmExports["Eg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_iiiijjii = (Module["dynCall_iiiijjii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiijjii = Module["dynCall_iiiijjii"] = wasmExports["Fg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var dynCall_viiijii = (Module["dynCall_viiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_viiijii = Module["dynCall_viiijii"] = wasmExports["Gg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_iiiijii = (Module["dynCall_iiiijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (dynCall_iiiijii = Module["dynCall_iiiijii"] = wasmExports["Hg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var dynCall_ddiiiii = (Module["dynCall_ddiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_ddiiiii = Module["dynCall_ddiiiii"] = wasmExports["Ig"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_iifi = (Module["dynCall_iifi"] = (a0, a1, a2, a3) => + (dynCall_iifi = Module["dynCall_iifi"] = wasmExports["Jg"])( + a0, + a1, + a2, + a3, + )); + var dynCall_iiiij = (Module["dynCall_iiiij"] = (a0, a1, a2, a3, a4, a5) => + (dynCall_iiiij = Module["dynCall_iiiij"] = wasmExports["Kg"])( + a0, + a1, + a2, + a3, + a4, + a5, + )); + var dynCall_jiji = (Module["dynCall_jiji"] = (a0, a1, a2, a3, a4) => + (dynCall_jiji = Module["dynCall_jiji"] = wasmExports["Lg"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_iiiiij = (Module["dynCall_iiiiij"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_iiiiij = Module["dynCall_iiiiij"] = wasmExports["Mg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_viijii = (Module["dynCall_viijii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + ) => + (dynCall_viijii = Module["dynCall_viijii"] = wasmExports["Ng"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + )); + var dynCall_jiiii = (Module["dynCall_jiiii"] = (a0, a1, a2, a3, a4) => + (dynCall_jiiii = Module["dynCall_jiiii"] = wasmExports["Og"])( + a0, + a1, + a2, + a3, + a4, + )); + var dynCall_viiiiiiiiiiiiiii = (Module["dynCall_viiiiiiiiiiiiiii"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) => + (dynCall_viiiiiiiiiiiiiii = Module["dynCall_viiiiiiiiiiiiiii"] = + wasmExports["Pg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + )); + var dynCall_iiiiijj = (Module["dynCall_iiiiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (dynCall_iiiiijj = Module["dynCall_iiiiijj"] = wasmExports["Qg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var dynCall_iiiiiijj = (Module["dynCall_iiiiiijj"] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + ) => + (dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = wasmExports["Rg"])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _asyncify_start_unwind = (a0) => + (_asyncify_start_unwind = wasmExports["Sg"])(a0); + var _asyncify_stop_unwind = () => + (_asyncify_stop_unwind = wasmExports["Tg"])(); + var _asyncify_start_rewind = (a0) => + (_asyncify_start_rewind = wasmExports["Ug"])(a0); + var _asyncify_stop_rewind = () => + (_asyncify_stop_rewind = wasmExports["Vg"])(); + var ___start_em_js = (Module["___start_em_js"] = 3895468); + var ___stop_em_js = (Module["___stop_em_js"] = 3896792); + function invoke_iii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vi(index, a1) { + var sp = stackSave(); + try { + dynCall_vi(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ii(index, a1) { + var sp = stackSave(); + try { + return dynCall_ii(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vii(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_i(index) { + var sp = stackSave(); + try { + return dynCall_i(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viii(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_v(index) { + var sp = stackSave(); + try { + dynCall_v(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vid(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiidi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiidi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viid(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viid(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viidi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viidi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiid(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iiid(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_di(index, a1) { + var sp = stackSave(); + try { + return dynCall_di(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iid(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiid(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiiid(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vd(index, a1) { + var sp = stackSave(); + try { + dynCall_vd(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iidiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_fiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiifi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiifi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiffi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiffi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viif(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viif(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_diii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_diii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iidii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiid(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiiid(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiidi(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiidi(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiidiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiidi(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiiiidi(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiidii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiid(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiiid(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidi(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_vidi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiddddi(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiddddi(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vidddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiddddi(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiddddi(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fid(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fid(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiid(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiiid(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vif(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viddi(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viddi(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiid(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiiiiid(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiifffffiiff( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) { + var sp = stackSave(); + try { + return dynCall_iiiifffffiiff( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fif(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fif(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vifii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vifii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vfiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vfiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ifii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_ifii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiif(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiif(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fi(index, a1) { + var sp = stackSave(); + try { + return dynCall_fi(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiddddddiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + return dynCall_iiddddddiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iidiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiddii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiddii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iddiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iddiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iddii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iddii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idddiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_idddiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idddii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_idddii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_idii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idi(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_idi(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fiiid(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_fiiid(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidi(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iidi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiidii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiidiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidiiidiiiidiif( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ) { + var sp = stackSave(); + try { + return dynCall_iiidiiidiiiidiif( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dddd(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_dddd(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iidiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiidi(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiidi(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiddi(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiddi(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidd(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiidd(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_did(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_did(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiidii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiidddii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiidddii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_didii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_didii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiidddi( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiidddi( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iidd(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iidd(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiddd(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiddd(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vidii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_vidiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vidiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vidiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vdiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_vdiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_iiiidiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_idiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_idiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + return dynCall_idiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ) { + var sp = stackSave(); + try { + dynCall_viiiidiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiff(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiff(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_fii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_fii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ) { + var sp = stackSave(); + try { + dynCall_viiiiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viidii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viidii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ddiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_ddiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iifi(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iifi(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_j(index) { + var sp = stackSave(); + try { + return dynCall_j(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_jiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiij(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_jiij(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ji(index, a1) { + var sp = stackSave(); + try { + return dynCall_ji(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viij(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viij(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viji(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viji(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vijii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_vijii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiijj(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiijj(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiijji(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiijji(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vij(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_vij(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_jii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vijji(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_vijji(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiji(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiji(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_dj(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_dj(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iij(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iij(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiijii(index, a1, a2, a3, a4, a5, a6, a7, a8) { + var sp = stackSave(); + try { + dynCall_viiiijii(index, a1, a2, a3, a4, a5, a6, a7, a8); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiijjii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiijii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + dynCall_viiijii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiijii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiijii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiij(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiij(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiij(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiij(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_jiiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_jiiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_p = (f) => () => f() >>> 0; + var makeWrapper_pp = (f) => (a0) => f(a0) >>> 0; + var makeWrapper_ppp = (f) => (a0, a1) => f(a0, a1) >>> 0; + wasmExports["Cd"] = makeWrapper_p(wasmExports["Cd"]); + wasmExports["Fd"] = makeWrapper_pp(wasmExports["Fd"]); + wasmExports["Gd"] = makeWrapper_p(wasmExports["Gd"]); + wasmExports["Id"] = makeWrapper_ppp(wasmExports["Id"]); + wasmExports["Jd"] = makeWrapper_pp(wasmExports["Jd"]); + wasmExports["Vd"] = makeWrapper_p(wasmExports["Vd"]); + wasmExports["Xd"] = makeWrapper_pp(wasmExports["Xd"]); + return wasmExports; + } + Module["addRunDependency"] = addRunDependency; + Module["removeRunDependency"] = removeRunDependency; + Module["FS_createPath"] = FS.createPath; + Module["FS_createLazyFile"] = FS.createLazyFile; + Module["FS_createDevice"] = FS.createDevice; + Module["wasmMemory"] = wasmMemory; + Module["keepRuntimeAlive"] = keepRuntimeAlive; + Module["ExitStatus"] = ExitStatus; + Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + Module["FS_createDataFile"] = FS.createDataFile; + Module["FS_unlink"] = FS.unlink; + Module["PThread"] = PThread; + Module["FS_readdir"]=FS.readdir; + Module["FS_analyzePath"]=FS.analyzePath; + var calledRun; + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + function run() { + if (runDependencies > 0) { + return; + } + if (ENVIRONMENT_IS_PTHREAD) { + readyPromiseResolve(Module); + initRuntime(); + startWorker(Module); + return; + } + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function () { + setTimeout(function () { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + run(); + + return moduleArg.ready; + }; +})(); +if (typeof exports === "object" && typeof module === "object") + module.exports = getUsdModule; +else if (typeof define === "function" && define["amd"]) + define([], () => getUsdModule); + +globalThis["NEEDLE:USD:GET"] = getUsdModule; \ No newline at end of file diff --git a/web/threeVisualizer/external/emHdBindings.wasm b/web/threeVisualizer/external/emHdBindings.wasm new file mode 100644 index 0000000..03f2b21 Binary files /dev/null and b/web/threeVisualizer/external/emHdBindings.wasm differ diff --git a/web/threeVisualizer/external/emHdBindings.worker.js b/web/threeVisualizer/external/emHdBindings.worker.js new file mode 100644 index 0000000..003cdca --- /dev/null +++ b/web/threeVisualizer/external/emHdBindings.worker.js @@ -0,0 +1 @@ +"use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:f=>(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f),postMessage:msg=>parentPort.postMessage(msg),performance:global.performance||{now:Date.now}})}var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var module=Module["wasmModule"];Module["wasmModule"]=null;var instance=new WebAssembly.Instance(module,info);return receiveInstance(instance)};self.onunhandledrejection=e=>{throw e.reason||e};function handleMessage(e){try{if(e.data.cmd==="load"){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=(...args)=>{postMessage({cmd:"callHandler",handler:handler,args:args})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}getUsdModule(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["__emscripten_thread_mailbox_await"](e.data.pthread_ptr);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){Module["__embind_initialize_bindings"]();initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="checkMailbox"){if(initializedJS){Module["checkMailbox"]()}}else if(e.data.cmd){err(`worker.js received unknown command ${e.data.cmd}`);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}}self.onmessage=handleMessage; diff --git a/web/threeVisualizer/external/index.js b/web/threeVisualizer/external/index.js new file mode 100644 index 0000000..7e737f7 --- /dev/null +++ b/web/threeVisualizer/external/index.js @@ -0,0 +1,112 @@ +import "./emHdBindings.js"; + +/** + * @type {Promise | null} + */ +let usd_module_promise = null; + + +/** + * @param {undefined | import("..").GetUsdModuleOptions} opts + */ +export async function getUsdModule(opts) { + + if (usd_module_promise) { + return usd_module_promise; + } + + + /** + * @type {import("..").getUsdModule} + */ + const getUsdModuleFn = globalThis["NEEDLE:USD:GET"]; + + if (!getUsdModuleFn) { + throw new Error("\"NEEDLE:USD:GET\" not found in globalThis - please modify \"emHdBindings.js\" and add: globalThis[\"NEEDLE:USD:GET\"] = getUsdModule;"); + } + + + // HACK for worker import: \"Cannot use import statement outside a module\"" + // https://github.com/vitejs/vite/issues/6979 + + // @ts-ignore + const isProd = import.meta.env?.PROD ?? true; + + + /** + * We use a async import here because otherwise sveltekit vite complains about unknown file extensions (e.g. .wasm) + */ + const bindingsPromise = await Promise.all([ + /** @ts-ignore */ + import(`./emHdBindings.js?url`), + /** @ts-ignore */ + import(`./emHdBindings.data?url`), + // https://v3.vitejs.dev/guide/features.html#web-workers + // https://github.com/vitejs/vite/issues/6979 + /** @ts-ignore */ + import(`./emHdBindings.worker.js?worker&url`), + /** @ts-ignore */ + import(`./emHdBindings.worker.js?url`), + /** @ts-ignore */ + import(`./emHdBindings.wasm?url`), + ]); + const [bindings, data, workerProd, workerDev, wasm] = bindingsPromise; + const worker = isProd ? workerProd : workerDev; + const preloaded_data = await fetch(data.default).then(r => r.arrayBuffer()); + + return usd_module_promise = getUsdModuleFn({ + mainScriptUrlOrBlob: bindings.default,// "./emHdBindings.js", + setStatus: (status) => { + console.debug("🧊 USD STATUS", status); + }, + ...opts, + locateFile: (file) => { + if (opts?.debug === true) console.warn("LOCATE FILE:", file) + + const userResult = opts?.locateFile?.(file); + if (userResult) { + return userResult; + } + + /** resolved filepath */ + let res = null; + + if (file.includes("emHdBindings.data")) { + res = data.default; + } + else if (file.includes("emHdBindings.wasm")) { + res = wasm.default; + } + else if (file.includes("emHdBindings.worker.js")) { + res = worker.default; + } + + // if (url?.startsWith("data:text/javascript;base64")) { + // // we're client side and Buffer and atob are not available + // // so we need to convert the base64 to a blob + // const base64 = url.split(",")[1]; + // const binary = atob(base64); + // const bytes = new Uint8Array(binary.length); + // for (let i = 0; i < binary.length; i++) { + // bytes[i] = binary.charCodeAt(i); + // } + + // } + + return res ?? file; + }, + getPreloadedPackage(name, size) { + const userResult = opts?.getPreloadedPackage?.(name, size); + if (userResult) return userResult; + + // For debugging if the data file isnt loaded or the size might be wrong + // Make sure to clear the vite cache. See https://linear.app/needle/issue/NE-4851#comment-2a9538e3 + if (name.includes("emHdBindings.data")) { + if (preloaded_data.byteLength !== size) { + throw new Error(`emHdBindings.data size mismatch: expected ${size} but got ${preloaded_data.byteLength}\n${data.default}`); + } + } + return null; + }, + }); +} \ No newline at end of file diff --git a/web/threeVisualizer/index.html b/web/threeVisualizer/index.html new file mode 100644 index 0000000..4c9fd5c --- /dev/null +++ b/web/threeVisualizer/index.html @@ -0,0 +1,13 @@ + + + + + + Vite + React + TS + + + + +
+ + diff --git a/web/visualization.js b/web/visualization.js new file mode 100644 index 0000000..d906230 --- /dev/null +++ b/web/visualization.js @@ -0,0 +1,302 @@ +import { app } from "/scripts/app.js" +import { api } from '/scripts/api.js'; + +class Visualizer { + constructor(node, container, visualSrc) { + this.node = node + + this.iframe = document.createElement('iframe') + Object.assign(this.iframe, { + scrolling: "no", + overflow: "hidden", + }) + if (visualSrc === 'threeVisualizer') { + // this.iframe.src = "//localhost:5173/extensions/ComfyUI-Rodin/threeVisualizer" + this.iframe.src = "/extensions/ComfyUI-Rodin/" + visualSrc + "/index.html" + } else { + this.iframe.src = "/extensions/ComfyUI-Rodin/html/" + visualSrc + ".html" + } + container.appendChild(this.iframe) + } + + updateVisual({ + model_path, shaded_path, diffuse_path, normal_path, pbr_path + }) { + this.iframe.contentWindow.postMessage({ + model_path, shaded_path, diffuse_path, normal_path, pbr_path + }, '*') + } + + remove() { + this.container.remove() + } +} + +function createVisualizer(node, inputName, typeName, inputData, app) { + node.name = inputName + + const widget = { + type: typeName, + name: "preview3d", + callback: () => {}, + draw : function(ctx, node, widgetWidth, widgetY, widgetHeight) { + const margin = 10 + const top_offset = 5 + const visible = app.canvas.ds.scale > 0.5 && this.type === typeName + const w = widgetWidth - margin * 4 + const clientRectBound = ctx.canvas.getBoundingClientRect() + const transform = new DOMMatrix() + .scaleSelf( + clientRectBound.width / ctx.canvas.width, + clientRectBound.height / ctx.canvas.height + ) + .multiplySelf(ctx.getTransform()) + .translateSelf(margin, margin + widgetY) + Object.assign(this.visualizer.style, { + left: `${transform.a * margin + transform.e}px`, + top: `${transform.d + transform.f + top_offset}px`, + width: `${(w * transform.a)}px`, + height: `${(w * transform.d - widgetHeight - (margin * 10) * transform.d)}px`, + position: "absolute", + overflow: "hidden", + zIndex: app.graph._nodes.indexOf(node), + }) + + Object.assign(this.visualizer.children[0].style, { + transformOrigin: "50% 50%", + width: '100%', + height: '100%', + border: '0 none', + }) + + this.visualizer.hidden = !visible + }, + } + + const container = document.createElement('div') + container.id = `Comfy3D_${inputName}` + + node.visualizer = new Visualizer(node, container, typeName) + widget.visualizer = container + widget.parent = node + + document.body.appendChild(widget.visualizer) + + node.addCustomWidget(widget) + + node.updateParameters = (params) => { + node.visualizer.updateVisual(params) + } + + // Events for drawing backgound + node.onDrawBackground = function (ctx) { + if (!this.flags.collapsed) { + node.visualizer.iframe.hidden = false + } else { + node.visualizer.iframe.hidden = true + } + } + + // Make sure visualization iframe is always inside the node when resize the node + node.onResize = function () { + let [w, h] = this.size + if (w <= 600) w = 600 + if (h <= 500) h = 500 + + if (w > 600) { + h = w - 100 + } + + this.size = [w, h] + } + + // Events for remove nodes + node.onRemoved = () => { + for (let w in node.widgets) { + if (node.widgets[w].visualizer) { + node.widgets[w].visualizer.remove() + } + } + } + + + return { + widget: widget, + } +} + +function registerVisualizer(nodeType, nodeData, nodeClassName, typeName){ + if (nodeData.name == nodeClassName) { + console.log("[3D Visualizer] Registering node: " + nodeData.name) + + const onNodeCreated = nodeType.prototype.onNodeCreated + + nodeType.prototype.onNodeCreated = async function() { + const r = onNodeCreated + ? onNodeCreated.apply(this, arguments) + : undefined + + let Preview3DNode = app.graph._nodes.filter( + (wi) => wi.type == nodeClassName + ) + let nodeName = `Preview3DNode_${nodeClassName}` + + console.log(`[Comfy3D] Create: ${nodeName}`) + + const result = await createVisualizer.apply(this, [this, nodeName, typeName, {}, app]) + + this.setSize([600, 500]) + + return r + } + + nodeType.prototype.onExecuted = async function(message) { + if (message?.previews) { + this.updateParameters(message.previews[0]) + } + } + } +} + +app.registerExtension({ + name: "Mr.ForExample.Visualizer.GS", + + async init (app) { + + }, + + async beforeRegisterNodeDef(nodeType, nodeData, app) { + registerVisualizer(nodeType, nodeData, "Preview_3DMesh", "threeVisualizer") + }, + + getCustomWidgets() { + return { + MODELUPLOAD(node, inputName, inputData, app) { + const ModelPathWidget = node.widgets.find( + (w) => w.name === (inputData[1]?.widget ?? 'model_path') + ) + let uploadWidget + + var default_value = ModelPathWidget.value + Object.defineProperty(ModelPathWidget, 'value', { + set: function (value) { + this._real_value = value + }, + + get: function () { + if (!this._real_value) { + return default_value + } + + let value = this._real_value + if (value.filename) { + let real_value = value + value = '' + if (real_value.subfolder) { + value = real_value.subfolder + '/' + } + + value += real_value.filename + + if (real_value.type && real_value.type !== 'input') + value += ` [${real_value.type}]` + } + return value + } + }) + + // @ts-expect-error + const cb = node.callback + ModelPathWidget.callback = function () { + if (cb) { + return cb.apply(this, arguments) + } + } + + + async function uploadFile(file, updateNode) { + try { + // Wrap file in formdata so it includes filename + const body = new FormData() + body.append('model', file) + const resp = await api.fetchApi('/upload/model', { + method: 'POST', + body + }) + + if (resp.status === 200) { + const data = await resp.json() + // Add the file to the dropdown list and update the widget value + let path = data.filepath + if (updateNode) { + ModelPathWidget.value = path + } + } else { + console.error((resp.status + ' - ' + resp.statusText)); + + } + } catch (error) { + console.error(error) + } + } + + // const fileInput = document.createElement('input') + // Object.assign(fileInput, { + // type: 'file', + // accept: 'model/obj,model/stl,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip', + // style: 'display: none', + // onchange: async () => { + // if (fileInput.files.length) { + // await uploadFile(fileInput.files[0], true) + // } + // } + // }) + // document.body.append(fileInput) + + // Create the button widget for selecting the files + uploadWidget = node.addWidget('button', inputName, 'model', () => { + fileInput.click() + }) + uploadWidget.label = 'choose file to upload' + uploadWidget.serialize = false + + // Add handler to check if an image is being dragged over our node + // @ts-expect-error + node.onDragOver = function (e) { + if (e.dataTransfer && e.dataTransfer.items) { + const model = [...e.dataTransfer.items].find((f) => f.kind === 'file') + return !!model + } + + return false + } + + // On drop upload files + // @ts-expect-error + node.onDragDrop = function (e) { + console.log('onDragDrop called') + let handled = false + for (const file of e.dataTransfer.files) { + if (file.name.endsWith('.glb')) { + uploadFile(file, !handled) // Dont await these, any order is fine, only update on first one + handled = true + } + } + + return handled + } + + // @ts-expect-error + node.pasteFile = function (file) { + if (file.type.startsWith('model/')) { + uploadFile(file, true) + return true + } + return false + } + + return { widget: uploadWidget } + } + } + } +}) \ No newline at end of file diff --git a/webserver/__pycache__/server.cpython-311.pyc b/webserver/__pycache__/server.cpython-311.pyc new file mode 100644 index 0000000..f092e97 Binary files /dev/null and b/webserver/__pycache__/server.cpython-311.pyc differ diff --git a/webserver/server.py b/webserver/server.py new file mode 100644 index 0000000..498af57 --- /dev/null +++ b/webserver/server.py @@ -0,0 +1,137 @@ +import server +import folder_paths as comfy_paths +import os +import node_helpers +from ..shared_utils.log_utils import cstr + +ROOT_PATH = os.path.join(comfy_paths.get_folder_paths("custom_nodes")[0], "ComfyUI-Rodin") + +web = server.web + +SUPPORTED_VIEW_EXTENSIONS = ( + '.png', + '.jpg', + '.jpeg ', + '.mtl', + '.obj', + '.glb', + '.ply', + '.splat', + '.fbx', + '.stl', + '.usdz' +) + + +web_conf = None + +def set_web_conf(new_web_conf): + global web_conf + web_conf = new_web_conf + +def create_cors_middleware(): + @web.middleware + async def cors_middleware(request: web.Request, handler): + if request.method == "OPTIONS": + # Pre-flight request. Reply successfully: + response = web.Response() + else: + response = await handler(request) + + response.headers["Cross-Origin-Embedder-Policy"] = "require-corp" + response.headers["Cross-Origin-Opener-Policy"] = "same-origin" + return response + + return cors_middleware + +@server.PromptServer.instance.routes.get("/viewfile") +async def view_file(request): + query = request.rel_url.query + # Security check to see if query client is local + if request.remote in web_conf['clients_ip'] and "filepath" in query: + filepath = query["filepath"] + + cstr(f"[Server Query view_file] Get file {filepath}").msg.print() + + if filepath.lower().endswith(SUPPORTED_VIEW_EXTENSIONS) and os.path.exists(filepath): + return web.FileResponse(filepath) + + return web.Response(status=404) + +def get_dir_by_type(dir_type): + if dir_type is None: + dir_type = "input" + + if dir_type == "input": + type_dir = comfy_paths.get_input_directory() + elif dir_type == "temp": + type_dir = comfy_paths.get_temp_directory() + elif dir_type == "output": + type_dir = comfy_paths.get_output_directory() + + return type_dir, dir_type + +def compare_model_hash(filepath, image): + hasher = node_helpers.hasher() + + # function to compare hashes of two images to see if it already exists, fix to #3465 + if os.path.exists(filepath): + a = hasher() + b = hasher() + with open(filepath, "rb") as f: + a.update(f.read()) + b.update(image.file.read()) + image.file.seek(0) + f.close() + return a.hexdigest() == b.hexdigest() + return False + +def model_upload(post): + model = post.get("model") + overwrite = post.get("overwrite") + model_is_duplicate = False + + model_upload_type = post.get("type") + upload_dir, model_upload_type = get_dir_by_type(model_upload_type) + + if model and model.file: + filename = model.filename + if not filename: + return web.Response(status=400) + + subfolder = post.get("subfolder", "") + full_output_folder = os.path.join(upload_dir, os.path.normpath(subfolder)) + filepath = os.path.abspath(os.path.join(full_output_folder, filename)) + + if os.path.commonpath((upload_dir, filepath)) != upload_dir: + return web.Response(status=400) + + if not os.path.exists(full_output_folder): + os.makedirs(full_output_folder) + + split = os.path.splitext(filename) + + if overwrite is not None and (overwrite == "true" or overwrite == "1"): + pass + else: + i = 1 + while os.path.exists(filepath): + if compare_model_hash(filepath, model): #compare hash to prevent saving of duplicates with same name, fix for #3465 + model_is_duplicate = True + break + filename = f"{split[0]} ({i}){split[1]}" + filepath = os.path.join(full_output_folder, filename) + i += 1 + + if not model_is_duplicate: + with open(filepath, "wb") as f: + f.write(model.file.read()) + + return web.json_response({"name" : filename, "filepath": filepath}) + else: + return web.Response(status=400) + +@server.PromptServer.instance.routes.post("/upload/model") +async def upload_model(request): + post = await request.post() + return model_upload(post) \ No newline at end of file