expxagents 0.24.2 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/src/commands/info.d.ts +1 -2
- package/dist/cli/src/commands/login.d.ts +1 -2
- package/dist/cli/src/commands/logout.d.ts +1 -2
- package/dist/cli/src/commands/outdated.d.ts +1 -2
- package/dist/cli/src/commands/publish.d.ts +1 -2
- package/dist/cli/src/commands/registry-install.d.ts +1 -2
- package/dist/cli/src/commands/search.d.ts +1 -2
- package/dist/cli/src/commands/update.d.ts +1 -2
- package/dist/cli/src/commands/whoami.d.ts +1 -2
- package/package.json +1 -1
- package/assets/agents/_catalog.yaml +0 -35
- package/assets/agents/accounting/accountant.agent.md +0 -41
- package/assets/agents/accounting/audit-analyst.agent.md +0 -41
- package/assets/agents/accounting/financial-reporting.agent.md +0 -41
- package/assets/agents/accounting/fiscal-analyst.agent.md +0 -41
- package/assets/agents/accounting/payroll-specialist.agent.md +0 -41
- package/assets/agents/accounting/tax-compliance.agent.md +0 -41
- package/assets/agents/administrative/document-controller.agent.md +0 -41
- package/assets/agents/administrative/office-manager.agent.md +0 -41
- package/assets/agents/administrative/process-documentation-officer.agent.md +0 -41
- package/assets/agents/administrative/procurement-specialist.agent.md +0 -41
- package/assets/agents/board/board-report-writer.agent.md +0 -41
- package/assets/agents/board/business-intelligence.agent.md +0 -41
- package/assets/agents/board/governance-officer.agent.md +0 -41
- package/assets/agents/board/okr-manager.agent.md +0 -41
- package/assets/agents/board/risk-analyst.agent.md +0 -41
- package/assets/agents/board/strategic-advisor.agent.md +0 -41
- package/assets/agents/commercial/account-executive.agent.md +0 -41
- package/assets/agents/commercial/crm-manager.agent.md +0 -41
- package/assets/agents/commercial/pricing-strategist.agent.md +0 -41
- package/assets/agents/commercial/proposal-writer.agent.md +0 -41
- package/assets/agents/commercial/sdr.agent.md +0 -41
- package/assets/agents/compliance/compliance-officer.agent.md +0 -41
- package/assets/agents/compliance/data-privacy-specialist.agent.md +0 -41
- package/assets/agents/compliance/internal-auditor.agent.md +0 -41
- package/assets/agents/compliance/regulatory-monitor.agent.md +0 -41
- package/assets/agents/customer-success/churn-prevention.agent.md +0 -41
- package/assets/agents/customer-success/csm.agent.md +0 -41
- package/assets/agents/customer-success/expansion-manager.agent.md +0 -41
- package/assets/agents/customer-success/nps-analyst.agent.md +0 -41
- package/assets/agents/customer-success/renewal-manager.agent.md +0 -41
- package/assets/agents/development/android-developer.agent.md +0 -41
- package/assets/agents/development/backend-developer.agent.md +0 -42
- package/assets/agents/development/business-analyst.agent.md +0 -41
- package/assets/agents/development/code-reviewer.agent.md +0 -41
- package/assets/agents/development/cross-platform-mobile.agent.md +0 -41
- package/assets/agents/development/dba.agent.md +0 -41
- package/assets/agents/development/desktop-developer.agent.md +0 -41
- package/assets/agents/development/devops-engineer.agent.md +0 -41
- package/assets/agents/development/frontend-developer.agent.md +0 -103
- package/assets/agents/development/ios-developer.agent.md +0 -41
- package/assets/agents/development/product-manager.agent.md +0 -41
- package/assets/agents/development/qa-engineer.agent.md +0 -41
- package/assets/agents/development/scrum-master.agent.md +0 -41
- package/assets/agents/development/security-analyst.agent.md +0 -41
- package/assets/agents/development/tech-lead.agent.md +0 -42
- package/assets/agents/development/tech-writer.agent.md +0 -41
- package/assets/agents/development/ux-design-expert.agent.md +0 -108
- package/assets/agents/development/ux-designer.agent.md +0 -41
- package/assets/agents/finance/accounts-manager.agent.md +0 -41
- package/assets/agents/finance/billing-analyst.agent.md +0 -41
- package/assets/agents/finance/budget-planner.agent.md +0 -41
- package/assets/agents/finance/financial-controller.agent.md +0 -41
- package/assets/agents/hr/benefits-manager.agent.md +0 -41
- package/assets/agents/hr/hr-onboarding.agent.md +0 -41
- package/assets/agents/hr/interview-coordinator.agent.md +0 -41
- package/assets/agents/hr/people-culture.agent.md +0 -41
- package/assets/agents/hr/performance-analyst.agent.md +0 -41
- package/assets/agents/hr/recruiter.agent.md +0 -41
- package/assets/agents/implantation/deployment-manager.agent.md +0 -41
- package/assets/agents/implantation/environment-specialist.agent.md +0 -41
- package/assets/agents/implantation/go-live-coordinator.agent.md +0 -41
- package/assets/agents/implantation/integration-specialist.agent.md +0 -41
- package/assets/agents/implantation/migration-specialist.agent.md +0 -41
- package/assets/agents/legal/contract-manager.agent.md +0 -41
- package/assets/agents/legal/ip-specialist.agent.md +0 -41
- package/assets/agents/legal/labor-attorney.agent.md +0 -41
- package/assets/agents/legal/legal-counsel.agent.md +0 -41
- package/assets/agents/marketing/brand-guardian.agent.md +0 -40
- package/assets/agents/marketing/content-creator.agent.md +0 -41
- package/assets/agents/marketing/email-marketing.agent.md +0 -41
- package/assets/agents/marketing/landing-page-builder.agent.md +0 -138
- package/assets/agents/marketing/marketing-analyst.agent.md +0 -41
- package/assets/agents/marketing/paid-ads-manager.agent.md +0 -41
- package/assets/agents/marketing/seo-specialist.agent.md +0 -41
- package/assets/agents/marketing/social-media-manager.agent.md +0 -41
- package/assets/agents/rnd/benchmark-analyst.agent.md +0 -41
- package/assets/agents/rnd/innovation-scout.agent.md +0 -41
- package/assets/agents/rnd/market-researcher.agent.md +0 -41
- package/assets/agents/rnd/product-analyst.agent.md +0 -41
- package/assets/agents/rnd/prototype-builder.agent.md +0 -41
- package/assets/agents/support/knowledge-base-manager.agent.md +0 -41
- package/assets/agents/support/l1-support.agent.md +0 -41
- package/assets/agents/support/l2-support.agent.md +0 -41
- package/assets/agents/support/l3-support.agent.md +0 -41
- package/assets/agents/support/sla-monitor.agent.md +0 -41
- package/assets/agents/training/assessment-creator.agent.md +0 -41
- package/assets/agents/training/onboarding-coach.agent.md +0 -41
- package/assets/agents/training/training-designer.agent.md +0 -41
- package/assets/agents/training/workshop-facilitator.agent.md +0 -41
- package/assets/core/best-practices/_catalog.yaml +0 -91
- package/assets/core/best-practices/api-documentation.md +0 -137
- package/assets/core/best-practices/blog-post.md +0 -86
- package/assets/core/best-practices/blog-seo.md +0 -91
- package/assets/core/best-practices/code-review.md +0 -97
- package/assets/core/best-practices/copywriting.md +0 -75
- package/assets/core/best-practices/data-analysis.md +0 -93
- package/assets/core/best-practices/deploy-checklist.md +0 -99
- package/assets/core/best-practices/email-newsletter.md +0 -84
- package/assets/core/best-practices/email-sales.md +0 -91
- package/assets/core/best-practices/fullstack-page-generation.md +0 -936
- package/assets/core/best-practices/image-design.md +0 -78
- package/assets/core/best-practices/instagram-feed.md +0 -70
- package/assets/core/best-practices/instagram-reels.md +0 -75
- package/assets/core/best-practices/instagram-stories.md +0 -68
- package/assets/core/best-practices/landing-page-react.md +0 -2263
- package/assets/core/best-practices/landing-page.md +0 -279
- package/assets/core/best-practices/linkedin-article.md +0 -83
- package/assets/core/best-practices/linkedin-post.md +0 -84
- package/assets/core/best-practices/researching.md +0 -89
- package/assets/core/best-practices/review.md +0 -95
- package/assets/core/best-practices/sprint-planning.md +0 -91
- package/assets/core/best-practices/strategist.md +0 -95
- package/assets/core/best-practices/technical-writing.md +0 -104
- package/assets/core/best-practices/twitter-post.md +0 -75
- package/assets/core/best-practices/twitter-thread.md +0 -92
- package/assets/core/best-practices/whatsapp-broadcast.md +0 -95
- package/assets/core/best-practices/youtube-script.md +0 -80
- package/assets/core/best-practices/youtube-shorts.md +0 -76
- package/assets/core/prompts/insight-hunter.prompt.md +0 -62
- package/assets/core/runner.pipeline.md +0 -200
- package/assets/core/skills.engine.md +0 -65
- package/assets/core/solution-architect.agent.md +0 -329
- package/assets/mcps/_catalog.yaml +0 -17
- package/assets/mcps/figma.mcp.yaml +0 -35
- package/assets/mcps/github.mcp.yaml +0 -44
- package/assets/mcps/linear.mcp.yaml +0 -37
- package/assets/mcps/notion.mcp.yaml +0 -37
- package/assets/mcps/pencil.mcp.yaml +0 -32
- package/assets/mcps/postgresql.mcp.yaml +0 -39
- package/assets/mcps/sentry.mcp.yaml +0 -41
- package/assets/mcps/slack.mcp.yaml +0 -37
- package/assets/mcps/vercel.mcp.yaml +0 -39
- package/assets/templates/_expxagents/_memory/company.md +0 -25
- package/assets/templates/_expxagents/_memory/preferences.md +0 -6
- package/assets/templates/squads/_memory/memories.md +0 -16
- package/dist/cli/src/__tests__/cli.test.d.ts +0 -1
- package/dist/cli/src/__tests__/cli.test.js +0 -23
- package/dist/cli/src/commands/__tests__/outdated.test.d.ts +0 -1
- package/dist/cli/src/commands/__tests__/outdated.test.js +0 -76
- package/dist/cli/src/mcp/__tests__/catalog.test.d.ts +0 -1
- package/dist/cli/src/mcp/__tests__/catalog.test.js +0 -101
- package/dist/cli/src/mcp/__tests__/detect.test.d.ts +0 -1
- package/dist/cli/src/mcp/__tests__/detect.test.js +0 -84
- package/dist/cli/src/mcp/__tests__/setup.test.d.ts +0 -1
- package/dist/cli/src/mcp/__tests__/setup.test.js +0 -75
- package/dist/cli/src/mcp/__tests__/validate.test.d.ts +0 -1
- package/dist/cli/src/mcp/__tests__/validate.test.js +0 -42
- package/dist/cli/src/pencil/__tests__/detect.test.d.ts +0 -1
- package/dist/cli/src/pencil/__tests__/detect.test.js +0 -71
- package/dist/cli/src/pencil/__tests__/property-mapper.test.d.ts +0 -1
- package/dist/cli/src/pencil/__tests__/property-mapper.test.js +0 -120
- package/dist/cli/src/pencil/__tests__/template-sync.test.d.ts +0 -1
- package/dist/cli/src/pencil/__tests__/template-sync.test.js +0 -95
- package/dist/cli/src/runners/__tests__/provider-registry.test.d.ts +0 -1
- package/dist/cli/src/runners/__tests__/provider-registry.test.js +0 -31
- package/dist/cli/src/runners/__tests__/provider-runner.test.d.ts +0 -1
- package/dist/cli/src/runners/__tests__/provider-runner.test.js +0 -86
- package/dist/cli/src/utils/__tests__/command-prefix.test.d.ts +0 -1
- package/dist/cli/src/utils/__tests__/command-prefix.test.js +0 -35
- package/dist/cli/src/utils/__tests__/global-install.test.d.ts +0 -1
- package/dist/cli/src/utils/__tests__/global-install.test.js +0 -25
- package/dist/dashboard/assets/BufferResource-RMf3hLtL.js +0 -185
- package/dist/dashboard/assets/CanvasRenderer-By9CeUeH.js +0 -1
- package/dist/dashboard/assets/JarvisView-DCkJVL5f.js +0 -1
- package/dist/dashboard/assets/RenderTargetSystem-Du3lfljq.js +0 -172
- package/dist/dashboard/assets/ThreeBackground-m9EgwJVc.js +0 -1
- package/dist/dashboard/assets/WebGLRenderer-BfDYJhYQ.js +0 -156
- package/dist/dashboard/assets/WebGPURenderer-CYzaDyV_.js +0 -41
- package/dist/dashboard/assets/browserAll-CFQKTPw8.js +0 -14
- package/dist/dashboard/assets/index-DPwnElYV.js +0 -1195
- package/dist/dashboard/assets/index-DtbIzZ5n.css +0 -1
- package/dist/dashboard/assets/three-BZk_I9Ly.js +0 -4057
- package/dist/dashboard/assets/webworkerAll-Cti2tnMb.js +0 -83
- package/dist/dashboard/index.html +0 -13
- package/dist/data/opensquad.db +0 -0
- package/dist/data/opensquad.db-shm +0 -0
- package/dist/data/opensquad.db-wal +0 -0
- package/dist/server/api/__tests__/cost-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/cost-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/cost-routes.test.js +0 -54
- package/dist/server/api/__tests__/cost-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/files-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/files-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/files-routes.test.js +0 -85
- package/dist/server/api/__tests__/files-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/graph-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/graph-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/graph-routes.test.js +0 -105
- package/dist/server/api/__tests__/graph-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/health-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/health-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/health-routes.test.js +0 -22
- package/dist/server/api/__tests__/health-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/integration-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/integration-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/integration-routes.test.js +0 -243
- package/dist/server/api/__tests__/integration-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/kanban-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/kanban-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/kanban-routes.test.js +0 -316
- package/dist/server/api/__tests__/kanban-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/log-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/log-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/log-routes.test.js +0 -35
- package/dist/server/api/__tests__/log-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/orgchart-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/orgchart-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/orgchart-routes.test.js +0 -161
- package/dist/server/api/__tests__/orgchart-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/settings-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/settings-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/settings-routes.test.js +0 -177
- package/dist/server/api/__tests__/settings-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/system-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/system-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/system-routes.test.js +0 -79
- package/dist/server/api/__tests__/system-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/team-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/team-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/team-routes.test.js +0 -116
- package/dist/server/api/__tests__/team-routes.test.js.map +0 -1
- package/dist/server/api/__tests__/webhook-routes.test.d.ts +0 -2
- package/dist/server/api/__tests__/webhook-routes.test.d.ts.map +0 -1
- package/dist/server/api/__tests__/webhook-routes.test.js +0 -111
- package/dist/server/api/__tests__/webhook-routes.test.js.map +0 -1
- package/dist/server/api/activity-routes.d.ts +0 -8
- package/dist/server/api/activity-routes.d.ts.map +0 -1
- package/dist/server/api/activity-routes.js +0 -34
- package/dist/server/api/activity-routes.js.map +0 -1
- package/dist/server/api/chat-api-routes.d.ts +0 -4
- package/dist/server/api/chat-api-routes.d.ts.map +0 -1
- package/dist/server/api/chat-api-routes.js +0 -28
- package/dist/server/api/chat-api-routes.js.map +0 -1
- package/dist/server/api/cost-routes.d.ts +0 -8
- package/dist/server/api/cost-routes.d.ts.map +0 -1
- package/dist/server/api/cost-routes.js +0 -39
- package/dist/server/api/cost-routes.js.map +0 -1
- package/dist/server/api/dashboard-routes.d.ts +0 -10
- package/dist/server/api/dashboard-routes.d.ts.map +0 -1
- package/dist/server/api/dashboard-routes.js +0 -128
- package/dist/server/api/dashboard-routes.js.map +0 -1
- package/dist/server/api/files-routes.d.ts +0 -5
- package/dist/server/api/files-routes.d.ts.map +0 -1
- package/dist/server/api/files-routes.js +0 -218
- package/dist/server/api/files-routes.js.map +0 -1
- package/dist/server/api/graph-routes.d.ts +0 -24
- package/dist/server/api/graph-routes.d.ts.map +0 -1
- package/dist/server/api/graph-routes.js +0 -208
- package/dist/server/api/graph-routes.js.map +0 -1
- package/dist/server/api/health-routes.d.ts +0 -9
- package/dist/server/api/health-routes.d.ts.map +0 -1
- package/dist/server/api/health-routes.js +0 -46
- package/dist/server/api/health-routes.js.map +0 -1
- package/dist/server/api/integration-routes.d.ts +0 -23
- package/dist/server/api/integration-routes.d.ts.map +0 -1
- package/dist/server/api/integration-routes.js +0 -326
- package/dist/server/api/integration-routes.js.map +0 -1
- package/dist/server/api/kanban-routes.d.ts +0 -8
- package/dist/server/api/kanban-routes.d.ts.map +0 -1
- package/dist/server/api/kanban-routes.js +0 -128
- package/dist/server/api/kanban-routes.js.map +0 -1
- package/dist/server/api/knowledge-routes.d.ts +0 -8
- package/dist/server/api/knowledge-routes.d.ts.map +0 -1
- package/dist/server/api/knowledge-routes.js +0 -82
- package/dist/server/api/knowledge-routes.js.map +0 -1
- package/dist/server/api/log-routes.d.ts +0 -8
- package/dist/server/api/log-routes.d.ts.map +0 -1
- package/dist/server/api/log-routes.js +0 -31
- package/dist/server/api/log-routes.js.map +0 -1
- package/dist/server/api/orgchart-routes.d.ts +0 -7
- package/dist/server/api/orgchart-routes.d.ts.map +0 -1
- package/dist/server/api/orgchart-routes.js +0 -154
- package/dist/server/api/orgchart-routes.js.map +0 -1
- package/dist/server/api/registry-routes.d.ts +0 -7
- package/dist/server/api/registry-routes.d.ts.map +0 -1
- package/dist/server/api/registry-routes.js +0 -51
- package/dist/server/api/registry-routes.js.map +0 -1
- package/dist/server/api/settings-routes.d.ts +0 -11
- package/dist/server/api/settings-routes.d.ts.map +0 -1
- package/dist/server/api/settings-routes.js +0 -167
- package/dist/server/api/settings-routes.js.map +0 -1
- package/dist/server/api/squads-routes.d.ts +0 -7
- package/dist/server/api/squads-routes.d.ts.map +0 -1
- package/dist/server/api/squads-routes.js +0 -165
- package/dist/server/api/squads-routes.js.map +0 -1
- package/dist/server/api/system-routes.d.ts +0 -9
- package/dist/server/api/system-routes.d.ts.map +0 -1
- package/dist/server/api/system-routes.js +0 -241
- package/dist/server/api/system-routes.js.map +0 -1
- package/dist/server/api/team-routes.d.ts +0 -8
- package/dist/server/api/team-routes.d.ts.map +0 -1
- package/dist/server/api/team-routes.js +0 -55
- package/dist/server/api/team-routes.js.map +0 -1
- package/dist/server/api/users-routes.d.ts +0 -8
- package/dist/server/api/users-routes.d.ts.map +0 -1
- package/dist/server/api/users-routes.js +0 -65
- package/dist/server/api/users-routes.js.map +0 -1
- package/dist/server/api/webhook-routes.d.ts +0 -9
- package/dist/server/api/webhook-routes.d.ts.map +0 -1
- package/dist/server/api/webhook-routes.js +0 -82
- package/dist/server/api/webhook-routes.js.map +0 -1
- package/dist/server/app.d.ts +0 -9
- package/dist/server/app.d.ts.map +0 -1
- package/dist/server/app.js +0 -263
- package/dist/server/app.js.map +0 -1
- package/dist/server/auth/auth-middleware.d.ts +0 -13
- package/dist/server/auth/auth-middleware.d.ts.map +0 -1
- package/dist/server/auth/auth-middleware.js +0 -25
- package/dist/server/auth/auth-middleware.js.map +0 -1
- package/dist/server/auth/auth-routes.d.ts +0 -9
- package/dist/server/auth/auth-routes.d.ts.map +0 -1
- package/dist/server/auth/auth-routes.js +0 -149
- package/dist/server/auth/auth-routes.js.map +0 -1
- package/dist/server/auth/jwt.d.ts +0 -14
- package/dist/server/auth/jwt.d.ts.map +0 -1
- package/dist/server/auth/jwt.js +0 -16
- package/dist/server/auth/jwt.js.map +0 -1
- package/dist/server/auth/password.d.ts +0 -3
- package/dist/server/auth/password.d.ts.map +0 -1
- package/dist/server/auth/password.js +0 -9
- package/dist/server/auth/password.js.map +0 -1
- package/dist/server/bridge/__tests__/chat-handler.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/chat-handler.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/chat-handler.test.js +0 -143
- package/dist/server/bridge/__tests__/chat-handler.test.js.map +0 -1
- package/dist/server/bridge/__tests__/chat-integration.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/chat-integration.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/chat-integration.test.js +0 -129
- package/dist/server/bridge/__tests__/chat-integration.test.js.map +0 -1
- package/dist/server/bridge/__tests__/claude-bridge.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/claude-bridge.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/claude-bridge.test.js +0 -300
- package/dist/server/bridge/__tests__/claude-bridge.test.js.map +0 -1
- package/dist/server/bridge/__tests__/conversation.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/conversation.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/conversation.test.js +0 -168
- package/dist/server/bridge/__tests__/conversation.test.js.map +0 -1
- package/dist/server/bridge/__tests__/registry.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/registry.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/registry.test.js +0 -45
- package/dist/server/bridge/__tests__/registry.test.js.map +0 -1
- package/dist/server/bridge/__tests__/stream-parser.test.d.ts +0 -2
- package/dist/server/bridge/__tests__/stream-parser.test.d.ts.map +0 -1
- package/dist/server/bridge/__tests__/stream-parser.test.js +0 -66
- package/dist/server/bridge/__tests__/stream-parser.test.js.map +0 -1
- package/dist/server/bridge/chat-handler.d.ts +0 -32
- package/dist/server/bridge/chat-handler.d.ts.map +0 -1
- package/dist/server/bridge/chat-handler.js +0 -356
- package/dist/server/bridge/chat-handler.js.map +0 -1
- package/dist/server/bridge/claude-bridge.d.ts +0 -21
- package/dist/server/bridge/claude-bridge.d.ts.map +0 -1
- package/dist/server/bridge/claude-bridge.js +0 -273
- package/dist/server/bridge/claude-bridge.js.map +0 -1
- package/dist/server/bridge/conversation.d.ts +0 -45
- package/dist/server/bridge/conversation.d.ts.map +0 -1
- package/dist/server/bridge/conversation.js +0 -78
- package/dist/server/bridge/conversation.js.map +0 -1
- package/dist/server/bridge/engine-manager.d.ts +0 -13
- package/dist/server/bridge/engine-manager.d.ts.map +0 -1
- package/dist/server/bridge/engine-manager.js +0 -54
- package/dist/server/bridge/engine-manager.js.map +0 -1
- package/dist/server/bridge/engine.d.ts +0 -37
- package/dist/server/bridge/engine.d.ts.map +0 -1
- package/dist/server/bridge/engine.js +0 -2
- package/dist/server/bridge/engine.js.map +0 -1
- package/dist/server/bridge/factory.d.ts +0 -4
- package/dist/server/bridge/factory.d.ts.map +0 -1
- package/dist/server/bridge/factory.js +0 -18
- package/dist/server/bridge/factory.js.map +0 -1
- package/dist/server/bridge/opencode-bridge.d.ts +0 -27
- package/dist/server/bridge/opencode-bridge.d.ts.map +0 -1
- package/dist/server/bridge/opencode-bridge.js +0 -163
- package/dist/server/bridge/opencode-bridge.js.map +0 -1
- package/dist/server/bridge/registry.d.ts +0 -19
- package/dist/server/bridge/registry.d.ts.map +0 -1
- package/dist/server/bridge/registry.js +0 -29
- package/dist/server/bridge/registry.js.map +0 -1
- package/dist/server/bridge/session-journal.d.ts +0 -25
- package/dist/server/bridge/session-journal.d.ts.map +0 -1
- package/dist/server/bridge/session-journal.js +0 -69
- package/dist/server/bridge/session-journal.js.map +0 -1
- package/dist/server/bridge/stream-parser.d.ts +0 -14
- package/dist/server/bridge/stream-parser.d.ts.map +0 -1
- package/dist/server/bridge/stream-parser.js +0 -26
- package/dist/server/bridge/stream-parser.js.map +0 -1
- package/dist/server/config/engine-config.d.ts +0 -4
- package/dist/server/config/engine-config.d.ts.map +0 -1
- package/dist/server/config/engine-config.js +0 -24
- package/dist/server/config/engine-config.js.map +0 -1
- package/dist/server/config.d.ts +0 -17
- package/dist/server/config.d.ts.map +0 -1
- package/dist/server/config.js +0 -39
- package/dist/server/config.js.map +0 -1
- package/dist/server/db/__tests__/chat-tables.test.d.ts +0 -2
- package/dist/server/db/__tests__/chat-tables.test.d.ts.map +0 -1
- package/dist/server/db/__tests__/chat-tables.test.js +0 -82
- package/dist/server/db/__tests__/chat-tables.test.js.map +0 -1
- package/dist/server/db/__tests__/email-schema.test.d.ts +0 -2
- package/dist/server/db/__tests__/email-schema.test.d.ts.map +0 -1
- package/dist/server/db/__tests__/email-schema.test.js +0 -53
- package/dist/server/db/__tests__/email-schema.test.js.map +0 -1
- package/dist/server/db/__tests__/scheduler-schema.test.d.ts +0 -2
- package/dist/server/db/__tests__/scheduler-schema.test.d.ts.map +0 -1
- package/dist/server/db/__tests__/scheduler-schema.test.js +0 -52
- package/dist/server/db/__tests__/scheduler-schema.test.js.map +0 -1
- package/dist/server/db/connection.d.ts +0 -4
- package/dist/server/db/connection.d.ts.map +0 -1
- package/dist/server/db/connection.js +0 -40
- package/dist/server/db/connection.js.map +0 -1
- package/dist/server/db/migrations.d.ts +0 -4
- package/dist/server/db/migrations.d.ts.map +0 -1
- package/dist/server/db/migrations.js +0 -47
- package/dist/server/db/migrations.js.map +0 -1
- package/dist/server/db/schema.d.ts +0 -2
- package/dist/server/db/schema.d.ts.map +0 -1
- package/dist/server/db/schema.js +0 -276
- package/dist/server/db/schema.js.map +0 -1
- package/dist/server/email/__tests__/campaign-routes.test.d.ts +0 -2
- package/dist/server/email/__tests__/campaign-routes.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/campaign-routes.test.js +0 -216
- package/dist/server/email/__tests__/campaign-routes.test.js.map +0 -1
- package/dist/server/email/__tests__/campaign-service.test.d.ts +0 -2
- package/dist/server/email/__tests__/campaign-service.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/campaign-service.test.js +0 -79
- package/dist/server/email/__tests__/campaign-service.test.js.map +0 -1
- package/dist/server/email/__tests__/email-queue-worker.test.d.ts +0 -2
- package/dist/server/email/__tests__/email-queue-worker.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/email-queue-worker.test.js +0 -93
- package/dist/server/email/__tests__/email-queue-worker.test.js.map +0 -1
- package/dist/server/email/__tests__/email-utils.test.d.ts +0 -2
- package/dist/server/email/__tests__/email-utils.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/email-utils.test.js +0 -36
- package/dist/server/email/__tests__/email-utils.test.js.map +0 -1
- package/dist/server/email/__tests__/lead-routes.test.d.ts +0 -2
- package/dist/server/email/__tests__/lead-routes.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/lead-routes.test.js +0 -180
- package/dist/server/email/__tests__/lead-routes.test.js.map +0 -1
- package/dist/server/email/__tests__/lead-service.test.d.ts +0 -2
- package/dist/server/email/__tests__/lead-service.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/lead-service.test.js +0 -113
- package/dist/server/email/__tests__/lead-service.test.js.map +0 -1
- package/dist/server/email/__tests__/ses-client.test.d.ts +0 -2
- package/dist/server/email/__tests__/ses-client.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/ses-client.test.js +0 -48
- package/dist/server/email/__tests__/ses-client.test.js.map +0 -1
- package/dist/server/email/__tests__/sns-webhook.test.d.ts +0 -2
- package/dist/server/email/__tests__/sns-webhook.test.d.ts.map +0 -1
- package/dist/server/email/__tests__/sns-webhook.test.js +0 -40
- package/dist/server/email/__tests__/sns-webhook.test.js.map +0 -1
- package/dist/server/email/campaign-routes.d.ts +0 -8
- package/dist/server/email/campaign-routes.d.ts.map +0 -1
- package/dist/server/email/campaign-routes.js +0 -65
- package/dist/server/email/campaign-routes.js.map +0 -1
- package/dist/server/email/campaign-service.d.ts +0 -55
- package/dist/server/email/campaign-service.d.ts.map +0 -1
- package/dist/server/email/campaign-service.js +0 -89
- package/dist/server/email/campaign-service.js.map +0 -1
- package/dist/server/email/email-queue-worker.d.ts +0 -27
- package/dist/server/email/email-queue-worker.d.ts.map +0 -1
- package/dist/server/email/email-queue-worker.js +0 -119
- package/dist/server/email/email-queue-worker.js.map +0 -1
- package/dist/server/email/email-utils.d.ts +0 -5
- package/dist/server/email/email-utils.d.ts.map +0 -1
- package/dist/server/email/email-utils.js +0 -24
- package/dist/server/email/email-utils.js.map +0 -1
- package/dist/server/email/lead-routes.d.ts +0 -8
- package/dist/server/email/lead-routes.d.ts.map +0 -1
- package/dist/server/email/lead-routes.js +0 -56
- package/dist/server/email/lead-routes.js.map +0 -1
- package/dist/server/email/lead-service.d.ts +0 -66
- package/dist/server/email/lead-service.d.ts.map +0 -1
- package/dist/server/email/lead-service.js +0 -138
- package/dist/server/email/lead-service.js.map +0 -1
- package/dist/server/email/ses-client.d.ts +0 -27
- package/dist/server/email/ses-client.d.ts.map +0 -1
- package/dist/server/email/ses-client.js +0 -44
- package/dist/server/email/ses-client.js.map +0 -1
- package/dist/server/email/sns-webhook.d.ts +0 -10
- package/dist/server/email/sns-webhook.d.ts.map +0 -1
- package/dist/server/email/sns-webhook.js +0 -73
- package/dist/server/email/sns-webhook.js.map +0 -1
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -36
- package/dist/server/index.js.map +0 -1
- package/dist/server/mcp/expxagents-mcp.d.ts +0 -2
- package/dist/server/mcp/expxagents-mcp.d.ts.map +0 -1
- package/dist/server/mcp/expxagents-mcp.js +0 -230
- package/dist/server/mcp/expxagents-mcp.js.map +0 -1
- package/dist/server/routes/__tests__/conversations.test.d.ts +0 -2
- package/dist/server/routes/__tests__/conversations.test.d.ts.map +0 -1
- package/dist/server/routes/__tests__/conversations.test.js +0 -111
- package/dist/server/routes/__tests__/conversations.test.js.map +0 -1
- package/dist/server/routes/conversations.d.ts +0 -8
- package/dist/server/routes/conversations.d.ts.map +0 -1
- package/dist/server/routes/conversations.js +0 -36
- package/dist/server/routes/conversations.js.map +0 -1
- package/dist/server/scheduler/__tests__/job-runner.test.d.ts +0 -2
- package/dist/server/scheduler/__tests__/job-runner.test.d.ts.map +0 -1
- package/dist/server/scheduler/__tests__/job-runner.test.js +0 -488
- package/dist/server/scheduler/__tests__/job-runner.test.js.map +0 -1
- package/dist/server/scheduler/__tests__/scheduler-routes.test.d.ts +0 -2
- package/dist/server/scheduler/__tests__/scheduler-routes.test.d.ts.map +0 -1
- package/dist/server/scheduler/__tests__/scheduler-routes.test.js +0 -167
- package/dist/server/scheduler/__tests__/scheduler-routes.test.js.map +0 -1
- package/dist/server/scheduler/__tests__/scheduler-service.test.d.ts +0 -2
- package/dist/server/scheduler/__tests__/scheduler-service.test.d.ts.map +0 -1
- package/dist/server/scheduler/__tests__/scheduler-service.test.js +0 -207
- package/dist/server/scheduler/__tests__/scheduler-service.test.js.map +0 -1
- package/dist/server/scheduler/job-runner.d.ts +0 -73
- package/dist/server/scheduler/job-runner.d.ts.map +0 -1
- package/dist/server/scheduler/job-runner.js +0 -407
- package/dist/server/scheduler/job-runner.js.map +0 -1
- package/dist/server/scheduler/scheduler-routes.d.ts +0 -10
- package/dist/server/scheduler/scheduler-routes.d.ts.map +0 -1
- package/dist/server/scheduler/scheduler-routes.js +0 -105
- package/dist/server/scheduler/scheduler-routes.js.map +0 -1
- package/dist/server/scheduler/scheduler-service.d.ts +0 -55
- package/dist/server/scheduler/scheduler-service.d.ts.map +0 -1
- package/dist/server/scheduler/scheduler-service.js +0 -271
- package/dist/server/scheduler/scheduler-service.js.map +0 -1
- package/dist/server/services/__tests__/cost-service.test.d.ts +0 -2
- package/dist/server/services/__tests__/cost-service.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/cost-service.test.js +0 -72
- package/dist/server/services/__tests__/cost-service.test.js.map +0 -1
- package/dist/server/services/__tests__/execution-log-service.test.d.ts +0 -2
- package/dist/server/services/__tests__/execution-log-service.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/execution-log-service.test.js +0 -40
- package/dist/server/services/__tests__/execution-log-service.test.js.map +0 -1
- package/dist/server/services/__tests__/integration-registry.test.d.ts +0 -2
- package/dist/server/services/__tests__/integration-registry.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/integration-registry.test.js +0 -28
- package/dist/server/services/__tests__/integration-registry.test.js.map +0 -1
- package/dist/server/services/__tests__/log-service.test.d.ts +0 -2
- package/dist/server/services/__tests__/log-service.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/log-service.test.js +0 -49
- package/dist/server/services/__tests__/log-service.test.js.map +0 -1
- package/dist/server/services/__tests__/pipeline-task-service.test.d.ts +0 -2
- package/dist/server/services/__tests__/pipeline-task-service.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/pipeline-task-service.test.js +0 -268
- package/dist/server/services/__tests__/pipeline-task-service.test.js.map +0 -1
- package/dist/server/services/__tests__/state-service.test.d.ts +0 -2
- package/dist/server/services/__tests__/state-service.test.d.ts.map +0 -1
- package/dist/server/services/__tests__/state-service.test.js +0 -136
- package/dist/server/services/__tests__/state-service.test.js.map +0 -1
- package/dist/server/services/activity-service.d.ts +0 -35
- package/dist/server/services/activity-service.d.ts.map +0 -1
- package/dist/server/services/activity-service.js +0 -92
- package/dist/server/services/activity-service.js.map +0 -1
- package/dist/server/services/cost-service.d.ts +0 -55
- package/dist/server/services/cost-service.d.ts.map +0 -1
- package/dist/server/services/cost-service.js +0 -59
- package/dist/server/services/cost-service.js.map +0 -1
- package/dist/server/services/execution-log-service.d.ts +0 -20
- package/dist/server/services/execution-log-service.d.ts.map +0 -1
- package/dist/server/services/execution-log-service.js +0 -17
- package/dist/server/services/execution-log-service.js.map +0 -1
- package/dist/server/services/integration-registry.d.ts +0 -9
- package/dist/server/services/integration-registry.d.ts.map +0 -1
- package/dist/server/services/integration-registry.js +0 -14
- package/dist/server/services/integration-registry.js.map +0 -1
- package/dist/server/services/log-service.d.ts +0 -28
- package/dist/server/services/log-service.d.ts.map +0 -1
- package/dist/server/services/log-service.js +0 -34
- package/dist/server/services/log-service.js.map +0 -1
- package/dist/server/services/pipeline-task-service.d.ts +0 -79
- package/dist/server/services/pipeline-task-service.d.ts.map +0 -1
- package/dist/server/services/pipeline-task-service.js +0 -122
- package/dist/server/services/pipeline-task-service.js.map +0 -1
- package/dist/server/services/squad-registry.d.ts +0 -35
- package/dist/server/services/squad-registry.d.ts.map +0 -1
- package/dist/server/services/squad-registry.js +0 -141
- package/dist/server/services/squad-registry.js.map +0 -1
- package/dist/server/services/state-service.d.ts +0 -22
- package/dist/server/services/state-service.d.ts.map +0 -1
- package/dist/server/services/state-service.js +0 -114
- package/dist/server/services/state-service.js.map +0 -1
- package/dist/server/types/a2ui.d.ts +0 -27
- package/dist/server/types/a2ui.d.ts.map +0 -1
- package/dist/server/types/a2ui.js +0 -2
- package/dist/server/types/a2ui.js.map +0 -1
- package/dist/server/utils/find-free-port.d.ts +0 -2
- package/dist/server/utils/find-free-port.d.ts.map +0 -1
- package/dist/server/utils/find-free-port.js +0 -17
- package/dist/server/utils/find-free-port.js.map +0 -1
- package/dist/server/watcher/__tests__/file-watcher.test.d.ts +0 -2
- package/dist/server/watcher/__tests__/file-watcher.test.d.ts.map +0 -1
- package/dist/server/watcher/__tests__/file-watcher.test.js +0 -81
- package/dist/server/watcher/__tests__/file-watcher.test.js.map +0 -1
- package/dist/server/watcher/file-watcher.d.ts +0 -19
- package/dist/server/watcher/file-watcher.d.ts.map +0 -1
- package/dist/server/watcher/file-watcher.js +0 -105
- package/dist/server/watcher/file-watcher.js.map +0 -1
- package/dist/server/watcher/state-parser.d.ts +0 -77
- package/dist/server/watcher/state-parser.d.ts.map +0 -1
- package/dist/server/watcher/state-parser.js +0 -78
- package/dist/server/watcher/state-parser.js.map +0 -1
- package/dist/server/ws/ws-auth.d.ts +0 -4
- package/dist/server/ws/ws-auth.d.ts.map +0 -1
- package/dist/server/ws/ws-auth.js +0 -42
- package/dist/server/ws/ws-auth.js.map +0 -1
- package/dist/server/ws/ws-handler.d.ts +0 -12
- package/dist/server/ws/ws-handler.d.ts.map +0 -1
- package/dist/server/ws/ws-handler.js +0 -171
- package/dist/server/ws/ws-handler.js.map +0 -1
- package/dist/server/ws/ws-rooms.d.ts +0 -12
- package/dist/server/ws/ws-rooms.d.ts.map +0 -1
- package/dist/server/ws/ws-rooms.js +0 -52
- package/dist/server/ws/ws-rooms.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/config.d.ts +0 -4
- package/node_modules/expxagents-knowledge/dist/config.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/config.js +0 -37
- package/node_modules/expxagents-knowledge/dist/config.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/connection.d.ts +0 -6
- package/node_modules/expxagents-knowledge/dist/db/connection.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/connection.js +0 -69
- package/node_modules/expxagents-knowledge/dist/db/connection.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/migrations.d.ts +0 -3
- package/node_modules/expxagents-knowledge/dist/db/migrations.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/migrations.js +0 -46
- package/node_modules/expxagents-knowledge/dist/db/migrations.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/schema.d.ts +0 -3
- package/node_modules/expxagents-knowledge/dist/db/schema.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/db/schema.js +0 -79
- package/node_modules/expxagents-knowledge/dist/db/schema.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/index.d.ts +0 -16
- package/node_modules/expxagents-knowledge/dist/index.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/index.js +0 -16
- package/node_modules/expxagents-knowledge/dist/index.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/chunker.d.ts +0 -10
- package/node_modules/expxagents-knowledge/dist/ingest/chunker.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/chunker.js +0 -221
- package/node_modules/expxagents-knowledge/dist/ingest/chunker.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/document-loader.d.ts +0 -4
- package/node_modules/expxagents-knowledge/dist/ingest/document-loader.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/document-loader.js +0 -56
- package/node_modules/expxagents-knowledge/dist/ingest/document-loader.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/embedder.d.ts +0 -4
- package/node_modules/expxagents-knowledge/dist/ingest/embedder.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/embedder.js +0 -25
- package/node_modules/expxagents-knowledge/dist/ingest/embedder.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/entity-extractor.d.ts +0 -21
- package/node_modules/expxagents-knowledge/dist/ingest/entity-extractor.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/entity-extractor.js +0 -54
- package/node_modules/expxagents-knowledge/dist/ingest/entity-extractor.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/extraction-queue.d.ts +0 -16
- package/node_modules/expxagents-knowledge/dist/ingest/extraction-queue.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/extraction-queue.js +0 -49
- package/node_modules/expxagents-knowledge/dist/ingest/extraction-queue.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/pdf-extractor.d.ts +0 -9
- package/node_modules/expxagents-knowledge/dist/ingest/pdf-extractor.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/pdf-extractor.js +0 -116
- package/node_modules/expxagents-knowledge/dist/ingest/pdf-extractor.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/pipeline.d.ts +0 -27
- package/node_modules/expxagents-knowledge/dist/ingest/pipeline.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/ingest/pipeline.js +0 -92
- package/node_modules/expxagents-knowledge/dist/ingest/pipeline.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/graph-traversal.d.ts +0 -41
- package/node_modules/expxagents-knowledge/dist/query/graph-traversal.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/graph-traversal.js +0 -62
- package/node_modules/expxagents-knowledge/dist/query/graph-traversal.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/knowledge-query.d.ts +0 -31
- package/node_modules/expxagents-knowledge/dist/query/knowledge-query.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/knowledge-query.js +0 -106
- package/node_modules/expxagents-knowledge/dist/query/knowledge-query.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/vector-search.d.ts +0 -26
- package/node_modules/expxagents-knowledge/dist/query/vector-search.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/query/vector-search.js +0 -57
- package/node_modules/expxagents-knowledge/dist/query/vector-search.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/sources/agent-output.d.ts +0 -10
- package/node_modules/expxagents-knowledge/dist/sources/agent-output.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/sources/agent-output.js +0 -29
- package/node_modules/expxagents-knowledge/dist/sources/agent-output.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/sources/watcher.d.ts +0 -6
- package/node_modules/expxagents-knowledge/dist/sources/watcher.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/sources/watcher.js +0 -42
- package/node_modules/expxagents-knowledge/dist/sources/watcher.js.map +0 -1
- package/node_modules/expxagents-knowledge/dist/types.d.ts +0 -138
- package/node_modules/expxagents-knowledge/dist/types.d.ts.map +0 -1
- package/node_modules/expxagents-knowledge/dist/types.js +0 -2
- package/node_modules/expxagents-knowledge/dist/types.js.map +0 -1
- package/node_modules/expxagents-knowledge/package.json +0 -7
|
@@ -1,4057 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2010-2026 Three.js Authors
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Rt="srgb",In="srgb-linear",Pi="linear",Ye="srgb";const Lr="300 es";function Qs(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Di(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ea(){const i=Di("canvas");return i.style.display="block",i}const Fr={};function Ur(...i){const e="THREE."+i.shift();console.log(e,...i)}function Rs(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Re(...i){i=Rs(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function He(...i){i=Rs(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Li(...i){const e=i.join(" ");e in Fr||(Fr[e]=!0,Re(...i))}function ta(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const na={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class On{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const gt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],zi=Math.PI/180,gr=180/Math.PI;function jn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(gt[i&255]+gt[i>>8&255]+gt[i>>16&255]+gt[i>>24&255]+"-"+gt[e&255]+gt[e>>8&255]+"-"+gt[e>>16&15|64]+gt[e>>24&255]+"-"+gt[t&63|128]+gt[t>>8&255]+"-"+gt[t>>16&255]+gt[t>>24&255]+gt[n&255]+gt[n>>8&255]+gt[n>>16&255]+gt[n>>24&255]).toLowerCase()}function Be(i,e,t){return Math.max(e,Math.min(t,i))}function ia(i,e){return(i%e+e)%e}function Vi(i,e,t){return(1-t)*i+t*e}function Vn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Et(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class $e{constructor(e=0,t=0){$e.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,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+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=Be(this.x,e.x,t.x),this.y=Be(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Be(this.x,e,t),this.y=Be(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Be(n,e,t))}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 n=this.dot(e)/t;return Math.acos(Be(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let c=n[r+0],l=n[r+1],h=n[r+2],m=n[r+3],u=s[a+0],_=s[a+1],g=s[a+2],S=s[a+3];if(m!==S||c!==u||l!==_||h!==g){let d=c*u+l*_+h*g+m*S;d<0&&(u=-u,_=-_,g=-g,S=-S,d=-d);let f=1-o;if(d<.9995){const M=Math.acos(d),A=Math.sin(M);f=Math.sin(f*M)/A,o=Math.sin(o*M)/A,c=c*f+u*o,l=l*f+_*o,h=h*f+g*o,m=m*f+S*o}else{c=c*f+u*o,l=l*f+_*o,h=h*f+g*o,m=m*f+S*o;const M=1/Math.sqrt(c*c+l*l+h*h+m*m);c*=M,l*=M,h*=M,m*=M}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],c=n[r+1],l=n[r+2],h=n[r+3],m=s[a],u=s[a+1],_=s[a+2],g=s[a+3];return e[t]=o*g+h*m+c*_-l*u,e[t+1]=c*g+h*u+l*m-o*_,e[t+2]=l*g+h*_+o*u-c*m,e[t+3]=h*g-o*m-c*u-l*_,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,n,r){return this._x=e,this._y=t,this._z=n,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 n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(r/2),m=o(s/2),u=c(n/2),_=c(r/2),g=c(s/2);switch(a){case"XYZ":this._x=u*h*m+l*_*g,this._y=l*_*m-u*h*g,this._z=l*h*g+u*_*m,this._w=l*h*m-u*_*g;break;case"YXZ":this._x=u*h*m+l*_*g,this._y=l*_*m-u*h*g,this._z=l*h*g-u*_*m,this._w=l*h*m+u*_*g;break;case"ZXY":this._x=u*h*m-l*_*g,this._y=l*_*m+u*h*g,this._z=l*h*g+u*_*m,this._w=l*h*m-u*_*g;break;case"ZYX":this._x=u*h*m-l*_*g,this._y=l*_*m+u*h*g,this._z=l*h*g-u*_*m,this._w=l*h*m+u*_*g;break;case"YZX":this._x=u*h*m+l*_*g,this._y=l*_*m+u*h*g,this._z=l*h*g-u*_*m,this._w=l*h*m-u*_*g;break;case"XZY":this._x=u*h*m-l*_*g,this._y=l*_*m-u*h*g,this._z=l*h*g+u*_*m,this._w=l*h*m+u*_*g;break;default:Re("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],m=t[10],u=n+o+m;if(u>0){const _=.5/Math.sqrt(u+1);this._w=.25/_,this._x=(h-c)*_,this._y=(s-l)*_,this._z=(a-r)*_}else if(n>o&&n>m){const _=2*Math.sqrt(1+n-o-m);this._w=(h-c)/_,this._x=.25*_,this._y=(r+a)/_,this._z=(s+l)/_}else if(o>m){const _=2*Math.sqrt(1+o-n-m);this._w=(s-l)/_,this._x=(r+a)/_,this._y=.25*_,this._z=(c+h)/_}else{const _=2*Math.sqrt(1+m-n-o);this._w=(a-r)/_,this._x=(s+l)/_,this._y=(c+h)/_,this._z=.25*_}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Be(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);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 n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+r*l-s*c,this._y=r*h+a*c+s*o-n*l,this._z=s*h+a*l+n*c-r*o,this._w=a*h-n*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);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 I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(Ir.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ir.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*n),h=2*(o*t-s*r),m=2*(s*n-a*t);return this.x=t+c*l+a*m-o*h,this.y=n+c*h+o*l-s*m,this.z=r+c*m+s*h-a*l,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,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+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=Be(this.x,e.x,t.x),this.y=Be(this.y,e.y,t.y),this.z=Be(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Be(this.x,e,t),this.y=Be(this.y,e,t),this.z=Be(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Be(n,e,t))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=r*c-s*o,this.y=s*a-n*c,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Hi.copy(this).projectOnVector(e),this.sub(Hi)}reflect(e){return this.sub(Hi.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 n=this.dot(e)/t;return Math.acos(Be(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+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,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,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,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Hi=new I,Ir=new Bn;class Le{constructor(e,t,n,r,s,a,o,c,l){Le.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l)}set(e,t,n,r,s,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=c,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],m=n[7],u=n[2],_=n[5],g=n[8],S=r[0],d=r[3],f=r[6],M=r[1],A=r[4],y=r[7],P=r[2],b=r[5],L=r[8];return s[0]=a*S+o*M+c*P,s[3]=a*d+o*A+c*b,s[6]=a*f+o*y+c*L,s[1]=l*S+h*M+m*P,s[4]=l*d+h*A+m*b,s[7]=l*f+h*y+m*L,s[2]=u*S+_*M+g*P,s[5]=u*d+_*A+g*b,s[8]=u*f+_*y+g*L,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],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*s*h+n*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],m=h*a-o*l,u=o*c-h*s,_=l*s-a*c,g=t*m+n*u+r*_;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/g;return e[0]=m*S,e[1]=(r*l-h*n)*S,e[2]=(o*n-r*a)*S,e[3]=u*S,e[4]=(h*t-r*c)*S,e[5]=(r*s-o*t)*S,e[6]=_*S,e[7]=(n*c-l*t)*S,e[8]=(a*t-n*s)*S,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,n,r,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ki.makeScale(e,t)),this}rotate(e){return this.premultiply(ki.makeRotation(-e)),this}translate(e,t){return this.premultiply(ki.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),n=Math.sin(e);return this.set(t,-n,0,n,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,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ki=new Le,Nr=new Le().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Or=new Le().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ra(){const i={enabled:!0,workingColorSpace:In,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ye&&(r.r=$t(r.r),r.g=$t(r.g),r.b=$t(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ye&&(r.r=Un(r.r),r.g=Un(r.g),r.b=Un(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===""?Pi:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Li("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Li("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[In]:{primaries:e,whitePoint:n,transfer:Pi,toXYZ:Nr,fromXYZ:Or,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Rt},outputColorSpaceConfig:{drawingBufferColorSpace:Rt}},[Rt]:{primaries:e,whitePoint:n,transfer:Ye,toXYZ:Nr,fromXYZ:Or,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Rt}}}),i}const ze=ra();function $t(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Un(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Mn;class sa{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Mn===void 0&&(Mn=Di("canvas")),Mn.width=e.width,Mn.height=e.height;const r=Mn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Mn}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Di("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=$t(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor($t(t[n]/255)*255):t[n]=$t(t[n]);return{data:t,width:e.width,height:e.height}}else return Re("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let aa=0;class Mr{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:aa++}),this.uuid=jn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Wi(r[a].image)):s.push(Wi(r[a]))}else s=Wi(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Wi(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?sa.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Re("Texture: Unable to serialize Texture."),{})}let oa=0;const Xi=new I;class St extends On{constructor(e=St.DEFAULT_IMAGE,t=St.DEFAULT_MAPPING,n=1001,r=1001,s=1006,a=1008,o=1023,c=1009,l=St.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oa++}),this.uuid=jn(),this.name="",this.source=new Mr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new $e(0,0),this.repeat=new $e(1,1),this.center=new $e(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Le,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Xi).x}get height(){return this.source.getSize(Xi).y}get depth(){return this.source.getSize(Xi).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Re(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Re(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002: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 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002: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++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=300;St.DEFAULT_ANISOTROPY=1;class ot{constructor(e=0,t=0,n=0,r=1){ot.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,n,r){return this.x=e,this.y=t,this.z=n,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,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,n,r,s;const c=e.elements,l=c[0],h=c[4],m=c[8],u=c[1],_=c[5],g=c[9],S=c[2],d=c[6],f=c[10];if(Math.abs(h-u)<.01&&Math.abs(m-S)<.01&&Math.abs(g-d)<.01){if(Math.abs(h+u)<.1&&Math.abs(m+S)<.1&&Math.abs(g+d)<.1&&Math.abs(l+_+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(l+1)/2,y=(_+1)/2,P=(f+1)/2,b=(h+u)/4,L=(m+S)/4,x=(g+d)/4;return A>y&&A>P?A<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(A),r=b/n,s=L/n):y>P?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=b/r,s=x/r):P<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),n=L/s,r=x/s),this.set(n,r,s,t),this}let M=Math.sqrt((d-g)*(d-g)+(m-S)*(m-S)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(d-g)/M,this.y=(m-S)/M,this.z=(u-h)/M,this.w=Math.acos((l+_+f-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=Be(this.x,e.x,t.x),this.y=Be(this.y,e.y,t.y),this.z=Be(this.z,e.z,t.z),this.w=Be(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Be(this.x,e,t),this.y=Be(this.y,e,t),this.z=Be(this.z,e,t),this.w=Be(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Be(n,e,t))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 la extends On{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ot(0,0,e,t),this.scissorTest=!1,this.viewport=new ot(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new St(r),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Mr(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class zt extends la{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Cs extends St{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ca extends St{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rt{constructor(e,t,n,r,s,a,o,c,l,h,m,u,_,g,S,d){rt.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,n,r,s,a,o,c,l,h,m,u,_,g,S,d)}set(e,t,n,r,s,a,o,c,l,h,m,u,_,g,S,d){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=h,f[10]=m,f[14]=u,f[3]=_,f[7]=g,f[11]=S,f[15]=d,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 rt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,r=1/En.setFromMatrixColumn(e,0).length(),s=1/En.setFromMatrixColumn(e,1).length(),a=1/En.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(r),l=Math.sin(r),h=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const u=a*h,_=a*m,g=o*h,S=o*m;t[0]=c*h,t[4]=-c*m,t[8]=l,t[1]=_+g*l,t[5]=u-S*l,t[9]=-o*c,t[2]=S-u*l,t[6]=g+_*l,t[10]=a*c}else if(e.order==="YXZ"){const u=c*h,_=c*m,g=l*h,S=l*m;t[0]=u+S*o,t[4]=g*o-_,t[8]=a*l,t[1]=a*m,t[5]=a*h,t[9]=-o,t[2]=_*o-g,t[6]=S+u*o,t[10]=a*c}else if(e.order==="ZXY"){const u=c*h,_=c*m,g=l*h,S=l*m;t[0]=u-S*o,t[4]=-a*m,t[8]=g+_*o,t[1]=_+g*o,t[5]=a*h,t[9]=S-u*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const u=a*h,_=a*m,g=o*h,S=o*m;t[0]=c*h,t[4]=g*l-_,t[8]=u*l+S,t[1]=c*m,t[5]=S*l+u,t[9]=_*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const u=a*c,_=a*l,g=o*c,S=o*l;t[0]=c*h,t[4]=S-u*m,t[8]=g*m+_,t[1]=m,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=_*m+g,t[10]=u-S*m}else if(e.order==="XZY"){const u=a*c,_=a*l,g=o*c,S=o*l;t[0]=c*h,t[4]=-m,t[8]=l*h,t[1]=u*m+S,t[5]=a*h,t[9]=_*m-g,t[2]=g*m-_,t[6]=o*h,t[10]=S*m+u}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(ua,e,fa)}lookAt(e,t,n){const r=this.elements;return yt.subVectors(e,t),yt.lengthSq()===0&&(yt.z=1),yt.normalize(),tn.crossVectors(n,yt),tn.lengthSq()===0&&(Math.abs(n.z)===1?yt.x+=1e-4:yt.z+=1e-4,yt.normalize(),tn.crossVectors(n,yt)),tn.normalize(),ii.crossVectors(yt,tn),r[0]=tn.x,r[4]=ii.x,r[8]=yt.x,r[1]=tn.y,r[5]=ii.y,r[9]=yt.y,r[2]=tn.z,r[6]=ii.z,r[10]=yt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],m=n[5],u=n[9],_=n[13],g=n[2],S=n[6],d=n[10],f=n[14],M=n[3],A=n[7],y=n[11],P=n[15],b=r[0],L=r[4],x=r[8],T=r[12],Y=r[1],C=r[5],V=r[9],G=r[13],k=r[2],H=r[6],B=r[10],O=r[14],Q=r[3],$=r[7],ce=r[11],pe=r[15];return s[0]=a*b+o*Y+c*k+l*Q,s[4]=a*L+o*C+c*H+l*$,s[8]=a*x+o*V+c*B+l*ce,s[12]=a*T+o*G+c*O+l*pe,s[1]=h*b+m*Y+u*k+_*Q,s[5]=h*L+m*C+u*H+_*$,s[9]=h*x+m*V+u*B+_*ce,s[13]=h*T+m*G+u*O+_*pe,s[2]=g*b+S*Y+d*k+f*Q,s[6]=g*L+S*C+d*H+f*$,s[10]=g*x+S*V+d*B+f*ce,s[14]=g*T+S*G+d*O+f*pe,s[3]=M*b+A*Y+y*k+P*Q,s[7]=M*L+A*C+y*H+P*$,s[11]=M*x+A*V+y*B+P*ce,s[15]=M*T+A*G+y*O+P*pe,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],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],m=e[6],u=e[10],_=e[14],g=e[3],S=e[7],d=e[11],f=e[15],M=c*_-l*u,A=o*_-l*m,y=o*u-c*m,P=a*_-l*h,b=a*u-c*h,L=a*m-o*h;return t*(S*M-d*A+f*y)-n*(g*M-d*P+f*b)+r*(g*A-S*P+f*L)-s*(g*y-S*b+d*L)}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,n){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]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],m=e[9],u=e[10],_=e[11],g=e[12],S=e[13],d=e[14],f=e[15],M=t*o-n*a,A=t*c-r*a,y=t*l-s*a,P=n*c-r*o,b=n*l-s*o,L=r*l-s*c,x=h*S-m*g,T=h*d-u*g,Y=h*f-_*g,C=m*d-u*S,V=m*f-_*S,G=u*f-_*d,k=M*G-A*V+y*C+P*Y-b*T+L*x;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const H=1/k;return e[0]=(o*G-c*V+l*C)*H,e[1]=(r*V-n*G-s*C)*H,e[2]=(S*L-d*b+f*P)*H,e[3]=(u*b-m*L-_*P)*H,e[4]=(c*Y-a*G-l*T)*H,e[5]=(t*G-r*Y+s*T)*H,e[6]=(d*y-g*L-f*A)*H,e[7]=(h*L-u*y+_*A)*H,e[8]=(a*V-o*Y+l*x)*H,e[9]=(n*Y-t*V-s*x)*H,e[10]=(g*b-S*y+f*M)*H,e[11]=(m*y-h*b-_*M)*H,e[12]=(o*T-a*C-c*x)*H,e[13]=(t*C-n*T+r*x)*H,e[14]=(S*A-g*P-d*M)*H,e[15]=(h*P-m*A+u*M)*H,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,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],n=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,n,r))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,h=s*o;return this.set(l*a+n,l*o-r*c,l*c+r*o,0,l*o+r*c,h*o+n,h*c-r*a,0,l*c-r*o,h*c+r*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,h=a+a,m=o+o,u=s*l,_=s*h,g=s*m,S=a*h,d=a*m,f=o*m,M=c*l,A=c*h,y=c*m,P=n.x,b=n.y,L=n.z;return r[0]=(1-(S+f))*P,r[1]=(_+y)*P,r[2]=(g-A)*P,r[3]=0,r[4]=(_-y)*b,r[5]=(1-(u+f))*b,r[6]=(d+M)*b,r[7]=0,r[8]=(g+A)*L,r[9]=(d-M)*L,r[10]=(1-(u+S))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let a=En.set(r[0],r[1],r[2]).length();const o=En.set(r[4],r[5],r[6]).length(),c=En.set(r[8],r[9],r[10]).length();s<0&&(a=-a),wt.copy(this);const l=1/a,h=1/o,m=1/c;return wt.elements[0]*=l,wt.elements[1]*=l,wt.elements[2]*=l,wt.elements[4]*=h,wt.elements[5]*=h,wt.elements[6]*=h,wt.elements[8]*=m,wt.elements[9]*=m,wt.elements[10]*=m,t.setFromRotationMatrix(wt),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,r,s,a,o=2e3,c=!1){const l=this.elements,h=2*s/(t-e),m=2*s/(n-r),u=(t+e)/(t-e),_=(n+r)/(n-r);let g,S;if(c)g=s/(a-s),S=a*s/(a-s);else if(o===2e3)g=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===2001)g=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=m,l[9]=_,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=S,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=2e3,c=!1){const l=this.elements,h=2/(t-e),m=2/(n-r),u=-(t+e)/(t-e),_=-(n+r)/(n-r);let g,S;if(c)g=1/(a-s),S=a/(a-s);else if(o===2e3)g=-2/(a-s),S=-(a+s)/(a-s);else if(o===2001)g=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=m,l[9]=0,l[13]=_,l[2]=0,l[6]=0,l[10]=g,l[14]=S,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const En=new I,wt=new rt,ua=new I(0,0,0),fa=new I(1,1,1),tn=new I,ii=new I,yt=new I,Br=new rt,Gr=new Bn;class jt{constructor(e=0,t=0,n=0,r=jt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,n,r=this._order){return this._x=e,this._y=t,this._z=n,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,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],c=r[1],l=r[5],h=r[9],m=r[2],u=r[6],_=r[10];switch(t){case"XYZ":this._y=Math.asin(Be(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,_),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Be(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,_),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Be(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-m,_),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Be(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(u,_),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Be(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(o,_));break;case"XZY":this._z=Math.asin(-Be(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,_),this._y=0);break;default:Re("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Br.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Br,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Gr.setFromEuler(this),this.setFromQuaternion(Gr,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}}jt.DEFAULT_ORDER="XYZ";class ws{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ha=0;const zr=new I,Tn=new Bn,Xt=new rt,ri=new I,Hn=new I,da=new I,pa=new Bn,Vr=new I(1,0,0),Hr=new I(0,1,0),kr=new I(0,0,1),Wr={type:"added"},ma={type:"removed"},yn={type:"childadded",child:null},qi={type:"childremoved",child:null};class Mt extends On{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ha++}),this.uuid=jn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Mt.DEFAULT_UP.clone();const e=new I,t=new jt,n=new Bn,r=new I(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new rt},normalMatrix:{value:new Le}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=Mt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ws,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Tn.setFromAxisAngle(e,t),this.quaternion.multiply(Tn),this}rotateOnWorldAxis(e,t){return Tn.setFromAxisAngle(e,t),this.quaternion.premultiply(Tn),this}rotateX(e){return this.rotateOnAxis(Vr,e)}rotateY(e){return this.rotateOnAxis(Hr,e)}rotateZ(e){return this.rotateOnAxis(kr,e)}translateOnAxis(e,t){return zr.copy(e).applyQuaternion(this.quaternion),this.position.add(zr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Vr,e)}translateY(e){return this.translateOnAxis(Hr,e)}translateZ(e){return this.translateOnAxis(kr,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Xt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ri.copy(e):ri.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Hn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xt.lookAt(Hn,ri,this.up):Xt.lookAt(ri,Hn,this.up),this.quaternion.setFromRotationMatrix(Xt),r&&(Xt.extractRotation(r.matrixWorld),Tn.setFromRotationMatrix(Xt),this.quaternion.premultiply(Tn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(He("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Wr),yn.child=e,this.dispatchEvent(yn),yn.child=null):He("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ma),qi.child=e,this.dispatchEvent(qi),qi.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Xt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Xt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Xt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Wr),yn.child=e,this.dispatchEvent(yn),yn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hn,e,da),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hn,pa,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),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.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const m=c[l];s(e.shapes,m)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];r.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),m=a(e.shapes),u=a(e.skeletons),_=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),m.length>0&&(n.shapes=m),u.length>0&&(n.skeletons=u),_.length>0&&(n.animations=_),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}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),e.pivot!==null&&(this.pivot=e.pivot.clone()),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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}Mt.DEFAULT_UP=new I(0,1,0);Mt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class si extends Mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const _a={type:"move"};class Yi{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new si,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 si,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new si,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),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 n of e.hand.values())this._getHandJoint(t,n)}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,n){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const S of e.hand.values()){const d=t.getJointPose(S,n),f=this._getHandJoint(l,S);d!==null&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=d!==null}const h=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],u=h.position.distanceTo(m.position),_=.02,g=.005;l.inputState.pinching&&u>_+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=_-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(_a)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new si;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ps={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},nn={h:0,s:0,l:0},ai={h:0,s:0,l:0};function Ki(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class We{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===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,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Rt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ze.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,ze.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ze.workingColorSpace){if(e=ia(e,1),t=Be(t,0,1),n=Be(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ki(a,s,e+1/3),this.g=Ki(a,s,e),this.b=Ki(a,s,e-1/3)}return ze.colorSpaceToWorking(this,r),this}setStyle(e,t=Rt){function n(s){s!==void 0&&parseFloat(s)<1&&Re("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(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(o))return n(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(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Re("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);Re("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Rt){const n=Ps[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Re("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=$t(e.r),this.g=$t(e.g),this.b=$t(e.b),this}copyLinearToSRGB(e){return this.r=Un(e.r),this.g=Un(e.g),this.b=Un(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Rt){return ze.workingToColorSpace(xt.copy(this),e),Math.round(Be(xt.r*255,0,255))*65536+Math.round(Be(xt.g*255,0,255))*256+Math.round(Be(xt.b*255,0,255))}getHexString(e=Rt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ze.workingColorSpace){ze.workingToColorSpace(xt.copy(this),t);const n=xt.r,r=xt.g,s=xt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const m=a-o;switch(l=h<=.5?m/(a+o):m/(2-a-o),a){case n:c=(r-s)/m+(r<s?6:0);break;case r:c=(s-n)/m+2;break;case s:c=(n-r)/m+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=ze.workingColorSpace){return ze.workingToColorSpace(xt.copy(this),t),e.r=xt.r,e.g=xt.g,e.b=xt.b,e}getStyle(e=Rt){ze.workingToColorSpace(xt.copy(this),e);const t=xt.r,n=xt.g,r=xt.b;return e!==Rt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(nn),this.setHSL(nn.h+e,nn.s+t,nn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(nn),e.getHSL(ai);const n=Vi(nn.h,ai.h,t),r=Vi(nn.s,ai.s,t),s=Vi(nn.l,ai.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const xt=new We;We.NAMES=Ps;class Uf extends Mt{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 jt,this.environmentIntensity=1,this.environmentRotation=new jt,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}}const Pt=new I,qt=new I,Zi=new I,Yt=new I,An=new I,bn=new I,Xr=new I,$i=new I,ji=new I,Ji=new I,Qi=new ot,er=new ot,tr=new ot;class Ft{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Pt.subVectors(e,t),r.cross(Pt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Pt.subVectors(r,t),qt.subVectors(n,t),Zi.subVectors(e,t);const a=Pt.dot(Pt),o=Pt.dot(qt),c=Pt.dot(Zi),l=qt.dot(qt),h=qt.dot(Zi),m=a*l-o*o;if(m===0)return s.set(0,0,0),null;const u=1/m,_=(l*c-o*h)*u,g=(a*h-o*c)*u;return s.set(1-_-g,g,_)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Yt)===null?!1:Yt.x>=0&&Yt.y>=0&&Yt.x+Yt.y<=1}static getInterpolation(e,t,n,r,s,a,o,c){return this.getBarycoord(e,t,n,r,Yt)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,Yt.x),c.addScaledVector(a,Yt.y),c.addScaledVector(o,Yt.z),c)}static getInterpolatedAttribute(e,t,n,r,s,a){return Qi.setScalar(0),er.setScalar(0),tr.setScalar(0),Qi.fromBufferAttribute(e,t),er.fromBufferAttribute(e,n),tr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Qi,s.x),a.addScaledVector(er,s.y),a.addScaledVector(tr,s.z),a}static isFrontFacing(e,t,n,r){return Pt.subVectors(n,t),qt.subVectors(e,t),Pt.cross(qt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Pt.subVectors(this.c,this.b),qt.subVectors(this.a,this.b),Pt.cross(qt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ft.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ft.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Ft.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Ft.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ft.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;An.subVectors(r,n),bn.subVectors(s,n),$i.subVectors(e,n);const c=An.dot($i),l=bn.dot($i);if(c<=0&&l<=0)return t.copy(n);ji.subVectors(e,r);const h=An.dot(ji),m=bn.dot(ji);if(h>=0&&m<=h)return t.copy(r);const u=c*m-h*l;if(u<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(An,a);Ji.subVectors(e,s);const _=An.dot(Ji),g=bn.dot(Ji);if(g>=0&&_<=g)return t.copy(s);const S=_*l-c*g;if(S<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(bn,o);const d=h*g-_*m;if(d<=0&&m-h>=0&&_-g>=0)return Xr.subVectors(s,r),o=(m-h)/(m-h+(_-g)),t.copy(r).addScaledVector(Xr,o);const f=1/(d+S+u);return a=S*f,o=u*f,t.copy(n).addScaledVector(An,a).addScaledVector(bn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Jn{constructor(e=new I(1/0,1/0,1/0),t=new I(-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,n=e.length;t<n;t+=3)this.expandByPoint(Dt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Dt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Dt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Dt):Dt.fromBufferAttribute(s,a),Dt.applyMatrix4(e.matrixWorld),this.expandByPoint(Dt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),oi.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),oi.copy(n.boundingBox)),oi.applyMatrix4(e.matrixWorld),this.union(oi)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Dt),Dt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(kn),li.subVectors(this.max,kn),Rn.subVectors(e.a,kn),Cn.subVectors(e.b,kn),wn.subVectors(e.c,kn),rn.subVectors(Cn,Rn),sn.subVectors(wn,Cn),fn.subVectors(Rn,wn);let t=[0,-rn.z,rn.y,0,-sn.z,sn.y,0,-fn.z,fn.y,rn.z,0,-rn.x,sn.z,0,-sn.x,fn.z,0,-fn.x,-rn.y,rn.x,0,-sn.y,sn.x,0,-fn.y,fn.x,0];return!nr(t,Rn,Cn,wn,li)||(t=[1,0,0,0,1,0,0,0,1],!nr(t,Rn,Cn,wn,li))?!1:(ci.crossVectors(rn,sn),t=[ci.x,ci.y,ci.z],nr(t,Rn,Cn,wn,li))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Dt).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:(Kt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Kt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Kt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Kt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Kt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Kt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Kt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Kt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Kt),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Kt=[new I,new I,new I,new I,new I,new I,new I,new I],Dt=new I,oi=new Jn,Rn=new I,Cn=new I,wn=new I,rn=new I,sn=new I,fn=new I,kn=new I,li=new I,ci=new I,hn=new I;function nr(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){hn.fromArray(i,s);const o=r.x*Math.abs(hn.x)+r.y*Math.abs(hn.y)+r.z*Math.abs(hn.z),c=e.dot(hn),l=t.dot(hn),h=n.dot(hn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const ct=new I,ui=new $e;let ga=0;class Vt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ga++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ui.fromBufferAttribute(this,t),ui.applyMatrix3(e),this.setXY(t,ui.x,ui.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ct.fromBufferAttribute(this,t),ct.applyMatrix3(e),this.setXYZ(t,ct.x,ct.y,ct.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ct.fromBufferAttribute(this,t),ct.applyMatrix4(e),this.setXYZ(t,ct.x,ct.y,ct.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ct.fromBufferAttribute(this,t),ct.applyNormalMatrix(e),this.setXYZ(t,ct.x,ct.y,ct.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ct.fromBufferAttribute(this,t),ct.transformDirection(e),this.setXYZ(t,ct.x,ct.y,ct.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Vn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Et(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Vn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Vn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Vn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Vn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),n=Et(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),n=Et(n,this.array),r=Et(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),n=Et(n,this.array),r=Et(r,this.array),s=Et(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}}class Ds extends Vt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ls extends Vt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ut extends Vt{constructor(e,t,n){super(new Float32Array(e),t,n)}}const xa=new Jn,Wn=new I,ir=new I;class Qn{constructor(e=new I,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 n=this.center;t!==void 0?n.copy(t):xa.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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;Wn.subVectors(e,this.center);const t=Wn.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Wn,r/n),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):(ir.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Wn.copy(e.center).add(ir)),this.expandByPoint(Wn.copy(e.center).sub(ir))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let va=0;const bt=new rt,rr=new Mt,Pn=new I,At=new Jn,Xn=new Jn,pt=new I;class It extends On{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:va++}),this.uuid=jn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Qs(e)?Ls:Ds)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Le().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return bt.makeRotationFromQuaternion(e),this.applyMatrix4(bt),this}rotateX(e){return bt.makeRotationX(e),this.applyMatrix4(bt),this}rotateY(e){return bt.makeRotationY(e),this.applyMatrix4(bt),this}rotateZ(e){return bt.makeRotationZ(e),this.applyMatrix4(bt),this}translate(e,t,n){return bt.makeTranslation(e,t,n),this.applyMatrix4(bt),this}scale(e,t,n){return bt.makeScale(e,t,n),this.applyMatrix4(bt),this}lookAt(e){return rr.lookAt(e),rr.updateMatrix(),this.applyMatrix4(rr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pn).negate(),this.translate(Pn.x,Pn.y,Pn.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ut(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Re("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Jn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){He("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];At.setFromBufferAttribute(s),this.morphTargetsRelative?(pt.addVectors(this.boundingBox.min,At.min),this.boundingBox.expandByPoint(pt),pt.addVectors(this.boundingBox.max,At.max),this.boundingBox.expandByPoint(pt)):(this.boundingBox.expandByPoint(At.min),this.boundingBox.expandByPoint(At.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&He('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){He("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const n=this.boundingSphere.center;if(At.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Xn.setFromBufferAttribute(o),this.morphTargetsRelative?(pt.addVectors(At.min,Xn.min),At.expandByPoint(pt),pt.addVectors(At.max,Xn.max),At.expandByPoint(pt)):(At.expandByPoint(Xn.min),At.expandByPoint(Xn.max))}At.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)pt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(pt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)pt.fromBufferAttribute(o,l),c&&(Pn.fromBufferAttribute(e,l),pt.add(Pn)),r=Math.max(r,n.distanceToSquared(pt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&He('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){He("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let x=0;x<n.count;x++)o[x]=new I,c[x]=new I;const l=new I,h=new I,m=new I,u=new $e,_=new $e,g=new $e,S=new I,d=new I;function f(x,T,Y){l.fromBufferAttribute(n,x),h.fromBufferAttribute(n,T),m.fromBufferAttribute(n,Y),u.fromBufferAttribute(s,x),_.fromBufferAttribute(s,T),g.fromBufferAttribute(s,Y),h.sub(l),m.sub(l),_.sub(u),g.sub(u);const C=1/(_.x*g.y-g.x*_.y);isFinite(C)&&(S.copy(h).multiplyScalar(g.y).addScaledVector(m,-_.y).multiplyScalar(C),d.copy(m).multiplyScalar(_.x).addScaledVector(h,-g.x).multiplyScalar(C),o[x].add(S),o[T].add(S),o[Y].add(S),c[x].add(d),c[T].add(d),c[Y].add(d))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let x=0,T=M.length;x<T;++x){const Y=M[x],C=Y.start,V=Y.count;for(let G=C,k=C+V;G<k;G+=3)f(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const A=new I,y=new I,P=new I,b=new I;function L(x){P.fromBufferAttribute(r,x),b.copy(P);const T=o[x];A.copy(T),A.sub(P.multiplyScalar(P.dot(T))).normalize(),y.crossVectors(b,T);const C=y.dot(c[x])<0?-1:1;a.setXYZW(x,A.x,A.y,A.z,C)}for(let x=0,T=M.length;x<T;++x){const Y=M[x],C=Y.start,V=Y.count;for(let G=C,k=C+V;G<k;G+=3)L(e.getX(G+0)),L(e.getX(G+1)),L(e.getX(G+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Vt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,_=n.count;u<_;u++)n.setXYZ(u,0,0,0);const r=new I,s=new I,a=new I,o=new I,c=new I,l=new I,h=new I,m=new I;if(e)for(let u=0,_=e.count;u<_;u+=3){const g=e.getX(u+0),S=e.getX(u+1),d=e.getX(u+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,d),h.subVectors(a,s),m.subVectors(r,s),h.cross(m),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,S),l.fromBufferAttribute(n,d),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(S,c.x,c.y,c.z),n.setXYZ(d,l.x,l.y,l.z)}else for(let u=0,_=t.count;u<_;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),m.subVectors(r,s),h.cross(m),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)pt.fromBufferAttribute(e,t),pt.normalize(),e.setXYZ(t,pt.x,pt.y,pt.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,m=o.normalized,u=new l.constructor(c.length*h);let _=0,g=0;for(let S=0,d=c.length;S<d;S++){o.isInterleavedBufferAttribute?_=c[S]*o.data.stride+o.offset:_=c[S]*h;for(let f=0;f<h;f++)u[g++]=l[_++]}return new Vt(u,h,m)}if(this.index===null)return Re("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new It,n=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let h=0,m=l.length;h<m;h++){const u=l[h],_=e(u,n);c.push(_)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let m=0,u=l.length;m<u;m++){const _=l[m];h.push(_.toJSON(e.data))}h.length>0&&(r[c]=h,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 o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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 n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const l in r){const h=r[l];this.setAttribute(l,h.clone(t))}const s=e.morphAttributes;for(const l in s){const h=[],m=s[l];for(let u=0,_=m.length;u<_;u++)h.push(m[u].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const m=a[l];this.addGroup(m.start,m.count,m.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let Sa=0;class Gn extends On{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Sa++}),this.uuid=jn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new We(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Re(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Re(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}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 n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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.allowOverride=e.allowOverride,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++}}const Zt=new I,sr=new I,fi=new I,an=new I,ar=new I,hi=new I,or=new I;class Er{constructor(e=new I,t=new I(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,Zt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Zt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zt.copy(this.origin).addScaledVector(this.direction,t),Zt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){sr.copy(e).add(t).multiplyScalar(.5),fi.copy(t).sub(e).normalize(),an.copy(this.origin).sub(sr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(fi),o=an.dot(this.direction),c=-an.dot(fi),l=an.lengthSq(),h=Math.abs(1-a*a);let m,u,_,g;if(h>0)if(m=a*c-o,u=a*o-c,g=s*h,m>=0)if(u>=-g)if(u<=g){const S=1/h;m*=S,u*=S,_=m*(m+a*u+2*o)+u*(a*m+u+2*c)+l}else u=s,m=Math.max(0,-(a*u+o)),_=-m*m+u*(u+2*c)+l;else u=-s,m=Math.max(0,-(a*u+o)),_=-m*m+u*(u+2*c)+l;else u<=-g?(m=Math.max(0,-(-a*s+o)),u=m>0?-s:Math.min(Math.max(-s,-c),s),_=-m*m+u*(u+2*c)+l):u<=g?(m=0,u=Math.min(Math.max(-s,-c),s),_=u*(u+2*c)+l):(m=Math.max(0,-(a*s+o)),u=m>0?s:Math.min(Math.max(-s,-c),s),_=-m*m+u*(u+2*c)+l);else u=a>0?-s:s,m=Math.max(0,-(a*u+o)),_=-m*m+u*(u+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,m),r&&r.copy(sr).addScaledVector(fi,u),_}intersectSphere(e,t){Zt.subVectors(e.center,this.origin);const n=Zt.dot(this.direction),r=Zt.dot(Zt)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1: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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,m=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),m>=0?(o=(e.min.z-u.z)*m,c=(e.max.z-u.z)*m):(o=(e.max.z-u.z)*m,c=(e.min.z-u.z)*m),n>c||o>r)||((o>n||n!==n)&&(n=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Zt)!==null}intersectTriangle(e,t,n,r,s){ar.subVectors(t,e),hi.subVectors(n,e),or.crossVectors(ar,hi);let a=this.direction.dot(or),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;an.subVectors(this.origin,e);const c=o*this.direction.dot(hi.crossVectors(an,hi));if(c<0)return null;const l=o*this.direction.dot(ar.cross(an));if(l<0||c+l>a)return null;const h=-o*an.dot(or);return h<0?null:this.at(h/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 Fs extends Gn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new We(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 jt,this.combine=0,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 qr=new rt,dn=new Er,di=new Qn,Yr=new I,pi=new I,mi=new I,_i=new I,lr=new I,gi=new I,Kr=new I,xi=new I;class Jt extends Mt{constructor(e=new It,t=new Fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){gi.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=o[c],m=s[c];h!==0&&(lr.fromBufferAttribute(m,e),a?gi.addScaledVector(lr,h):gi.addScaledVector(lr.sub(t),h))}t.add(gi)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),di.copy(n.boundingSphere),di.applyMatrix4(s),dn.copy(e.ray).recast(e.near),!(di.containsPoint(dn.origin)===!1&&(dn.intersectSphere(di,Yr)===null||dn.origin.distanceToSquared(Yr)>(e.far-e.near)**2))&&(qr.copy(s).invert(),dn.copy(e.ray).applyMatrix4(qr),!(n.boundingBox!==null&&dn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,dn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,m=s.attributes.normal,u=s.groups,_=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,S=u.length;g<S;g++){const d=u[g],f=a[d.materialIndex],M=Math.max(d.start,_.start),A=Math.min(o.count,Math.min(d.start+d.count,_.start+_.count));for(let y=M,P=A;y<P;y+=3){const b=o.getX(y),L=o.getX(y+1),x=o.getX(y+2);r=vi(this,f,e,n,l,h,m,b,L,x),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=d.materialIndex,t.push(r))}}else{const g=Math.max(0,_.start),S=Math.min(o.count,_.start+_.count);for(let d=g,f=S;d<f;d+=3){const M=o.getX(d),A=o.getX(d+1),y=o.getX(d+2);r=vi(this,a,e,n,l,h,m,M,A,y),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,S=u.length;g<S;g++){const d=u[g],f=a[d.materialIndex],M=Math.max(d.start,_.start),A=Math.min(c.count,Math.min(d.start+d.count,_.start+_.count));for(let y=M,P=A;y<P;y+=3){const b=y,L=y+1,x=y+2;r=vi(this,f,e,n,l,h,m,b,L,x),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=d.materialIndex,t.push(r))}}else{const g=Math.max(0,_.start),S=Math.min(c.count,_.start+_.count);for(let d=g,f=S;d<f;d+=3){const M=d,A=d+1,y=d+2;r=vi(this,a,e,n,l,h,m,M,A,y),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}}function Ma(i,e,t,n,r,s,a,o){let c;if(e.side===1?c=n.intersectTriangle(a,s,r,!0,o):c=n.intersectTriangle(r,s,a,e.side===0,o),c===null)return null;xi.copy(o),xi.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(xi);return l<t.near||l>t.far?null:{distance:l,point:xi.clone(),object:i}}function vi(i,e,t,n,r,s,a,o,c,l){i.getVertexPosition(o,pi),i.getVertexPosition(c,mi),i.getVertexPosition(l,_i);const h=Ma(i,e,t,n,pi,mi,_i,Kr);if(h){const m=new I;Ft.getBarycoord(Kr,pi,mi,_i,m),r&&(h.uv=Ft.getInterpolatedAttribute(r,o,c,l,m,new $e)),s&&(h.uv1=Ft.getInterpolatedAttribute(s,o,c,l,m,new $e)),a&&(h.normal=Ft.getInterpolatedAttribute(a,o,c,l,m,new I),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:c,c:l,normal:new I,materialIndex:0};Ft.getNormal(pi,mi,_i,u.normal),h.face=u,h.barycoord=m}return h}class Ea extends St{constructor(e=null,t=1,n=1,r,s,a,o,c,l=1003,h=1003,m,u){super(null,a,o,c,l,h,r,s,m,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const cr=new I,Ta=new I,ya=new Le;class gn{constructor(e=new I(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,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=cr.subVectors(n,t).cross(Ta.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 n=e.delta(cr),r=this.normal.dot(n);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(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||ya.getNormalMatrix(e),r=this.coplanarPoint(cr).applyMatrix4(e),s=this.normal.applyMatrix3(n).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 pn=new Qn,Aa=new $e(.5,.5),Si=new I;class Us{constructor(e=new gn,t=new gn,n=new gn,r=new gn,s=new gn,a=new gn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],h=s[4],m=s[5],u=s[6],_=s[7],g=s[8],S=s[9],d=s[10],f=s[11],M=s[12],A=s[13],y=s[14],P=s[15];if(r[0].setComponents(l-a,_-h,f-g,P-M).normalize(),r[1].setComponents(l+a,_+h,f+g,P+M).normalize(),r[2].setComponents(l+o,_+m,f+S,P+A).normalize(),r[3].setComponents(l-o,_-m,f-S,P-A).normalize(),n)r[4].setComponents(c,u,d,y).normalize(),r[5].setComponents(l-c,_-u,f-d,P-y).normalize();else if(r[4].setComponents(l-c,_-u,f-d,P-y).normalize(),t===2e3)r[5].setComponents(l+c,_+u,f+d,P+y).normalize();else if(t===2001)r[5].setComponents(c,u,d,y).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(),pn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),pn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(pn)}intersectsSprite(e){pn.center.set(0,0,0);const t=Aa.distanceTo(e.center);return pn.radius=.7071067811865476+t,pn.applyMatrix4(e.matrixWorld),this.intersectsSphere(pn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Si.x=r.normal.x>0?e.max.x:e.min.x,Si.y=r.normal.y>0?e.max.y:e.min.y,Si.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Si)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ba extends Gn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new We(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Fi=new I,Ui=new I,Zr=new rt,qn=new Er,Mi=new Qn,ur=new I,$r=new I;class Ra extends Mt{constructor(e=new It,t=new ba){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Fi.fromBufferAttribute(t,r-1),Ui.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Fi.distanceTo(Ui);e.setAttribute("lineDistance",new Ut(n,1))}else Re("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Mi.copy(n.boundingSphere),Mi.applyMatrix4(r),Mi.radius+=s,e.ray.intersectsSphere(Mi)===!1)return;Zr.copy(r).invert(),qn.copy(e.ray).applyMatrix4(Zr);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,u=n.attributes.position;if(h!==null){const _=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let S=_,d=g-1;S<d;S+=l){const f=h.getX(S),M=h.getX(S+1),A=Ei(this,e,qn,c,f,M,S);A&&t.push(A)}if(this.isLineLoop){const S=h.getX(g-1),d=h.getX(_),f=Ei(this,e,qn,c,S,d,g-1);f&&t.push(f)}}else{const _=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let S=_,d=g-1;S<d;S+=l){const f=Ei(this,e,qn,c,S,S+1,S);f&&t.push(f)}if(this.isLineLoop){const S=Ei(this,e,qn,c,g-1,_,g-1);S&&t.push(S)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Ei(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Fi.fromBufferAttribute(o,r),Ui.fromBufferAttribute(o,s),t.distanceSqToSegment(Fi,Ui,ur,$r)>n)return;ur.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(ur);if(!(l<e.near||l>e.far))return{distance:l,point:$r.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const jr=new I,Jr=new I;class If extends Ra{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,n=[];for(let r=0,s=t.count;r<s;r+=2)jr.fromBufferAttribute(t,r),Jr.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+jr.distanceTo(Jr);e.setAttribute("lineDistance",new Ut(n,1))}else Re("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ca extends Gn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new We(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Qr=new rt,xr=new Er,Ti=new Qn,yi=new I;class Nf extends Mt{constructor(e=new It,t=new Ca){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ti.copy(n.boundingSphere),Ti.applyMatrix4(r),Ti.radius+=s,e.ray.intersectsSphere(Ti)===!1)return;Qr.copy(r).invert(),xr.copy(e.ray).applyMatrix4(Qr);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,m=n.attributes.position;if(l!==null){const u=Math.max(0,a.start),_=Math.min(l.count,a.start+a.count);for(let g=u,S=_;g<S;g++){const d=l.getX(g);yi.fromBufferAttribute(m,d),es(yi,d,c,r,e,t,this)}}else{const u=Math.max(0,a.start),_=Math.min(m.count,a.start+a.count);for(let g=u,S=_;g<S;g++)yi.fromBufferAttribute(m,g),es(yi,g,c,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function es(i,e,t,n,r,s,a){const o=xr.distanceSqToPoint(i);if(o<t){const c=new I;xr.closestPointToPoint(i,c),c.applyMatrix4(n);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Is extends St{constructor(e=[],t=301,n,r,s,a,o,c,l,h){super(e,t,n,r,s,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $n extends St{constructor(e,t,n=1014,r,s,a,o=1003,c=1003,l,h=1026,m=1){if(h!==1026&&h!==1027)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:m};super(u,r,s,a,o,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Mr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class wa extends $n{constructor(e,t=1014,n=301,r,s,a=1003,o=1003,c,l=1026){const h={width:e,height:e,depth:1},m=[h,h,h,h,h,h];super(e,e,t,n,r,s,a,o,c,l),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Ns extends St{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ei extends It{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],h=[],m=[];let u=0,_=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new Ut(l,3)),this.setAttribute("normal",new Ut(h,3)),this.setAttribute("uv",new Ut(m,2));function g(S,d,f,M,A,y,P,b,L,x,T){const Y=y/L,C=P/x,V=y/2,G=P/2,k=b/2,H=L+1,B=x+1;let O=0,Q=0;const $=new I;for(let ce=0;ce<B;ce++){const pe=ce*C-G;for(let fe=0;fe<H;fe++){const Fe=fe*Y-V;$[S]=Fe*M,$[d]=pe*A,$[f]=k,l.push($.x,$.y,$.z),$[S]=0,$[d]=0,$[f]=b>0?1:-1,h.push($.x,$.y,$.z),m.push(fe/L),m.push(1-ce/x),O+=1}}for(let ce=0;ce<x;ce++)for(let pe=0;pe<L;pe++){const fe=u+pe+H*ce,Fe=u+pe+H*(ce+1),nt=u+(pe+1)+H*(ce+1),tt=u+(pe+1)+H*ce;c.push(fe,Fe,tt),c.push(Fe,nt,tt),Q+=6}o.addGroup(_,Q,T),_+=Q,u+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ei(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Ii extends It{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),c=Math.floor(r),l=o+1,h=c+1,m=e/o,u=t/c,_=[],g=[],S=[],d=[];for(let f=0;f<h;f++){const M=f*u-a;for(let A=0;A<l;A++){const y=A*m-s;g.push(y,-M,0),S.push(0,0,1),d.push(A/o),d.push(1-f/c)}}for(let f=0;f<c;f++)for(let M=0;M<o;M++){const A=M+l*f,y=M+l*(f+1),P=M+1+l*(f+1),b=M+1+l*f;_.push(A,y,b),_.push(y,P,b)}this.setIndex(_),this.setAttribute("position",new Ut(g,3)),this.setAttribute("normal",new Ut(S,3)),this.setAttribute("uv",new Ut(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ii(e.width,e.height,e.widthSegments,e.heightSegments)}}function Nn(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Re("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function vt(i){const e={};for(let t=0;t<i.length;t++){const n=Nn(i[t]);for(const r in n)e[r]=n[r]}return e}function Pa(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Os(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ze.workingColorSpace}const Da={clone:Nn,merge:vt};var La=`void main() {
|
|
6
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,Fa=`void main() {
|
|
8
|
-
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class Ht extends Gn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=La,this.fragmentShader=Fa,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nn(e.uniforms),this.uniformsGroups=Pa(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ua extends Ht{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ia extends Gn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 Na extends Gn{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 Ai=new I,bi=new Bn,Ot=new I;class Bs extends Mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(Ai,bi,Ot),Ot.x===1&&Ot.y===1&&Ot.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ai,bi,Ot.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(Ai,bi,Ot),Ot.x===1&&Ot.y===1&&Ot.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ai,bi,Ot.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const on=new I,ts=new $e,ns=new $e;class Lt extends Bs{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,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=gr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(zi*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return gr*2*Math.atan(Math.tan(zi*.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,n){on.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(on.x,on.y).multiplyScalar(-e/on.z),on.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(on.x,on.y).multiplyScalar(-e/on.z)}getViewSize(e,t){return this.getViewBounds(e,ts,ns),t.subVectors(ns,ts)}setViewOffset(e,t,n,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=n,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(zi*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*n/l,r*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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}}class Gs extends Bs{constructor(e=-1,t=1,n=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=n,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,n,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=n,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),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),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 Dn=-90,Ln=1;class Oa extends Mt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Lt(Dn,Ln,e,t);r.layers=this.layers,this.add(r);const s=new Lt(Dn,Ln,e,t);s.layers=this.layers,this.add(s);const a=new Lt(Dn,Ln,e,t);a.layers=this.layers,this.add(a);const o=new Lt(Dn,Ln,e,t);o.layers=this.layers,this.add(o);const c=new Lt(Dn,Ln,e,t);c.layers=this.layers,this.add(c);const l=new Lt(Dn,Ln,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===2e3)n.up.set(0,1,0),n.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),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.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),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,h]=this.children,m=e.getRenderTarget(),u=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const S=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let d=!1;e.isWebGLRenderer===!0?d=e.state.buffers.depth.getReversed():d=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=S,e.setRenderTarget(n,5,r),d&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(m,u,_),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Ba extends Lt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}function is(i,e,t,n){const r=Ga(n);switch(t){case 1021:return i*e;case 1028:return i*e/r.components*r.byteLength;case 1029:return i*e/r.components*r.byteLength;case 1030:return i*e*2/r.components*r.byteLength;case 1031:return i*e*2/r.components*r.byteLength;case 1022:return i*e*3/r.components*r.byteLength;case 1023:return i*e*4/r.components*r.byteLength;case 1033:return i*e*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case 33778:case 33779:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case 35841:case 35843:return Math.max(i,16)*Math.max(e,8)/4;case 35840:case 35842:return Math.max(i,8)*Math.max(e,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case 37808:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case 37809:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case 37810:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case 37811:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case 37812:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case 37813:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case 37814:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case 37815:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case 37816:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case 37817:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case 37818:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case 37819:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case 37820:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case 37821:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(i/4)*Math.ceil(e/4)*16;case 36283:case 36284:return Math.ceil(i/4)*Math.ceil(e/4)*8;case 36285:case 36286:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Ga(i){switch(i){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}}));typeof window<"u"&&(window.__THREE__?Re("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="183");/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2010-2026 Three.js Authors
|
|
12
|
-
* SPDX-License-Identifier: MIT
|
|
13
|
-
*/function zs(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function za(i){const e=new WeakMap;function t(o,c){const l=o.array,h=o.usage,m=l.byteLength,u=i.createBuffer();i.bindBuffer(c,u),i.bufferData(c,l,h),o.onUploadCallback();let _;if(l instanceof Float32Array)_=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)_=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?_=i.HALF_FLOAT:_=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)_=i.SHORT;else if(l instanceof Uint32Array)_=i.UNSIGNED_INT;else if(l instanceof Int32Array)_=i.INT;else if(l instanceof Int8Array)_=i.BYTE;else if(l instanceof Uint8Array)_=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)_=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:u,type:_,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:m}}function n(o,c,l){const h=c.array,m=c.updateRanges;if(i.bindBuffer(l,o),m.length===0)i.bufferSubData(l,0,h);else{m.sort((_,g)=>_.start-g.start);let u=0;for(let _=1;_<m.length;_++){const g=m[u],S=m[_];S.start<=g.start+g.count+1?g.count=Math.max(g.count,S.start+S.count-g.start):(++u,m[u]=S)}m.length=u+1;for(let _=0,g=m.length;_<g;_++){const S=m[_];i.bufferSubData(l,S.start*h.BYTES_PER_ELEMENT,h,S.start,S.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var Va=`#ifdef USE_ALPHAHASH
|
|
14
|
-
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
15
|
-
#endif`,Ha=`#ifdef USE_ALPHAHASH
|
|
16
|
-
const float ALPHA_HASH_SCALE = 0.05;
|
|
17
|
-
float hash2D( vec2 value ) {
|
|
18
|
-
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
19
|
-
}
|
|
20
|
-
float hash3D( vec3 value ) {
|
|
21
|
-
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
|
22
|
-
}
|
|
23
|
-
float getAlphaHashThreshold( vec3 position ) {
|
|
24
|
-
float maxDeriv = max(
|
|
25
|
-
length( dFdx( position.xyz ) ),
|
|
26
|
-
length( dFdy( position.xyz ) )
|
|
27
|
-
);
|
|
28
|
-
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
|
29
|
-
vec2 pixScales = vec2(
|
|
30
|
-
exp2( floor( log2( pixScale ) ) ),
|
|
31
|
-
exp2( ceil( log2( pixScale ) ) )
|
|
32
|
-
);
|
|
33
|
-
vec2 alpha = vec2(
|
|
34
|
-
hash3D( floor( pixScales.x * position.xyz ) ),
|
|
35
|
-
hash3D( floor( pixScales.y * position.xyz ) )
|
|
36
|
-
);
|
|
37
|
-
float lerpFactor = fract( log2( pixScale ) );
|
|
38
|
-
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
|
39
|
-
float a = min( lerpFactor, 1.0 - lerpFactor );
|
|
40
|
-
vec3 cases = vec3(
|
|
41
|
-
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
|
42
|
-
( x - 0.5 * a ) / ( 1.0 - a ),
|
|
43
|
-
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
|
44
|
-
);
|
|
45
|
-
float threshold = ( x < ( 1.0 - a ) )
|
|
46
|
-
? ( ( x < a ) ? cases.x : cases.y )
|
|
47
|
-
: cases.z;
|
|
48
|
-
return clamp( threshold , 1.0e-6, 1.0 );
|
|
49
|
-
}
|
|
50
|
-
#endif`,ka=`#ifdef USE_ALPHAMAP
|
|
51
|
-
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
52
|
-
#endif`,Wa=`#ifdef USE_ALPHAMAP
|
|
53
|
-
uniform sampler2D alphaMap;
|
|
54
|
-
#endif`,Xa=`#ifdef USE_ALPHATEST
|
|
55
|
-
#ifdef ALPHA_TO_COVERAGE
|
|
56
|
-
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
57
|
-
if ( diffuseColor.a == 0.0 ) discard;
|
|
58
|
-
#else
|
|
59
|
-
if ( diffuseColor.a < alphaTest ) discard;
|
|
60
|
-
#endif
|
|
61
|
-
#endif`,qa=`#ifdef USE_ALPHATEST
|
|
62
|
-
uniform float alphaTest;
|
|
63
|
-
#endif`,Ya=`#ifdef USE_AOMAP
|
|
64
|
-
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
65
|
-
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
66
|
-
#if defined( USE_CLEARCOAT )
|
|
67
|
-
clearcoatSpecularIndirect *= ambientOcclusion;
|
|
68
|
-
#endif
|
|
69
|
-
#if defined( USE_SHEEN )
|
|
70
|
-
sheenSpecularIndirect *= ambientOcclusion;
|
|
71
|
-
#endif
|
|
72
|
-
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
73
|
-
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
74
|
-
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
75
|
-
#endif
|
|
76
|
-
#endif`,Ka=`#ifdef USE_AOMAP
|
|
77
|
-
uniform sampler2D aoMap;
|
|
78
|
-
uniform float aoMapIntensity;
|
|
79
|
-
#endif`,Za=`#ifdef USE_BATCHING
|
|
80
|
-
#if ! defined( GL_ANGLE_multi_draw )
|
|
81
|
-
#define gl_DrawID _gl_DrawID
|
|
82
|
-
uniform int _gl_DrawID;
|
|
83
|
-
#endif
|
|
84
|
-
uniform highp sampler2D batchingTexture;
|
|
85
|
-
uniform highp usampler2D batchingIdTexture;
|
|
86
|
-
mat4 getBatchingMatrix( const in float i ) {
|
|
87
|
-
int size = textureSize( batchingTexture, 0 ).x;
|
|
88
|
-
int j = int( i ) * 4;
|
|
89
|
-
int x = j % size;
|
|
90
|
-
int y = j / size;
|
|
91
|
-
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
|
92
|
-
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
|
93
|
-
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
|
94
|
-
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
95
|
-
return mat4( v1, v2, v3, v4 );
|
|
96
|
-
}
|
|
97
|
-
float getIndirectIndex( const in int i ) {
|
|
98
|
-
int size = textureSize( batchingIdTexture, 0 ).x;
|
|
99
|
-
int x = i % size;
|
|
100
|
-
int y = i / size;
|
|
101
|
-
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
|
102
|
-
}
|
|
103
|
-
#endif
|
|
104
|
-
#ifdef USE_BATCHING_COLOR
|
|
105
|
-
uniform sampler2D batchingColorTexture;
|
|
106
|
-
vec4 getBatchingColor( const in float i ) {
|
|
107
|
-
int size = textureSize( batchingColorTexture, 0 ).x;
|
|
108
|
-
int j = int( i );
|
|
109
|
-
int x = j % size;
|
|
110
|
-
int y = j / size;
|
|
111
|
-
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
112
|
-
}
|
|
113
|
-
#endif`,$a=`#ifdef USE_BATCHING
|
|
114
|
-
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
115
|
-
#endif`,ja=`vec3 transformed = vec3( position );
|
|
116
|
-
#ifdef USE_ALPHAHASH
|
|
117
|
-
vPosition = vec3( position );
|
|
118
|
-
#endif`,Ja=`vec3 objectNormal = vec3( normal );
|
|
119
|
-
#ifdef USE_TANGENT
|
|
120
|
-
vec3 objectTangent = vec3( tangent.xyz );
|
|
121
|
-
#endif`,Qa=`float G_BlinnPhong_Implicit( ) {
|
|
122
|
-
return 0.25;
|
|
123
|
-
}
|
|
124
|
-
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
125
|
-
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
126
|
-
}
|
|
127
|
-
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
128
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
129
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
130
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
131
|
-
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
132
|
-
float G = G_BlinnPhong_Implicit( );
|
|
133
|
-
float D = D_BlinnPhong( shininess, dotNH );
|
|
134
|
-
return F * ( G * D );
|
|
135
|
-
} // validated`,eo=`#ifdef USE_IRIDESCENCE
|
|
136
|
-
const mat3 XYZ_TO_REC709 = mat3(
|
|
137
|
-
3.2404542, -0.9692660, 0.0556434,
|
|
138
|
-
-1.5371385, 1.8760108, -0.2040259,
|
|
139
|
-
-0.4985314, 0.0415560, 1.0572252
|
|
140
|
-
);
|
|
141
|
-
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
|
142
|
-
vec3 sqrtF0 = sqrt( fresnel0 );
|
|
143
|
-
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
|
144
|
-
}
|
|
145
|
-
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
|
146
|
-
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
|
147
|
-
}
|
|
148
|
-
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
|
149
|
-
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
|
150
|
-
}
|
|
151
|
-
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
|
152
|
-
float phase = 2.0 * PI * OPD * 1.0e-9;
|
|
153
|
-
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
|
154
|
-
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
|
155
|
-
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
|
156
|
-
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
|
157
|
-
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
|
158
|
-
xyz /= 1.0685e-7;
|
|
159
|
-
vec3 rgb = XYZ_TO_REC709 * xyz;
|
|
160
|
-
return rgb;
|
|
161
|
-
}
|
|
162
|
-
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
|
163
|
-
vec3 I;
|
|
164
|
-
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|
165
|
-
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
|
166
|
-
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
|
167
|
-
if ( cosTheta2Sq < 0.0 ) {
|
|
168
|
-
return vec3( 1.0 );
|
|
169
|
-
}
|
|
170
|
-
float cosTheta2 = sqrt( cosTheta2Sq );
|
|
171
|
-
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
|
172
|
-
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
|
173
|
-
float T121 = 1.0 - R12;
|
|
174
|
-
float phi12 = 0.0;
|
|
175
|
-
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
|
176
|
-
float phi21 = PI - phi12;
|
|
177
|
-
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
|
178
|
-
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
|
179
|
-
vec3 phi23 = vec3( 0.0 );
|
|
180
|
-
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
|
181
|
-
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
|
182
|
-
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
|
183
|
-
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
|
184
|
-
vec3 phi = vec3( phi21 ) + phi23;
|
|
185
|
-
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
|
186
|
-
vec3 r123 = sqrt( R123 );
|
|
187
|
-
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
|
188
|
-
vec3 C0 = R12 + Rs;
|
|
189
|
-
I = C0;
|
|
190
|
-
vec3 Cm = Rs - T121;
|
|
191
|
-
for ( int m = 1; m <= 2; ++ m ) {
|
|
192
|
-
Cm *= r123;
|
|
193
|
-
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
|
194
|
-
I += Cm * Sm;
|
|
195
|
-
}
|
|
196
|
-
return max( I, vec3( 0.0 ) );
|
|
197
|
-
}
|
|
198
|
-
#endif`,to=`#ifdef USE_BUMPMAP
|
|
199
|
-
uniform sampler2D bumpMap;
|
|
200
|
-
uniform float bumpScale;
|
|
201
|
-
vec2 dHdxy_fwd() {
|
|
202
|
-
vec2 dSTdx = dFdx( vBumpMapUv );
|
|
203
|
-
vec2 dSTdy = dFdy( vBumpMapUv );
|
|
204
|
-
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
|
205
|
-
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
|
206
|
-
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
|
207
|
-
return vec2( dBx, dBy );
|
|
208
|
-
}
|
|
209
|
-
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
210
|
-
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
|
211
|
-
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
|
212
|
-
vec3 vN = surf_norm;
|
|
213
|
-
vec3 R1 = cross( vSigmaY, vN );
|
|
214
|
-
vec3 R2 = cross( vN, vSigmaX );
|
|
215
|
-
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
216
|
-
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
217
|
-
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
218
|
-
}
|
|
219
|
-
#endif`,no=`#if NUM_CLIPPING_PLANES > 0
|
|
220
|
-
vec4 plane;
|
|
221
|
-
#ifdef ALPHA_TO_COVERAGE
|
|
222
|
-
float distanceToPlane, distanceGradient;
|
|
223
|
-
float clipOpacity = 1.0;
|
|
224
|
-
#pragma unroll_loop_start
|
|
225
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
226
|
-
plane = clippingPlanes[ i ];
|
|
227
|
-
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
228
|
-
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
229
|
-
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
230
|
-
if ( clipOpacity == 0.0 ) discard;
|
|
231
|
-
}
|
|
232
|
-
#pragma unroll_loop_end
|
|
233
|
-
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
234
|
-
float unionClipOpacity = 1.0;
|
|
235
|
-
#pragma unroll_loop_start
|
|
236
|
-
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
237
|
-
plane = clippingPlanes[ i ];
|
|
238
|
-
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
239
|
-
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
240
|
-
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
241
|
-
}
|
|
242
|
-
#pragma unroll_loop_end
|
|
243
|
-
clipOpacity *= 1.0 - unionClipOpacity;
|
|
244
|
-
#endif
|
|
245
|
-
diffuseColor.a *= clipOpacity;
|
|
246
|
-
if ( diffuseColor.a == 0.0 ) discard;
|
|
247
|
-
#else
|
|
248
|
-
#pragma unroll_loop_start
|
|
249
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
250
|
-
plane = clippingPlanes[ i ];
|
|
251
|
-
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
252
|
-
}
|
|
253
|
-
#pragma unroll_loop_end
|
|
254
|
-
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
255
|
-
bool clipped = true;
|
|
256
|
-
#pragma unroll_loop_start
|
|
257
|
-
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
258
|
-
plane = clippingPlanes[ i ];
|
|
259
|
-
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
260
|
-
}
|
|
261
|
-
#pragma unroll_loop_end
|
|
262
|
-
if ( clipped ) discard;
|
|
263
|
-
#endif
|
|
264
|
-
#endif
|
|
265
|
-
#endif`,io=`#if NUM_CLIPPING_PLANES > 0
|
|
266
|
-
varying vec3 vClipPosition;
|
|
267
|
-
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
268
|
-
#endif`,ro=`#if NUM_CLIPPING_PLANES > 0
|
|
269
|
-
varying vec3 vClipPosition;
|
|
270
|
-
#endif`,so=`#if NUM_CLIPPING_PLANES > 0
|
|
271
|
-
vClipPosition = - mvPosition.xyz;
|
|
272
|
-
#endif`,ao=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
273
|
-
diffuseColor *= vColor;
|
|
274
|
-
#endif`,oo=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
275
|
-
varying vec4 vColor;
|
|
276
|
-
#endif`,lo=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
277
|
-
varying vec4 vColor;
|
|
278
|
-
#endif`,co=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
279
|
-
vColor = vec4( 1.0 );
|
|
280
|
-
#endif
|
|
281
|
-
#ifdef USE_COLOR_ALPHA
|
|
282
|
-
vColor *= color;
|
|
283
|
-
#elif defined( USE_COLOR )
|
|
284
|
-
vColor.rgb *= color;
|
|
285
|
-
#endif
|
|
286
|
-
#ifdef USE_INSTANCING_COLOR
|
|
287
|
-
vColor.rgb *= instanceColor.rgb;
|
|
288
|
-
#endif
|
|
289
|
-
#ifdef USE_BATCHING_COLOR
|
|
290
|
-
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
291
|
-
#endif`,uo=`#define PI 3.141592653589793
|
|
292
|
-
#define PI2 6.283185307179586
|
|
293
|
-
#define PI_HALF 1.5707963267948966
|
|
294
|
-
#define RECIPROCAL_PI 0.3183098861837907
|
|
295
|
-
#define RECIPROCAL_PI2 0.15915494309189535
|
|
296
|
-
#define EPSILON 1e-6
|
|
297
|
-
#ifndef saturate
|
|
298
|
-
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
299
|
-
#endif
|
|
300
|
-
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
301
|
-
float pow2( const in float x ) { return x*x; }
|
|
302
|
-
vec3 pow2( const in vec3 x ) { return x*x; }
|
|
303
|
-
float pow3( const in float x ) { return x*x*x; }
|
|
304
|
-
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
305
|
-
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
306
|
-
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
|
307
|
-
highp float rand( const in vec2 uv ) {
|
|
308
|
-
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
309
|
-
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
310
|
-
return fract( sin( sn ) * c );
|
|
311
|
-
}
|
|
312
|
-
#ifdef HIGH_PRECISION
|
|
313
|
-
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
314
|
-
#else
|
|
315
|
-
float precisionSafeLength( vec3 v ) {
|
|
316
|
-
float maxComponent = max3( abs( v ) );
|
|
317
|
-
return length( v / maxComponent ) * maxComponent;
|
|
318
|
-
}
|
|
319
|
-
#endif
|
|
320
|
-
struct IncidentLight {
|
|
321
|
-
vec3 color;
|
|
322
|
-
vec3 direction;
|
|
323
|
-
bool visible;
|
|
324
|
-
};
|
|
325
|
-
struct ReflectedLight {
|
|
326
|
-
vec3 directDiffuse;
|
|
327
|
-
vec3 directSpecular;
|
|
328
|
-
vec3 indirectDiffuse;
|
|
329
|
-
vec3 indirectSpecular;
|
|
330
|
-
};
|
|
331
|
-
#ifdef USE_ALPHAHASH
|
|
332
|
-
varying vec3 vPosition;
|
|
333
|
-
#endif
|
|
334
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
335
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
336
|
-
}
|
|
337
|
-
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
338
|
-
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
339
|
-
}
|
|
340
|
-
bool isPerspectiveMatrix( mat4 m ) {
|
|
341
|
-
return m[ 2 ][ 3 ] == - 1.0;
|
|
342
|
-
}
|
|
343
|
-
vec2 equirectUv( in vec3 dir ) {
|
|
344
|
-
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
345
|
-
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
346
|
-
return vec2( u, v );
|
|
347
|
-
}
|
|
348
|
-
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
349
|
-
return RECIPROCAL_PI * diffuseColor;
|
|
350
|
-
}
|
|
351
|
-
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
352
|
-
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
353
|
-
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
354
|
-
}
|
|
355
|
-
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
356
|
-
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
357
|
-
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
358
|
-
} // validated`,fo=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
359
|
-
#define cubeUV_minMipLevel 4.0
|
|
360
|
-
#define cubeUV_minTileSize 16.0
|
|
361
|
-
float getFace( vec3 direction ) {
|
|
362
|
-
vec3 absDirection = abs( direction );
|
|
363
|
-
float face = - 1.0;
|
|
364
|
-
if ( absDirection.x > absDirection.z ) {
|
|
365
|
-
if ( absDirection.x > absDirection.y )
|
|
366
|
-
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
367
|
-
else
|
|
368
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
369
|
-
} else {
|
|
370
|
-
if ( absDirection.z > absDirection.y )
|
|
371
|
-
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
372
|
-
else
|
|
373
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
374
|
-
}
|
|
375
|
-
return face;
|
|
376
|
-
}
|
|
377
|
-
vec2 getUV( vec3 direction, float face ) {
|
|
378
|
-
vec2 uv;
|
|
379
|
-
if ( face == 0.0 ) {
|
|
380
|
-
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
381
|
-
} else if ( face == 1.0 ) {
|
|
382
|
-
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
383
|
-
} else if ( face == 2.0 ) {
|
|
384
|
-
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
385
|
-
} else if ( face == 3.0 ) {
|
|
386
|
-
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
387
|
-
} else if ( face == 4.0 ) {
|
|
388
|
-
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
389
|
-
} else {
|
|
390
|
-
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
391
|
-
}
|
|
392
|
-
return 0.5 * ( uv + 1.0 );
|
|
393
|
-
}
|
|
394
|
-
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
395
|
-
float face = getFace( direction );
|
|
396
|
-
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
397
|
-
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
398
|
-
float faceSize = exp2( mipInt );
|
|
399
|
-
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
|
400
|
-
if ( face > 2.0 ) {
|
|
401
|
-
uv.y += faceSize;
|
|
402
|
-
face -= 3.0;
|
|
403
|
-
}
|
|
404
|
-
uv.x += face * faceSize;
|
|
405
|
-
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|
406
|
-
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|
407
|
-
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|
408
|
-
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|
409
|
-
#ifdef texture2DGradEXT
|
|
410
|
-
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|
411
|
-
#else
|
|
412
|
-
return texture2D( envMap, uv ).rgb;
|
|
413
|
-
#endif
|
|
414
|
-
}
|
|
415
|
-
#define cubeUV_r0 1.0
|
|
416
|
-
#define cubeUV_m0 - 2.0
|
|
417
|
-
#define cubeUV_r1 0.8
|
|
418
|
-
#define cubeUV_m1 - 1.0
|
|
419
|
-
#define cubeUV_r4 0.4
|
|
420
|
-
#define cubeUV_m4 2.0
|
|
421
|
-
#define cubeUV_r5 0.305
|
|
422
|
-
#define cubeUV_m5 3.0
|
|
423
|
-
#define cubeUV_r6 0.21
|
|
424
|
-
#define cubeUV_m6 4.0
|
|
425
|
-
float roughnessToMip( float roughness ) {
|
|
426
|
-
float mip = 0.0;
|
|
427
|
-
if ( roughness >= cubeUV_r1 ) {
|
|
428
|
-
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
|
429
|
-
} else if ( roughness >= cubeUV_r4 ) {
|
|
430
|
-
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
|
431
|
-
} else if ( roughness >= cubeUV_r5 ) {
|
|
432
|
-
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
|
433
|
-
} else if ( roughness >= cubeUV_r6 ) {
|
|
434
|
-
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
|
435
|
-
} else {
|
|
436
|
-
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
437
|
-
return mip;
|
|
438
|
-
}
|
|
439
|
-
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
440
|
-
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
|
441
|
-
float mipF = fract( mip );
|
|
442
|
-
float mipInt = floor( mip );
|
|
443
|
-
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
444
|
-
if ( mipF == 0.0 ) {
|
|
445
|
-
return vec4( color0, 1.0 );
|
|
446
|
-
} else {
|
|
447
|
-
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
448
|
-
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
#endif`,ho=`vec3 transformedNormal = objectNormal;
|
|
452
|
-
#ifdef USE_TANGENT
|
|
453
|
-
vec3 transformedTangent = objectTangent;
|
|
454
|
-
#endif
|
|
455
|
-
#ifdef USE_BATCHING
|
|
456
|
-
mat3 bm = mat3( batchingMatrix );
|
|
457
|
-
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
|
458
|
-
transformedNormal = bm * transformedNormal;
|
|
459
|
-
#ifdef USE_TANGENT
|
|
460
|
-
transformedTangent = bm * transformedTangent;
|
|
461
|
-
#endif
|
|
462
|
-
#endif
|
|
463
|
-
#ifdef USE_INSTANCING
|
|
464
|
-
mat3 im = mat3( instanceMatrix );
|
|
465
|
-
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
|
466
|
-
transformedNormal = im * transformedNormal;
|
|
467
|
-
#ifdef USE_TANGENT
|
|
468
|
-
transformedTangent = im * transformedTangent;
|
|
469
|
-
#endif
|
|
470
|
-
#endif
|
|
471
|
-
transformedNormal = normalMatrix * transformedNormal;
|
|
472
|
-
#ifdef FLIP_SIDED
|
|
473
|
-
transformedNormal = - transformedNormal;
|
|
474
|
-
#endif
|
|
475
|
-
#ifdef USE_TANGENT
|
|
476
|
-
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|
477
|
-
#ifdef FLIP_SIDED
|
|
478
|
-
transformedTangent = - transformedTangent;
|
|
479
|
-
#endif
|
|
480
|
-
#endif`,po=`#ifdef USE_DISPLACEMENTMAP
|
|
481
|
-
uniform sampler2D displacementMap;
|
|
482
|
-
uniform float displacementScale;
|
|
483
|
-
uniform float displacementBias;
|
|
484
|
-
#endif`,mo=`#ifdef USE_DISPLACEMENTMAP
|
|
485
|
-
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
486
|
-
#endif`,_o=`#ifdef USE_EMISSIVEMAP
|
|
487
|
-
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
488
|
-
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
489
|
-
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
490
|
-
#endif
|
|
491
|
-
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
492
|
-
#endif`,go=`#ifdef USE_EMISSIVEMAP
|
|
493
|
-
uniform sampler2D emissiveMap;
|
|
494
|
-
#endif`,xo="gl_FragColor = linearToOutputTexel( gl_FragColor );",vo=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
495
|
-
return value;
|
|
496
|
-
}
|
|
497
|
-
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
498
|
-
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
499
|
-
}
|
|
500
|
-
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
501
|
-
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 );
|
|
502
|
-
}`,So=`#ifdef USE_ENVMAP
|
|
503
|
-
#ifdef ENV_WORLDPOS
|
|
504
|
-
vec3 cameraToFrag;
|
|
505
|
-
if ( isOrthographic ) {
|
|
506
|
-
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
507
|
-
} else {
|
|
508
|
-
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
509
|
-
}
|
|
510
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
511
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
512
|
-
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
513
|
-
#else
|
|
514
|
-
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
515
|
-
#endif
|
|
516
|
-
#else
|
|
517
|
-
vec3 reflectVec = vReflect;
|
|
518
|
-
#endif
|
|
519
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
520
|
-
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
521
|
-
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
522
|
-
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
523
|
-
#elif defined( ENVMAP_BLENDING_MIX )
|
|
524
|
-
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
525
|
-
#elif defined( ENVMAP_BLENDING_ADD )
|
|
526
|
-
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
527
|
-
#endif
|
|
528
|
-
#endif
|
|
529
|
-
#endif`,Mo=`#ifdef USE_ENVMAP
|
|
530
|
-
uniform float envMapIntensity;
|
|
531
|
-
uniform float flipEnvMap;
|
|
532
|
-
uniform mat3 envMapRotation;
|
|
533
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
534
|
-
uniform samplerCube envMap;
|
|
535
|
-
#else
|
|
536
|
-
uniform sampler2D envMap;
|
|
537
|
-
#endif
|
|
538
|
-
#endif`,Eo=`#ifdef USE_ENVMAP
|
|
539
|
-
uniform float reflectivity;
|
|
540
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
541
|
-
#define ENV_WORLDPOS
|
|
542
|
-
#endif
|
|
543
|
-
#ifdef ENV_WORLDPOS
|
|
544
|
-
varying vec3 vWorldPosition;
|
|
545
|
-
uniform float refractionRatio;
|
|
546
|
-
#else
|
|
547
|
-
varying vec3 vReflect;
|
|
548
|
-
#endif
|
|
549
|
-
#endif`,To=`#ifdef USE_ENVMAP
|
|
550
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
551
|
-
#define ENV_WORLDPOS
|
|
552
|
-
#endif
|
|
553
|
-
#ifdef ENV_WORLDPOS
|
|
554
|
-
|
|
555
|
-
varying vec3 vWorldPosition;
|
|
556
|
-
#else
|
|
557
|
-
varying vec3 vReflect;
|
|
558
|
-
uniform float refractionRatio;
|
|
559
|
-
#endif
|
|
560
|
-
#endif`,yo=`#ifdef USE_ENVMAP
|
|
561
|
-
#ifdef ENV_WORLDPOS
|
|
562
|
-
vWorldPosition = worldPosition.xyz;
|
|
563
|
-
#else
|
|
564
|
-
vec3 cameraToVertex;
|
|
565
|
-
if ( isOrthographic ) {
|
|
566
|
-
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
567
|
-
} else {
|
|
568
|
-
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
569
|
-
}
|
|
570
|
-
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
571
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
572
|
-
vReflect = reflect( cameraToVertex, worldNormal );
|
|
573
|
-
#else
|
|
574
|
-
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
575
|
-
#endif
|
|
576
|
-
#endif
|
|
577
|
-
#endif`,Ao=`#ifdef USE_FOG
|
|
578
|
-
vFogDepth = - mvPosition.z;
|
|
579
|
-
#endif`,bo=`#ifdef USE_FOG
|
|
580
|
-
varying float vFogDepth;
|
|
581
|
-
#endif`,Ro=`#ifdef USE_FOG
|
|
582
|
-
#ifdef FOG_EXP2
|
|
583
|
-
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
584
|
-
#else
|
|
585
|
-
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
586
|
-
#endif
|
|
587
|
-
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
588
|
-
#endif`,Co=`#ifdef USE_FOG
|
|
589
|
-
uniform vec3 fogColor;
|
|
590
|
-
varying float vFogDepth;
|
|
591
|
-
#ifdef FOG_EXP2
|
|
592
|
-
uniform float fogDensity;
|
|
593
|
-
#else
|
|
594
|
-
uniform float fogNear;
|
|
595
|
-
uniform float fogFar;
|
|
596
|
-
#endif
|
|
597
|
-
#endif`,wo=`#ifdef USE_GRADIENTMAP
|
|
598
|
-
uniform sampler2D gradientMap;
|
|
599
|
-
#endif
|
|
600
|
-
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
601
|
-
float dotNL = dot( normal, lightDirection );
|
|
602
|
-
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
603
|
-
#ifdef USE_GRADIENTMAP
|
|
604
|
-
return vec3( texture2D( gradientMap, coord ).r );
|
|
605
|
-
#else
|
|
606
|
-
vec2 fw = fwidth( coord ) * 0.5;
|
|
607
|
-
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
608
|
-
#endif
|
|
609
|
-
}`,Po=`#ifdef USE_LIGHTMAP
|
|
610
|
-
uniform sampler2D lightMap;
|
|
611
|
-
uniform float lightMapIntensity;
|
|
612
|
-
#endif`,Do=`LambertMaterial material;
|
|
613
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
614
|
-
material.specularStrength = specularStrength;`,Lo=`varying vec3 vViewPosition;
|
|
615
|
-
struct LambertMaterial {
|
|
616
|
-
vec3 diffuseColor;
|
|
617
|
-
float specularStrength;
|
|
618
|
-
};
|
|
619
|
-
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 ) {
|
|
620
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
621
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
622
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
623
|
-
}
|
|
624
|
-
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 ) {
|
|
625
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
626
|
-
}
|
|
627
|
-
#define RE_Direct RE_Direct_Lambert
|
|
628
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Fo=`uniform bool receiveShadow;
|
|
629
|
-
uniform vec3 ambientLightColor;
|
|
630
|
-
#if defined( USE_LIGHT_PROBES )
|
|
631
|
-
uniform vec3 lightProbe[ 9 ];
|
|
632
|
-
#endif
|
|
633
|
-
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
634
|
-
float x = normal.x, y = normal.y, z = normal.z;
|
|
635
|
-
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
636
|
-
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
637
|
-
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
638
|
-
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
639
|
-
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
640
|
-
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
641
|
-
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
642
|
-
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
643
|
-
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
647
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
648
|
-
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
649
|
-
return irradiance;
|
|
650
|
-
}
|
|
651
|
-
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
652
|
-
vec3 irradiance = ambientLightColor;
|
|
653
|
-
return irradiance;
|
|
654
|
-
}
|
|
655
|
-
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
656
|
-
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
657
|
-
if ( cutoffDistance > 0.0 ) {
|
|
658
|
-
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
659
|
-
}
|
|
660
|
-
return distanceFalloff;
|
|
661
|
-
}
|
|
662
|
-
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
663
|
-
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
664
|
-
}
|
|
665
|
-
#if NUM_DIR_LIGHTS > 0
|
|
666
|
-
struct DirectionalLight {
|
|
667
|
-
vec3 direction;
|
|
668
|
-
vec3 color;
|
|
669
|
-
};
|
|
670
|
-
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
671
|
-
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
|
672
|
-
light.color = directionalLight.color;
|
|
673
|
-
light.direction = directionalLight.direction;
|
|
674
|
-
light.visible = true;
|
|
675
|
-
}
|
|
676
|
-
#endif
|
|
677
|
-
#if NUM_POINT_LIGHTS > 0
|
|
678
|
-
struct PointLight {
|
|
679
|
-
vec3 position;
|
|
680
|
-
vec3 color;
|
|
681
|
-
float distance;
|
|
682
|
-
float decay;
|
|
683
|
-
};
|
|
684
|
-
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
685
|
-
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
686
|
-
vec3 lVector = pointLight.position - geometryPosition;
|
|
687
|
-
light.direction = normalize( lVector );
|
|
688
|
-
float lightDistance = length( lVector );
|
|
689
|
-
light.color = pointLight.color;
|
|
690
|
-
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
691
|
-
light.visible = ( light.color != vec3( 0.0 ) );
|
|
692
|
-
}
|
|
693
|
-
#endif
|
|
694
|
-
#if NUM_SPOT_LIGHTS > 0
|
|
695
|
-
struct SpotLight {
|
|
696
|
-
vec3 position;
|
|
697
|
-
vec3 direction;
|
|
698
|
-
vec3 color;
|
|
699
|
-
float distance;
|
|
700
|
-
float decay;
|
|
701
|
-
float coneCos;
|
|
702
|
-
float penumbraCos;
|
|
703
|
-
};
|
|
704
|
-
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
705
|
-
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
706
|
-
vec3 lVector = spotLight.position - geometryPosition;
|
|
707
|
-
light.direction = normalize( lVector );
|
|
708
|
-
float angleCos = dot( light.direction, spotLight.direction );
|
|
709
|
-
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
710
|
-
if ( spotAttenuation > 0.0 ) {
|
|
711
|
-
float lightDistance = length( lVector );
|
|
712
|
-
light.color = spotLight.color * spotAttenuation;
|
|
713
|
-
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
714
|
-
light.visible = ( light.color != vec3( 0.0 ) );
|
|
715
|
-
} else {
|
|
716
|
-
light.color = vec3( 0.0 );
|
|
717
|
-
light.visible = false;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
#endif
|
|
721
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
722
|
-
struct RectAreaLight {
|
|
723
|
-
vec3 color;
|
|
724
|
-
vec3 position;
|
|
725
|
-
vec3 halfWidth;
|
|
726
|
-
vec3 halfHeight;
|
|
727
|
-
};
|
|
728
|
-
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
729
|
-
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
730
|
-
#endif
|
|
731
|
-
#if NUM_HEMI_LIGHTS > 0
|
|
732
|
-
struct HemisphereLight {
|
|
733
|
-
vec3 direction;
|
|
734
|
-
vec3 skyColor;
|
|
735
|
-
vec3 groundColor;
|
|
736
|
-
};
|
|
737
|
-
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
738
|
-
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
739
|
-
float dotNL = dot( normal, hemiLight.direction );
|
|
740
|
-
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
741
|
-
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
742
|
-
return irradiance;
|
|
743
|
-
}
|
|
744
|
-
#endif`,Uo=`#ifdef USE_ENVMAP
|
|
745
|
-
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
746
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
747
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
748
|
-
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
|
|
749
|
-
return PI * envMapColor.rgb * envMapIntensity;
|
|
750
|
-
#else
|
|
751
|
-
return vec3( 0.0 );
|
|
752
|
-
#endif
|
|
753
|
-
}
|
|
754
|
-
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
755
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
756
|
-
vec3 reflectVec = reflect( - viewDir, normal );
|
|
757
|
-
reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
|
|
758
|
-
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
759
|
-
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
|
|
760
|
-
return envMapColor.rgb * envMapIntensity;
|
|
761
|
-
#else
|
|
762
|
-
return vec3( 0.0 );
|
|
763
|
-
#endif
|
|
764
|
-
}
|
|
765
|
-
#ifdef USE_ANISOTROPY
|
|
766
|
-
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
|
767
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
768
|
-
vec3 bentNormal = cross( bitangent, viewDir );
|
|
769
|
-
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
|
770
|
-
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
|
771
|
-
return getIBLRadiance( viewDir, bentNormal, roughness );
|
|
772
|
-
#else
|
|
773
|
-
return vec3( 0.0 );
|
|
774
|
-
#endif
|
|
775
|
-
}
|
|
776
|
-
#endif
|
|
777
|
-
#endif`,Io=`ToonMaterial material;
|
|
778
|
-
material.diffuseColor = diffuseColor.rgb;`,No=`varying vec3 vViewPosition;
|
|
779
|
-
struct ToonMaterial {
|
|
780
|
-
vec3 diffuseColor;
|
|
781
|
-
};
|
|
782
|
-
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 ) {
|
|
783
|
-
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
|
784
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
785
|
-
}
|
|
786
|
-
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 ) {
|
|
787
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
788
|
-
}
|
|
789
|
-
#define RE_Direct RE_Direct_Toon
|
|
790
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Oo=`BlinnPhongMaterial material;
|
|
791
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
792
|
-
material.specularColor = specular;
|
|
793
|
-
material.specularShininess = shininess;
|
|
794
|
-
material.specularStrength = specularStrength;`,Bo=`varying vec3 vViewPosition;
|
|
795
|
-
struct BlinnPhongMaterial {
|
|
796
|
-
vec3 diffuseColor;
|
|
797
|
-
vec3 specularColor;
|
|
798
|
-
float specularShininess;
|
|
799
|
-
float specularStrength;
|
|
800
|
-
};
|
|
801
|
-
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 ) {
|
|
802
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
803
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
804
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
805
|
-
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
806
|
-
}
|
|
807
|
-
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 ) {
|
|
808
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
809
|
-
}
|
|
810
|
-
#define RE_Direct RE_Direct_BlinnPhong
|
|
811
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Go=`PhysicalMaterial material;
|
|
812
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
813
|
-
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
814
|
-
material.metalness = metalnessFactor;
|
|
815
|
-
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
816
|
-
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
817
|
-
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
818
|
-
material.roughness = min( material.roughness, 1.0 );
|
|
819
|
-
#ifdef IOR
|
|
820
|
-
material.ior = ior;
|
|
821
|
-
#ifdef USE_SPECULAR
|
|
822
|
-
float specularIntensityFactor = specularIntensity;
|
|
823
|
-
vec3 specularColorFactor = specularColor;
|
|
824
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
825
|
-
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
|
826
|
-
#endif
|
|
827
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
828
|
-
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
|
829
|
-
#endif
|
|
830
|
-
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
831
|
-
#else
|
|
832
|
-
float specularIntensityFactor = 1.0;
|
|
833
|
-
vec3 specularColorFactor = vec3( 1.0 );
|
|
834
|
-
material.specularF90 = 1.0;
|
|
835
|
-
#endif
|
|
836
|
-
material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
|
|
837
|
-
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
|
838
|
-
#else
|
|
839
|
-
material.specularColor = vec3( 0.04 );
|
|
840
|
-
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
|
841
|
-
material.specularF90 = 1.0;
|
|
842
|
-
#endif
|
|
843
|
-
#ifdef USE_CLEARCOAT
|
|
844
|
-
material.clearcoat = clearcoat;
|
|
845
|
-
material.clearcoatRoughness = clearcoatRoughness;
|
|
846
|
-
material.clearcoatF0 = vec3( 0.04 );
|
|
847
|
-
material.clearcoatF90 = 1.0;
|
|
848
|
-
#ifdef USE_CLEARCOATMAP
|
|
849
|
-
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
|
850
|
-
#endif
|
|
851
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
852
|
-
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
|
853
|
-
#endif
|
|
854
|
-
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
855
|
-
material.clearcoatRoughness += geometryRoughness;
|
|
856
|
-
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
857
|
-
#endif
|
|
858
|
-
#ifdef USE_DISPERSION
|
|
859
|
-
material.dispersion = dispersion;
|
|
860
|
-
#endif
|
|
861
|
-
#ifdef USE_IRIDESCENCE
|
|
862
|
-
material.iridescence = iridescence;
|
|
863
|
-
material.iridescenceIOR = iridescenceIOR;
|
|
864
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
865
|
-
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
|
866
|
-
#endif
|
|
867
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
868
|
-
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
|
869
|
-
#else
|
|
870
|
-
material.iridescenceThickness = iridescenceThicknessMaximum;
|
|
871
|
-
#endif
|
|
872
|
-
#endif
|
|
873
|
-
#ifdef USE_SHEEN
|
|
874
|
-
material.sheenColor = sheenColor;
|
|
875
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
876
|
-
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
|
877
|
-
#endif
|
|
878
|
-
material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
|
|
879
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
880
|
-
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
|
881
|
-
#endif
|
|
882
|
-
#endif
|
|
883
|
-
#ifdef USE_ANISOTROPY
|
|
884
|
-
#ifdef USE_ANISOTROPYMAP
|
|
885
|
-
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
|
886
|
-
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
|
887
|
-
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
|
888
|
-
#else
|
|
889
|
-
vec2 anisotropyV = anisotropyVector;
|
|
890
|
-
#endif
|
|
891
|
-
material.anisotropy = length( anisotropyV );
|
|
892
|
-
if( material.anisotropy == 0.0 ) {
|
|
893
|
-
anisotropyV = vec2( 1.0, 0.0 );
|
|
894
|
-
} else {
|
|
895
|
-
anisotropyV /= material.anisotropy;
|
|
896
|
-
material.anisotropy = saturate( material.anisotropy );
|
|
897
|
-
}
|
|
898
|
-
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
899
|
-
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
900
|
-
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
901
|
-
#endif`,zo=`uniform sampler2D dfgLUT;
|
|
902
|
-
struct PhysicalMaterial {
|
|
903
|
-
vec3 diffuseColor;
|
|
904
|
-
vec3 diffuseContribution;
|
|
905
|
-
vec3 specularColor;
|
|
906
|
-
vec3 specularColorBlended;
|
|
907
|
-
float roughness;
|
|
908
|
-
float metalness;
|
|
909
|
-
float specularF90;
|
|
910
|
-
float dispersion;
|
|
911
|
-
#ifdef USE_CLEARCOAT
|
|
912
|
-
float clearcoat;
|
|
913
|
-
float clearcoatRoughness;
|
|
914
|
-
vec3 clearcoatF0;
|
|
915
|
-
float clearcoatF90;
|
|
916
|
-
#endif
|
|
917
|
-
#ifdef USE_IRIDESCENCE
|
|
918
|
-
float iridescence;
|
|
919
|
-
float iridescenceIOR;
|
|
920
|
-
float iridescenceThickness;
|
|
921
|
-
vec3 iridescenceFresnel;
|
|
922
|
-
vec3 iridescenceF0;
|
|
923
|
-
vec3 iridescenceFresnelDielectric;
|
|
924
|
-
vec3 iridescenceFresnelMetallic;
|
|
925
|
-
#endif
|
|
926
|
-
#ifdef USE_SHEEN
|
|
927
|
-
vec3 sheenColor;
|
|
928
|
-
float sheenRoughness;
|
|
929
|
-
#endif
|
|
930
|
-
#ifdef IOR
|
|
931
|
-
float ior;
|
|
932
|
-
#endif
|
|
933
|
-
#ifdef USE_TRANSMISSION
|
|
934
|
-
float transmission;
|
|
935
|
-
float transmissionAlpha;
|
|
936
|
-
float thickness;
|
|
937
|
-
float attenuationDistance;
|
|
938
|
-
vec3 attenuationColor;
|
|
939
|
-
#endif
|
|
940
|
-
#ifdef USE_ANISOTROPY
|
|
941
|
-
float anisotropy;
|
|
942
|
-
float alphaT;
|
|
943
|
-
vec3 anisotropyT;
|
|
944
|
-
vec3 anisotropyB;
|
|
945
|
-
#endif
|
|
946
|
-
};
|
|
947
|
-
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
|
948
|
-
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
|
949
|
-
vec3 sheenSpecularDirect = vec3( 0.0 );
|
|
950
|
-
vec3 sheenSpecularIndirect = vec3(0.0 );
|
|
951
|
-
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
|
952
|
-
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
|
953
|
-
float x2 = x * x;
|
|
954
|
-
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
|
955
|
-
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
|
956
|
-
}
|
|
957
|
-
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
958
|
-
float a2 = pow2( alpha );
|
|
959
|
-
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
960
|
-
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
961
|
-
return 0.5 / max( gv + gl, EPSILON );
|
|
962
|
-
}
|
|
963
|
-
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
964
|
-
float a2 = pow2( alpha );
|
|
965
|
-
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
966
|
-
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
967
|
-
}
|
|
968
|
-
#ifdef USE_ANISOTROPY
|
|
969
|
-
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 ) {
|
|
970
|
-
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
|
971
|
-
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
|
972
|
-
float v = 0.5 / ( gv + gl );
|
|
973
|
-
return v;
|
|
974
|
-
}
|
|
975
|
-
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
|
976
|
-
float a2 = alphaT * alphaB;
|
|
977
|
-
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
|
978
|
-
highp float v2 = dot( v, v );
|
|
979
|
-
float w2 = a2 / v2;
|
|
980
|
-
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
|
981
|
-
}
|
|
982
|
-
#endif
|
|
983
|
-
#ifdef USE_CLEARCOAT
|
|
984
|
-
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
|
985
|
-
vec3 f0 = material.clearcoatF0;
|
|
986
|
-
float f90 = material.clearcoatF90;
|
|
987
|
-
float roughness = material.clearcoatRoughness;
|
|
988
|
-
float alpha = pow2( roughness );
|
|
989
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
990
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
991
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
992
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
993
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
994
|
-
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
995
|
-
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
996
|
-
float D = D_GGX( alpha, dotNH );
|
|
997
|
-
return F * ( V * D );
|
|
998
|
-
}
|
|
999
|
-
#endif
|
|
1000
|
-
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
|
1001
|
-
vec3 f0 = material.specularColorBlended;
|
|
1002
|
-
float f90 = material.specularF90;
|
|
1003
|
-
float roughness = material.roughness;
|
|
1004
|
-
float alpha = pow2( roughness );
|
|
1005
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1006
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1007
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1008
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1009
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
1010
|
-
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
1011
|
-
#ifdef USE_IRIDESCENCE
|
|
1012
|
-
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
|
1013
|
-
#endif
|
|
1014
|
-
#ifdef USE_ANISOTROPY
|
|
1015
|
-
float dotTL = dot( material.anisotropyT, lightDir );
|
|
1016
|
-
float dotTV = dot( material.anisotropyT, viewDir );
|
|
1017
|
-
float dotTH = dot( material.anisotropyT, halfDir );
|
|
1018
|
-
float dotBL = dot( material.anisotropyB, lightDir );
|
|
1019
|
-
float dotBV = dot( material.anisotropyB, viewDir );
|
|
1020
|
-
float dotBH = dot( material.anisotropyB, halfDir );
|
|
1021
|
-
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
|
1022
|
-
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
|
1023
|
-
#else
|
|
1024
|
-
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
1025
|
-
float D = D_GGX( alpha, dotNH );
|
|
1026
|
-
#endif
|
|
1027
|
-
return F * ( V * D );
|
|
1028
|
-
}
|
|
1029
|
-
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
1030
|
-
const float LUT_SIZE = 64.0;
|
|
1031
|
-
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
1032
|
-
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
1033
|
-
float dotNV = saturate( dot( N, V ) );
|
|
1034
|
-
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
1035
|
-
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
1036
|
-
return uv;
|
|
1037
|
-
}
|
|
1038
|
-
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
1039
|
-
float l = length( f );
|
|
1040
|
-
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
1041
|
-
}
|
|
1042
|
-
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
1043
|
-
float x = dot( v1, v2 );
|
|
1044
|
-
float y = abs( x );
|
|
1045
|
-
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
1046
|
-
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
1047
|
-
float v = a / b;
|
|
1048
|
-
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
1049
|
-
return cross( v1, v2 ) * theta_sintheta;
|
|
1050
|
-
}
|
|
1051
|
-
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
1052
|
-
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
1053
|
-
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
1054
|
-
vec3 lightNormal = cross( v1, v2 );
|
|
1055
|
-
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
1056
|
-
vec3 T1, T2;
|
|
1057
|
-
T1 = normalize( V - N * dot( V, N ) );
|
|
1058
|
-
T2 = - cross( N, T1 );
|
|
1059
|
-
mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
|
|
1060
|
-
vec3 coords[ 4 ];
|
|
1061
|
-
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
1062
|
-
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
1063
|
-
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
1064
|
-
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
1065
|
-
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
1066
|
-
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
1067
|
-
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
1068
|
-
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
1069
|
-
vec3 vectorFormFactor = vec3( 0.0 );
|
|
1070
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
1071
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
1072
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
1073
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
1074
|
-
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
1075
|
-
return vec3( result );
|
|
1076
|
-
}
|
|
1077
|
-
#if defined( USE_SHEEN )
|
|
1078
|
-
float D_Charlie( float roughness, float dotNH ) {
|
|
1079
|
-
float alpha = pow2( roughness );
|
|
1080
|
-
float invAlpha = 1.0 / alpha;
|
|
1081
|
-
float cos2h = dotNH * dotNH;
|
|
1082
|
-
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
1083
|
-
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
1084
|
-
}
|
|
1085
|
-
float V_Neubelt( float dotNV, float dotNL ) {
|
|
1086
|
-
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
1087
|
-
}
|
|
1088
|
-
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
1089
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1090
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1091
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1092
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1093
|
-
float D = D_Charlie( sheenRoughness, dotNH );
|
|
1094
|
-
float V = V_Neubelt( dotNV, dotNL );
|
|
1095
|
-
return sheenColor * ( D * V );
|
|
1096
|
-
}
|
|
1097
|
-
#endif
|
|
1098
|
-
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
1099
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1100
|
-
float r2 = roughness * roughness;
|
|
1101
|
-
float rInv = 1.0 / ( roughness + 0.1 );
|
|
1102
|
-
float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
|
|
1103
|
-
float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
|
|
1104
|
-
float DG = exp( a * dotNV + b );
|
|
1105
|
-
return saturate( DG );
|
|
1106
|
-
}
|
|
1107
|
-
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
1108
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1109
|
-
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
|
|
1110
|
-
return specularColor * fab.x + specularF90 * fab.y;
|
|
1111
|
-
}
|
|
1112
|
-
#ifdef USE_IRIDESCENCE
|
|
1113
|
-
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 ) {
|
|
1114
|
-
#else
|
|
1115
|
-
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 ) {
|
|
1116
|
-
#endif
|
|
1117
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1118
|
-
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
|
|
1119
|
-
#ifdef USE_IRIDESCENCE
|
|
1120
|
-
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
|
1121
|
-
#else
|
|
1122
|
-
vec3 Fr = specularColor;
|
|
1123
|
-
#endif
|
|
1124
|
-
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
|
1125
|
-
float Ess = fab.x + fab.y;
|
|
1126
|
-
float Ems = 1.0 - Ess;
|
|
1127
|
-
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
1128
|
-
singleScatter += FssEss;
|
|
1129
|
-
multiScatter += Fms * Ems;
|
|
1130
|
-
}
|
|
1131
|
-
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
|
1132
|
-
vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
|
|
1133
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1134
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1135
|
-
vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
|
|
1136
|
-
vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
|
|
1137
|
-
vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
|
|
1138
|
-
vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
|
|
1139
|
-
float Ess_V = dfgV.x + dfgV.y;
|
|
1140
|
-
float Ess_L = dfgL.x + dfgL.y;
|
|
1141
|
-
float Ems_V = 1.0 - Ess_V;
|
|
1142
|
-
float Ems_L = 1.0 - Ess_L;
|
|
1143
|
-
vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
|
|
1144
|
-
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
|
|
1145
|
-
float compensationFactor = Ems_V * Ems_L;
|
|
1146
|
-
vec3 multiScatter = Fms * compensationFactor;
|
|
1147
|
-
return singleScatter + multiScatter;
|
|
1148
|
-
}
|
|
1149
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1150
|
-
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 ) {
|
|
1151
|
-
vec3 normal = geometryNormal;
|
|
1152
|
-
vec3 viewDir = geometryViewDir;
|
|
1153
|
-
vec3 position = geometryPosition;
|
|
1154
|
-
vec3 lightPos = rectAreaLight.position;
|
|
1155
|
-
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
1156
|
-
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
1157
|
-
vec3 lightColor = rectAreaLight.color;
|
|
1158
|
-
float roughness = material.roughness;
|
|
1159
|
-
vec3 rectCoords[ 4 ];
|
|
1160
|
-
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
1161
|
-
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
1162
|
-
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
1163
|
-
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
1164
|
-
vec4 t1 = texture2D( ltc_1, uv );
|
|
1165
|
-
vec4 t2 = texture2D( ltc_2, uv );
|
|
1166
|
-
mat3 mInv = mat3(
|
|
1167
|
-
vec3( t1.x, 0, t1.y ),
|
|
1168
|
-
vec3( 0, 1, 0 ),
|
|
1169
|
-
vec3( t1.z, 0, t1.w )
|
|
1170
|
-
);
|
|
1171
|
-
vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
|
|
1172
|
-
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
1173
|
-
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
1174
|
-
#ifdef USE_CLEARCOAT
|
|
1175
|
-
vec3 Ncc = geometryClearcoatNormal;
|
|
1176
|
-
vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
|
|
1177
|
-
vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
|
|
1178
|
-
vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
|
|
1179
|
-
mat3 mInvClearcoat = mat3(
|
|
1180
|
-
vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
|
|
1181
|
-
vec3( 0, 1, 0 ),
|
|
1182
|
-
vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
|
|
1183
|
-
);
|
|
1184
|
-
vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
|
|
1185
|
-
clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
|
|
1186
|
-
#endif
|
|
1187
|
-
}
|
|
1188
|
-
#endif
|
|
1189
|
-
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 ) {
|
|
1190
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
1191
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
1192
|
-
#ifdef USE_CLEARCOAT
|
|
1193
|
-
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
|
1194
|
-
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
1195
|
-
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
|
1196
|
-
#endif
|
|
1197
|
-
#ifdef USE_SHEEN
|
|
1198
|
-
|
|
1199
|
-
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
|
1200
|
-
|
|
1201
|
-
float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1202
|
-
float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
|
|
1203
|
-
|
|
1204
|
-
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
|
|
1205
|
-
|
|
1206
|
-
irradiance *= sheenEnergyComp;
|
|
1207
|
-
|
|
1208
|
-
#endif
|
|
1209
|
-
reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
|
|
1210
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
|
|
1211
|
-
}
|
|
1212
|
-
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 ) {
|
|
1213
|
-
vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
|
|
1214
|
-
#ifdef USE_SHEEN
|
|
1215
|
-
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1216
|
-
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
|
1217
|
-
diffuse *= sheenEnergyComp;
|
|
1218
|
-
#endif
|
|
1219
|
-
reflectedLight.indirectDiffuse += diffuse;
|
|
1220
|
-
}
|
|
1221
|
-
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) {
|
|
1222
|
-
#ifdef USE_CLEARCOAT
|
|
1223
|
-
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
1224
|
-
#endif
|
|
1225
|
-
#ifdef USE_SHEEN
|
|
1226
|
-
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
|
|
1227
|
-
#endif
|
|
1228
|
-
vec3 singleScatteringDielectric = vec3( 0.0 );
|
|
1229
|
-
vec3 multiScatteringDielectric = vec3( 0.0 );
|
|
1230
|
-
vec3 singleScatteringMetallic = vec3( 0.0 );
|
|
1231
|
-
vec3 multiScatteringMetallic = vec3( 0.0 );
|
|
1232
|
-
#ifdef USE_IRIDESCENCE
|
|
1233
|
-
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
|
|
1234
|
-
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
|
|
1235
|
-
#else
|
|
1236
|
-
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
|
|
1237
|
-
computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
|
|
1238
|
-
#endif
|
|
1239
|
-
vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
|
|
1240
|
-
vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
|
|
1241
|
-
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
|
|
1242
|
-
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
|
|
1243
|
-
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
1244
|
-
vec3 indirectSpecular = radiance * singleScattering;
|
|
1245
|
-
indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
1246
|
-
vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
|
|
1247
|
-
#ifdef USE_SHEEN
|
|
1248
|
-
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1249
|
-
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
|
1250
|
-
indirectSpecular *= sheenEnergyComp;
|
|
1251
|
-
indirectDiffuse *= sheenEnergyComp;
|
|
1252
|
-
#endif
|
|
1253
|
-
reflectedLight.indirectSpecular += indirectSpecular;
|
|
1254
|
-
reflectedLight.indirectDiffuse += indirectDiffuse;
|
|
1255
|
-
}
|
|
1256
|
-
#define RE_Direct RE_Direct_Physical
|
|
1257
|
-
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
1258
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
1259
|
-
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1260
|
-
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1261
|
-
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1262
|
-
}`,Vo=`
|
|
1263
|
-
vec3 geometryPosition = - vViewPosition;
|
|
1264
|
-
vec3 geometryNormal = normal;
|
|
1265
|
-
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1266
|
-
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
|
1267
|
-
#ifdef USE_CLEARCOAT
|
|
1268
|
-
geometryClearcoatNormal = clearcoatNormal;
|
|
1269
|
-
#endif
|
|
1270
|
-
#ifdef USE_IRIDESCENCE
|
|
1271
|
-
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
|
1272
|
-
if ( material.iridescenceThickness == 0.0 ) {
|
|
1273
|
-
material.iridescence = 0.0;
|
|
1274
|
-
} else {
|
|
1275
|
-
material.iridescence = saturate( material.iridescence );
|
|
1276
|
-
}
|
|
1277
|
-
if ( material.iridescence > 0.0 ) {
|
|
1278
|
-
material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
|
1279
|
-
material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
|
|
1280
|
-
material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
|
|
1281
|
-
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
|
|
1282
|
-
}
|
|
1283
|
-
#endif
|
|
1284
|
-
IncidentLight directLight;
|
|
1285
|
-
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1286
|
-
PointLight pointLight;
|
|
1287
|
-
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1288
|
-
PointLightShadow pointLightShadow;
|
|
1289
|
-
#endif
|
|
1290
|
-
#pragma unroll_loop_start
|
|
1291
|
-
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1292
|
-
pointLight = pointLights[ i ];
|
|
1293
|
-
getPointLightInfo( pointLight, geometryPosition, directLight );
|
|
1294
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
|
1295
|
-
pointLightShadow = pointLightShadows[ i ];
|
|
1296
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1297
|
-
#endif
|
|
1298
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1299
|
-
}
|
|
1300
|
-
#pragma unroll_loop_end
|
|
1301
|
-
#endif
|
|
1302
|
-
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1303
|
-
SpotLight spotLight;
|
|
1304
|
-
vec4 spotColor;
|
|
1305
|
-
vec3 spotLightCoord;
|
|
1306
|
-
bool inSpotLightMap;
|
|
1307
|
-
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1308
|
-
SpotLightShadow spotLightShadow;
|
|
1309
|
-
#endif
|
|
1310
|
-
#pragma unroll_loop_start
|
|
1311
|
-
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1312
|
-
spotLight = spotLights[ i ];
|
|
1313
|
-
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
|
1314
|
-
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1315
|
-
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
|
1316
|
-
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1317
|
-
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
|
1318
|
-
#else
|
|
1319
|
-
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1320
|
-
#endif
|
|
1321
|
-
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
|
1322
|
-
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
|
1323
|
-
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
|
1324
|
-
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
|
1325
|
-
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
|
1326
|
-
#endif
|
|
1327
|
-
#undef SPOT_LIGHT_MAP_INDEX
|
|
1328
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1329
|
-
spotLightShadow = spotLightShadows[ i ];
|
|
1330
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
1331
|
-
#endif
|
|
1332
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1333
|
-
}
|
|
1334
|
-
#pragma unroll_loop_end
|
|
1335
|
-
#endif
|
|
1336
|
-
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1337
|
-
DirectionalLight directionalLight;
|
|
1338
|
-
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1339
|
-
DirectionalLightShadow directionalLightShadow;
|
|
1340
|
-
#endif
|
|
1341
|
-
#pragma unroll_loop_start
|
|
1342
|
-
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1343
|
-
directionalLight = directionalLights[ i ];
|
|
1344
|
-
getDirectionalLightInfo( directionalLight, directLight );
|
|
1345
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1346
|
-
directionalLightShadow = directionalLightShadows[ i ];
|
|
1347
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1348
|
-
#endif
|
|
1349
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1350
|
-
}
|
|
1351
|
-
#pragma unroll_loop_end
|
|
1352
|
-
#endif
|
|
1353
|
-
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1354
|
-
RectAreaLight rectAreaLight;
|
|
1355
|
-
#pragma unroll_loop_start
|
|
1356
|
-
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1357
|
-
rectAreaLight = rectAreaLights[ i ];
|
|
1358
|
-
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1359
|
-
}
|
|
1360
|
-
#pragma unroll_loop_end
|
|
1361
|
-
#endif
|
|
1362
|
-
#if defined( RE_IndirectDiffuse )
|
|
1363
|
-
vec3 iblIrradiance = vec3( 0.0 );
|
|
1364
|
-
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1365
|
-
#if defined( USE_LIGHT_PROBES )
|
|
1366
|
-
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|
1367
|
-
#endif
|
|
1368
|
-
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1369
|
-
#pragma unroll_loop_start
|
|
1370
|
-
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1371
|
-
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|
1372
|
-
}
|
|
1373
|
-
#pragma unroll_loop_end
|
|
1374
|
-
#endif
|
|
1375
|
-
#endif
|
|
1376
|
-
#if defined( RE_IndirectSpecular )
|
|
1377
|
-
vec3 radiance = vec3( 0.0 );
|
|
1378
|
-
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1379
|
-
#endif`,Ho=`#if defined( RE_IndirectDiffuse )
|
|
1380
|
-
#ifdef USE_LIGHTMAP
|
|
1381
|
-
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1382
|
-
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
1383
|
-
irradiance += lightMapIrradiance;
|
|
1384
|
-
#endif
|
|
1385
|
-
#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1386
|
-
#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
|
|
1387
|
-
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|
1388
|
-
#endif
|
|
1389
|
-
#endif
|
|
1390
|
-
#endif
|
|
1391
|
-
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1392
|
-
#ifdef USE_ANISOTROPY
|
|
1393
|
-
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|
1394
|
-
#else
|
|
1395
|
-
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|
1396
|
-
#endif
|
|
1397
|
-
#ifdef USE_CLEARCOAT
|
|
1398
|
-
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1399
|
-
#endif
|
|
1400
|
-
#endif`,ko=`#if defined( RE_IndirectDiffuse )
|
|
1401
|
-
#if defined( LAMBERT ) || defined( PHONG )
|
|
1402
|
-
irradiance += iblIrradiance;
|
|
1403
|
-
#endif
|
|
1404
|
-
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1405
|
-
#endif
|
|
1406
|
-
#if defined( RE_IndirectSpecular )
|
|
1407
|
-
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1408
|
-
#endif`,Wo=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1409
|
-
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1410
|
-
#endif`,Xo=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1411
|
-
uniform float logDepthBufFC;
|
|
1412
|
-
varying float vFragDepth;
|
|
1413
|
-
varying float vIsPerspective;
|
|
1414
|
-
#endif`,qo=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1415
|
-
varying float vFragDepth;
|
|
1416
|
-
varying float vIsPerspective;
|
|
1417
|
-
#endif`,Yo=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1418
|
-
vFragDepth = 1.0 + gl_Position.w;
|
|
1419
|
-
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1420
|
-
#endif`,Ko=`#ifdef USE_MAP
|
|
1421
|
-
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1422
|
-
#ifdef DECODE_VIDEO_TEXTURE
|
|
1423
|
-
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1424
|
-
#endif
|
|
1425
|
-
diffuseColor *= sampledDiffuseColor;
|
|
1426
|
-
#endif`,Zo=`#ifdef USE_MAP
|
|
1427
|
-
uniform sampler2D map;
|
|
1428
|
-
#endif`,$o=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1429
|
-
#if defined( USE_POINTS_UV )
|
|
1430
|
-
vec2 uv = vUv;
|
|
1431
|
-
#else
|
|
1432
|
-
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1433
|
-
#endif
|
|
1434
|
-
#endif
|
|
1435
|
-
#ifdef USE_MAP
|
|
1436
|
-
diffuseColor *= texture2D( map, uv );
|
|
1437
|
-
#endif
|
|
1438
|
-
#ifdef USE_ALPHAMAP
|
|
1439
|
-
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1440
|
-
#endif`,jo=`#if defined( USE_POINTS_UV )
|
|
1441
|
-
varying vec2 vUv;
|
|
1442
|
-
#else
|
|
1443
|
-
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1444
|
-
uniform mat3 uvTransform;
|
|
1445
|
-
#endif
|
|
1446
|
-
#endif
|
|
1447
|
-
#ifdef USE_MAP
|
|
1448
|
-
uniform sampler2D map;
|
|
1449
|
-
#endif
|
|
1450
|
-
#ifdef USE_ALPHAMAP
|
|
1451
|
-
uniform sampler2D alphaMap;
|
|
1452
|
-
#endif`,Jo=`float metalnessFactor = metalness;
|
|
1453
|
-
#ifdef USE_METALNESSMAP
|
|
1454
|
-
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1455
|
-
metalnessFactor *= texelMetalness.b;
|
|
1456
|
-
#endif`,Qo=`#ifdef USE_METALNESSMAP
|
|
1457
|
-
uniform sampler2D metalnessMap;
|
|
1458
|
-
#endif`,el=`#ifdef USE_INSTANCING_MORPH
|
|
1459
|
-
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1460
|
-
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1461
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1462
|
-
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1463
|
-
}
|
|
1464
|
-
#endif`,tl=`#if defined( USE_MORPHCOLORS )
|
|
1465
|
-
vColor *= morphTargetBaseInfluence;
|
|
1466
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1467
|
-
#if defined( USE_COLOR_ALPHA )
|
|
1468
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|
1469
|
-
#elif defined( USE_COLOR )
|
|
1470
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1471
|
-
#endif
|
|
1472
|
-
}
|
|
1473
|
-
#endif`,nl=`#ifdef USE_MORPHNORMALS
|
|
1474
|
-
objectNormal *= morphTargetBaseInfluence;
|
|
1475
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1476
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1477
|
-
}
|
|
1478
|
-
#endif`,il=`#ifdef USE_MORPHTARGETS
|
|
1479
|
-
#ifndef USE_INSTANCING_MORPH
|
|
1480
|
-
uniform float morphTargetBaseInfluence;
|
|
1481
|
-
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1482
|
-
#endif
|
|
1483
|
-
uniform sampler2DArray morphTargetsTexture;
|
|
1484
|
-
uniform ivec2 morphTargetsTextureSize;
|
|
1485
|
-
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
|
1486
|
-
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
|
1487
|
-
int y = texelIndex / morphTargetsTextureSize.x;
|
|
1488
|
-
int x = texelIndex - y * morphTargetsTextureSize.x;
|
|
1489
|
-
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1490
|
-
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1491
|
-
}
|
|
1492
|
-
#endif`,rl=`#ifdef USE_MORPHTARGETS
|
|
1493
|
-
transformed *= morphTargetBaseInfluence;
|
|
1494
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1495
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1496
|
-
}
|
|
1497
|
-
#endif`,sl=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1498
|
-
#ifdef FLAT_SHADED
|
|
1499
|
-
vec3 fdx = dFdx( vViewPosition );
|
|
1500
|
-
vec3 fdy = dFdy( vViewPosition );
|
|
1501
|
-
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1502
|
-
#else
|
|
1503
|
-
vec3 normal = normalize( vNormal );
|
|
1504
|
-
#ifdef DOUBLE_SIDED
|
|
1505
|
-
normal *= faceDirection;
|
|
1506
|
-
#endif
|
|
1507
|
-
#endif
|
|
1508
|
-
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
|
1509
|
-
#ifdef USE_TANGENT
|
|
1510
|
-
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1511
|
-
#else
|
|
1512
|
-
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
|
1513
|
-
#if defined( USE_NORMALMAP )
|
|
1514
|
-
vNormalMapUv
|
|
1515
|
-
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
|
1516
|
-
vClearcoatNormalMapUv
|
|
1517
|
-
#else
|
|
1518
|
-
vUv
|
|
1519
|
-
#endif
|
|
1520
|
-
);
|
|
1521
|
-
#endif
|
|
1522
|
-
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|
1523
|
-
tbn[0] *= faceDirection;
|
|
1524
|
-
tbn[1] *= faceDirection;
|
|
1525
|
-
#endif
|
|
1526
|
-
#endif
|
|
1527
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1528
|
-
#ifdef USE_TANGENT
|
|
1529
|
-
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1530
|
-
#else
|
|
1531
|
-
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
|
1532
|
-
#endif
|
|
1533
|
-
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|
1534
|
-
tbn2[0] *= faceDirection;
|
|
1535
|
-
tbn2[1] *= faceDirection;
|
|
1536
|
-
#endif
|
|
1537
|
-
#endif
|
|
1538
|
-
vec3 nonPerturbedNormal = normal;`,al=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1539
|
-
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1540
|
-
#ifdef FLIP_SIDED
|
|
1541
|
-
normal = - normal;
|
|
1542
|
-
#endif
|
|
1543
|
-
#ifdef DOUBLE_SIDED
|
|
1544
|
-
normal = normal * faceDirection;
|
|
1545
|
-
#endif
|
|
1546
|
-
normal = normalize( normalMatrix * normal );
|
|
1547
|
-
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
|
1548
|
-
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1549
|
-
mapN.xy *= normalScale;
|
|
1550
|
-
normal = normalize( tbn * mapN );
|
|
1551
|
-
#elif defined( USE_BUMPMAP )
|
|
1552
|
-
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1553
|
-
#endif`,ol=`#ifndef FLAT_SHADED
|
|
1554
|
-
varying vec3 vNormal;
|
|
1555
|
-
#ifdef USE_TANGENT
|
|
1556
|
-
varying vec3 vTangent;
|
|
1557
|
-
varying vec3 vBitangent;
|
|
1558
|
-
#endif
|
|
1559
|
-
#endif`,ll=`#ifndef FLAT_SHADED
|
|
1560
|
-
varying vec3 vNormal;
|
|
1561
|
-
#ifdef USE_TANGENT
|
|
1562
|
-
varying vec3 vTangent;
|
|
1563
|
-
varying vec3 vBitangent;
|
|
1564
|
-
#endif
|
|
1565
|
-
#endif`,cl=`#ifndef FLAT_SHADED
|
|
1566
|
-
vNormal = normalize( transformedNormal );
|
|
1567
|
-
#ifdef USE_TANGENT
|
|
1568
|
-
vTangent = normalize( transformedTangent );
|
|
1569
|
-
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1570
|
-
#endif
|
|
1571
|
-
#endif`,ul=`#ifdef USE_NORMALMAP
|
|
1572
|
-
uniform sampler2D normalMap;
|
|
1573
|
-
uniform vec2 normalScale;
|
|
1574
|
-
#endif
|
|
1575
|
-
#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1576
|
-
uniform mat3 normalMatrix;
|
|
1577
|
-
#endif
|
|
1578
|
-
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
|
1579
|
-
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
|
1580
|
-
vec3 q0 = dFdx( eye_pos.xyz );
|
|
1581
|
-
vec3 q1 = dFdy( eye_pos.xyz );
|
|
1582
|
-
vec2 st0 = dFdx( uv.st );
|
|
1583
|
-
vec2 st1 = dFdy( uv.st );
|
|
1584
|
-
vec3 N = surf_norm;
|
|
1585
|
-
vec3 q1perp = cross( q1, N );
|
|
1586
|
-
vec3 q0perp = cross( N, q0 );
|
|
1587
|
-
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1588
|
-
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1589
|
-
float det = max( dot( T, T ), dot( B, B ) );
|
|
1590
|
-
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1591
|
-
return mat3( T * scale, B * scale, N );
|
|
1592
|
-
}
|
|
1593
|
-
#endif`,fl=`#ifdef USE_CLEARCOAT
|
|
1594
|
-
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1595
|
-
#endif`,hl=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1596
|
-
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1597
|
-
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1598
|
-
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1599
|
-
#endif`,dl=`#ifdef USE_CLEARCOATMAP
|
|
1600
|
-
uniform sampler2D clearcoatMap;
|
|
1601
|
-
#endif
|
|
1602
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1603
|
-
uniform sampler2D clearcoatNormalMap;
|
|
1604
|
-
uniform vec2 clearcoatNormalScale;
|
|
1605
|
-
#endif
|
|
1606
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1607
|
-
uniform sampler2D clearcoatRoughnessMap;
|
|
1608
|
-
#endif`,pl=`#ifdef USE_IRIDESCENCEMAP
|
|
1609
|
-
uniform sampler2D iridescenceMap;
|
|
1610
|
-
#endif
|
|
1611
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1612
|
-
uniform sampler2D iridescenceThicknessMap;
|
|
1613
|
-
#endif`,ml=`#ifdef OPAQUE
|
|
1614
|
-
diffuseColor.a = 1.0;
|
|
1615
|
-
#endif
|
|
1616
|
-
#ifdef USE_TRANSMISSION
|
|
1617
|
-
diffuseColor.a *= material.transmissionAlpha;
|
|
1618
|
-
#endif
|
|
1619
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,_l=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1620
|
-
return normalize( normal ) * 0.5 + 0.5;
|
|
1621
|
-
}
|
|
1622
|
-
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1623
|
-
return 2.0 * rgb.xyz - 1.0;
|
|
1624
|
-
}
|
|
1625
|
-
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
|
|
1626
|
-
const float Inv255 = 1. / 255.;
|
|
1627
|
-
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
|
1628
|
-
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
|
1629
|
-
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
|
1630
|
-
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
|
1631
|
-
vec4 packDepthToRGBA( const in float v ) {
|
|
1632
|
-
if( v <= 0.0 )
|
|
1633
|
-
return vec4( 0., 0., 0., 0. );
|
|
1634
|
-
if( v >= 1.0 )
|
|
1635
|
-
return vec4( 1., 1., 1., 1. );
|
|
1636
|
-
float vuf;
|
|
1637
|
-
float af = modf( v * PackFactors.a, vuf );
|
|
1638
|
-
float bf = modf( vuf * ShiftRight8, vuf );
|
|
1639
|
-
float gf = modf( vuf * ShiftRight8, vuf );
|
|
1640
|
-
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
|
1641
|
-
}
|
|
1642
|
-
vec3 packDepthToRGB( const in float v ) {
|
|
1643
|
-
if( v <= 0.0 )
|
|
1644
|
-
return vec3( 0., 0., 0. );
|
|
1645
|
-
if( v >= 1.0 )
|
|
1646
|
-
return vec3( 1., 1., 1. );
|
|
1647
|
-
float vuf;
|
|
1648
|
-
float bf = modf( v * PackFactors.b, vuf );
|
|
1649
|
-
float gf = modf( vuf * ShiftRight8, vuf );
|
|
1650
|
-
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
|
1651
|
-
}
|
|
1652
|
-
vec2 packDepthToRG( const in float v ) {
|
|
1653
|
-
if( v <= 0.0 )
|
|
1654
|
-
return vec2( 0., 0. );
|
|
1655
|
-
if( v >= 1.0 )
|
|
1656
|
-
return vec2( 1., 1. );
|
|
1657
|
-
float vuf;
|
|
1658
|
-
float gf = modf( v * 256., vuf );
|
|
1659
|
-
return vec2( vuf * Inv255, gf );
|
|
1660
|
-
}
|
|
1661
|
-
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1662
|
-
return dot( v, UnpackFactors4 );
|
|
1663
|
-
}
|
|
1664
|
-
float unpackRGBToDepth( const in vec3 v ) {
|
|
1665
|
-
return dot( v, UnpackFactors3 );
|
|
1666
|
-
}
|
|
1667
|
-
float unpackRGToDepth( const in vec2 v ) {
|
|
1668
|
-
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
|
1669
|
-
}
|
|
1670
|
-
vec4 pack2HalfToRGBA( const in vec2 v ) {
|
|
1671
|
-
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
1672
|
-
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
1673
|
-
}
|
|
1674
|
-
vec2 unpackRGBATo2Half( const in vec4 v ) {
|
|
1675
|
-
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1676
|
-
}
|
|
1677
|
-
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1678
|
-
return ( viewZ + near ) / ( near - far );
|
|
1679
|
-
}
|
|
1680
|
-
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1681
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1682
|
-
|
|
1683
|
-
return depth * ( far - near ) - far;
|
|
1684
|
-
#else
|
|
1685
|
-
return depth * ( near - far ) - near;
|
|
1686
|
-
#endif
|
|
1687
|
-
}
|
|
1688
|
-
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1689
|
-
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
1690
|
-
}
|
|
1691
|
-
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1692
|
-
|
|
1693
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1694
|
-
return ( near * far ) / ( ( near - far ) * depth - near );
|
|
1695
|
-
#else
|
|
1696
|
-
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1697
|
-
#endif
|
|
1698
|
-
}`,gl=`#ifdef PREMULTIPLIED_ALPHA
|
|
1699
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1700
|
-
#endif`,xl=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1701
|
-
#ifdef USE_BATCHING
|
|
1702
|
-
mvPosition = batchingMatrix * mvPosition;
|
|
1703
|
-
#endif
|
|
1704
|
-
#ifdef USE_INSTANCING
|
|
1705
|
-
mvPosition = instanceMatrix * mvPosition;
|
|
1706
|
-
#endif
|
|
1707
|
-
mvPosition = modelViewMatrix * mvPosition;
|
|
1708
|
-
gl_Position = projectionMatrix * mvPosition;`,vl=`#ifdef DITHERING
|
|
1709
|
-
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1710
|
-
#endif`,Sl=`#ifdef DITHERING
|
|
1711
|
-
vec3 dithering( vec3 color ) {
|
|
1712
|
-
float grid_position = rand( gl_FragCoord.xy );
|
|
1713
|
-
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1714
|
-
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1715
|
-
return color + dither_shift_RGB;
|
|
1716
|
-
}
|
|
1717
|
-
#endif`,Ml=`float roughnessFactor = roughness;
|
|
1718
|
-
#ifdef USE_ROUGHNESSMAP
|
|
1719
|
-
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1720
|
-
roughnessFactor *= texelRoughness.g;
|
|
1721
|
-
#endif`,El=`#ifdef USE_ROUGHNESSMAP
|
|
1722
|
-
uniform sampler2D roughnessMap;
|
|
1723
|
-
#endif`,Tl=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1724
|
-
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1725
|
-
#endif
|
|
1726
|
-
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
1727
|
-
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
|
1728
|
-
#endif
|
|
1729
|
-
#ifdef USE_SHADOWMAP
|
|
1730
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1731
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1732
|
-
uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1733
|
-
#else
|
|
1734
|
-
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1735
|
-
#endif
|
|
1736
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1737
|
-
struct DirectionalLightShadow {
|
|
1738
|
-
float shadowIntensity;
|
|
1739
|
-
float shadowBias;
|
|
1740
|
-
float shadowNormalBias;
|
|
1741
|
-
float shadowRadius;
|
|
1742
|
-
vec2 shadowMapSize;
|
|
1743
|
-
};
|
|
1744
|
-
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1745
|
-
#endif
|
|
1746
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1747
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1748
|
-
uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1749
|
-
#else
|
|
1750
|
-
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1751
|
-
#endif
|
|
1752
|
-
struct SpotLightShadow {
|
|
1753
|
-
float shadowIntensity;
|
|
1754
|
-
float shadowBias;
|
|
1755
|
-
float shadowNormalBias;
|
|
1756
|
-
float shadowRadius;
|
|
1757
|
-
vec2 shadowMapSize;
|
|
1758
|
-
};
|
|
1759
|
-
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1760
|
-
#endif
|
|
1761
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1762
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1763
|
-
uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1764
|
-
#elif defined( SHADOWMAP_TYPE_BASIC )
|
|
1765
|
-
uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1766
|
-
#endif
|
|
1767
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1768
|
-
struct PointLightShadow {
|
|
1769
|
-
float shadowIntensity;
|
|
1770
|
-
float shadowBias;
|
|
1771
|
-
float shadowNormalBias;
|
|
1772
|
-
float shadowRadius;
|
|
1773
|
-
vec2 shadowMapSize;
|
|
1774
|
-
float shadowCameraNear;
|
|
1775
|
-
float shadowCameraFar;
|
|
1776
|
-
};
|
|
1777
|
-
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1778
|
-
#endif
|
|
1779
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1780
|
-
float interleavedGradientNoise( vec2 position ) {
|
|
1781
|
-
return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
|
|
1782
|
-
}
|
|
1783
|
-
vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
|
|
1784
|
-
const float goldenAngle = 2.399963229728653;
|
|
1785
|
-
float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
|
|
1786
|
-
float theta = float( sampleIndex ) * goldenAngle + phi;
|
|
1787
|
-
return vec2( cos( theta ), sin( theta ) ) * r;
|
|
1788
|
-
}
|
|
1789
|
-
#endif
|
|
1790
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1791
|
-
float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1792
|
-
float shadow = 1.0;
|
|
1793
|
-
shadowCoord.xyz /= shadowCoord.w;
|
|
1794
|
-
shadowCoord.z += shadowBias;
|
|
1795
|
-
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1796
|
-
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1797
|
-
if ( frustumTest ) {
|
|
1798
|
-
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1799
|
-
float radius = shadowRadius * texelSize.x;
|
|
1800
|
-
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
1801
|
-
shadow = (
|
|
1802
|
-
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1803
|
-
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1804
|
-
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1805
|
-
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1806
|
-
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
|
|
1807
|
-
) * 0.2;
|
|
1808
|
-
}
|
|
1809
|
-
return mix( 1.0, shadow, shadowIntensity );
|
|
1810
|
-
}
|
|
1811
|
-
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1812
|
-
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1813
|
-
float shadow = 1.0;
|
|
1814
|
-
shadowCoord.xyz /= shadowCoord.w;
|
|
1815
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1816
|
-
shadowCoord.z -= shadowBias;
|
|
1817
|
-
#else
|
|
1818
|
-
shadowCoord.z += shadowBias;
|
|
1819
|
-
#endif
|
|
1820
|
-
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1821
|
-
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1822
|
-
if ( frustumTest ) {
|
|
1823
|
-
vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
|
|
1824
|
-
float mean = distribution.x;
|
|
1825
|
-
float variance = distribution.y * distribution.y;
|
|
1826
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1827
|
-
float hard_shadow = step( mean, shadowCoord.z );
|
|
1828
|
-
#else
|
|
1829
|
-
float hard_shadow = step( shadowCoord.z, mean );
|
|
1830
|
-
#endif
|
|
1831
|
-
|
|
1832
|
-
if ( hard_shadow == 1.0 ) {
|
|
1833
|
-
shadow = 1.0;
|
|
1834
|
-
} else {
|
|
1835
|
-
variance = max( variance, 0.0000001 );
|
|
1836
|
-
float d = shadowCoord.z - mean;
|
|
1837
|
-
float p_max = variance / ( variance + d * d );
|
|
1838
|
-
p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
|
|
1839
|
-
shadow = max( hard_shadow, p_max );
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
return mix( 1.0, shadow, shadowIntensity );
|
|
1843
|
-
}
|
|
1844
|
-
#else
|
|
1845
|
-
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1846
|
-
float shadow = 1.0;
|
|
1847
|
-
shadowCoord.xyz /= shadowCoord.w;
|
|
1848
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1849
|
-
shadowCoord.z -= shadowBias;
|
|
1850
|
-
#else
|
|
1851
|
-
shadowCoord.z += shadowBias;
|
|
1852
|
-
#endif
|
|
1853
|
-
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1854
|
-
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1855
|
-
if ( frustumTest ) {
|
|
1856
|
-
float depth = texture2D( shadowMap, shadowCoord.xy ).r;
|
|
1857
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1858
|
-
shadow = step( depth, shadowCoord.z );
|
|
1859
|
-
#else
|
|
1860
|
-
shadow = step( shadowCoord.z, depth );
|
|
1861
|
-
#endif
|
|
1862
|
-
}
|
|
1863
|
-
return mix( 1.0, shadow, shadowIntensity );
|
|
1864
|
-
}
|
|
1865
|
-
#endif
|
|
1866
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1867
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1868
|
-
float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1869
|
-
float shadow = 1.0;
|
|
1870
|
-
vec3 lightToPosition = shadowCoord.xyz;
|
|
1871
|
-
vec3 bd3D = normalize( lightToPosition );
|
|
1872
|
-
vec3 absVec = abs( lightToPosition );
|
|
1873
|
-
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
|
1874
|
-
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
1875
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1876
|
-
float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
1877
|
-
dp -= shadowBias;
|
|
1878
|
-
#else
|
|
1879
|
-
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
1880
|
-
dp += shadowBias;
|
|
1881
|
-
#endif
|
|
1882
|
-
float texelSize = shadowRadius / shadowMapSize.x;
|
|
1883
|
-
vec3 absDir = abs( bd3D );
|
|
1884
|
-
vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
|
|
1885
|
-
tangent = normalize( cross( bd3D, tangent ) );
|
|
1886
|
-
vec3 bitangent = cross( bd3D, tangent );
|
|
1887
|
-
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
1888
|
-
vec2 sample0 = vogelDiskSample( 0, 5, phi );
|
|
1889
|
-
vec2 sample1 = vogelDiskSample( 1, 5, phi );
|
|
1890
|
-
vec2 sample2 = vogelDiskSample( 2, 5, phi );
|
|
1891
|
-
vec2 sample3 = vogelDiskSample( 3, 5, phi );
|
|
1892
|
-
vec2 sample4 = vogelDiskSample( 4, 5, phi );
|
|
1893
|
-
shadow = (
|
|
1894
|
-
texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
|
|
1895
|
-
texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
|
|
1896
|
-
texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
|
|
1897
|
-
texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
|
|
1898
|
-
texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
|
|
1899
|
-
) * 0.2;
|
|
1900
|
-
}
|
|
1901
|
-
return mix( 1.0, shadow, shadowIntensity );
|
|
1902
|
-
}
|
|
1903
|
-
#elif defined( SHADOWMAP_TYPE_BASIC )
|
|
1904
|
-
float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1905
|
-
float shadow = 1.0;
|
|
1906
|
-
vec3 lightToPosition = shadowCoord.xyz;
|
|
1907
|
-
vec3 absVec = abs( lightToPosition );
|
|
1908
|
-
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
|
1909
|
-
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
1910
|
-
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
1911
|
-
dp += shadowBias;
|
|
1912
|
-
vec3 bd3D = normalize( lightToPosition );
|
|
1913
|
-
float depth = textureCube( shadowMap, bd3D ).r;
|
|
1914
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1915
|
-
depth = 1.0 - depth;
|
|
1916
|
-
#endif
|
|
1917
|
-
shadow = step( dp, depth );
|
|
1918
|
-
}
|
|
1919
|
-
return mix( 1.0, shadow, shadowIntensity );
|
|
1920
|
-
}
|
|
1921
|
-
#endif
|
|
1922
|
-
#endif
|
|
1923
|
-
#endif`,yl=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1924
|
-
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1925
|
-
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1926
|
-
#endif
|
|
1927
|
-
#ifdef USE_SHADOWMAP
|
|
1928
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1929
|
-
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1930
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1931
|
-
struct DirectionalLightShadow {
|
|
1932
|
-
float shadowIntensity;
|
|
1933
|
-
float shadowBias;
|
|
1934
|
-
float shadowNormalBias;
|
|
1935
|
-
float shadowRadius;
|
|
1936
|
-
vec2 shadowMapSize;
|
|
1937
|
-
};
|
|
1938
|
-
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1939
|
-
#endif
|
|
1940
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1941
|
-
struct SpotLightShadow {
|
|
1942
|
-
float shadowIntensity;
|
|
1943
|
-
float shadowBias;
|
|
1944
|
-
float shadowNormalBias;
|
|
1945
|
-
float shadowRadius;
|
|
1946
|
-
vec2 shadowMapSize;
|
|
1947
|
-
};
|
|
1948
|
-
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1949
|
-
#endif
|
|
1950
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1951
|
-
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1952
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1953
|
-
struct PointLightShadow {
|
|
1954
|
-
float shadowIntensity;
|
|
1955
|
-
float shadowBias;
|
|
1956
|
-
float shadowNormalBias;
|
|
1957
|
-
float shadowRadius;
|
|
1958
|
-
vec2 shadowMapSize;
|
|
1959
|
-
float shadowCameraNear;
|
|
1960
|
-
float shadowCameraFar;
|
|
1961
|
-
};
|
|
1962
|
-
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1963
|
-
#endif
|
|
1964
|
-
#endif`,Al=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1965
|
-
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1966
|
-
vec4 shadowWorldPosition;
|
|
1967
|
-
#endif
|
|
1968
|
-
#if defined( USE_SHADOWMAP )
|
|
1969
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1970
|
-
#pragma unroll_loop_start
|
|
1971
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1972
|
-
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
1973
|
-
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
1974
|
-
}
|
|
1975
|
-
#pragma unroll_loop_end
|
|
1976
|
-
#endif
|
|
1977
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1978
|
-
#pragma unroll_loop_start
|
|
1979
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1980
|
-
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
1981
|
-
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
1982
|
-
}
|
|
1983
|
-
#pragma unroll_loop_end
|
|
1984
|
-
#endif
|
|
1985
|
-
#endif
|
|
1986
|
-
#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1987
|
-
#pragma unroll_loop_start
|
|
1988
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
|
1989
|
-
shadowWorldPosition = worldPosition;
|
|
1990
|
-
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1991
|
-
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
|
1992
|
-
#endif
|
|
1993
|
-
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1994
|
-
}
|
|
1995
|
-
#pragma unroll_loop_end
|
|
1996
|
-
#endif`,bl=`float getShadowMask() {
|
|
1997
|
-
float shadow = 1.0;
|
|
1998
|
-
#ifdef USE_SHADOWMAP
|
|
1999
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
2000
|
-
DirectionalLightShadow directionalLight;
|
|
2001
|
-
#pragma unroll_loop_start
|
|
2002
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
2003
|
-
directionalLight = directionalLightShadows[ i ];
|
|
2004
|
-
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
2005
|
-
}
|
|
2006
|
-
#pragma unroll_loop_end
|
|
2007
|
-
#endif
|
|
2008
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
2009
|
-
SpotLightShadow spotLight;
|
|
2010
|
-
#pragma unroll_loop_start
|
|
2011
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
2012
|
-
spotLight = spotLightShadows[ i ];
|
|
2013
|
-
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
2014
|
-
}
|
|
2015
|
-
#pragma unroll_loop_end
|
|
2016
|
-
#endif
|
|
2017
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
|
2018
|
-
PointLightShadow pointLight;
|
|
2019
|
-
#pragma unroll_loop_start
|
|
2020
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
2021
|
-
pointLight = pointLightShadows[ i ];
|
|
2022
|
-
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
2023
|
-
}
|
|
2024
|
-
#pragma unroll_loop_end
|
|
2025
|
-
#endif
|
|
2026
|
-
#endif
|
|
2027
|
-
return shadow;
|
|
2028
|
-
}`,Rl=`#ifdef USE_SKINNING
|
|
2029
|
-
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2030
|
-
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2031
|
-
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2032
|
-
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2033
|
-
#endif`,Cl=`#ifdef USE_SKINNING
|
|
2034
|
-
uniform mat4 bindMatrix;
|
|
2035
|
-
uniform mat4 bindMatrixInverse;
|
|
2036
|
-
uniform highp sampler2D boneTexture;
|
|
2037
|
-
mat4 getBoneMatrix( const in float i ) {
|
|
2038
|
-
int size = textureSize( boneTexture, 0 ).x;
|
|
2039
|
-
int j = int( i ) * 4;
|
|
2040
|
-
int x = j % size;
|
|
2041
|
-
int y = j / size;
|
|
2042
|
-
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
|
2043
|
-
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
|
2044
|
-
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
|
2045
|
-
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2046
|
-
return mat4( v1, v2, v3, v4 );
|
|
2047
|
-
}
|
|
2048
|
-
#endif`,wl=`#ifdef USE_SKINNING
|
|
2049
|
-
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2050
|
-
vec4 skinned = vec4( 0.0 );
|
|
2051
|
-
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
2052
|
-
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
2053
|
-
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2054
|
-
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2055
|
-
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2056
|
-
#endif`,Pl=`#ifdef USE_SKINNING
|
|
2057
|
-
mat4 skinMatrix = mat4( 0.0 );
|
|
2058
|
-
skinMatrix += skinWeight.x * boneMatX;
|
|
2059
|
-
skinMatrix += skinWeight.y * boneMatY;
|
|
2060
|
-
skinMatrix += skinWeight.z * boneMatZ;
|
|
2061
|
-
skinMatrix += skinWeight.w * boneMatW;
|
|
2062
|
-
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
2063
|
-
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
2064
|
-
#ifdef USE_TANGENT
|
|
2065
|
-
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2066
|
-
#endif
|
|
2067
|
-
#endif`,Dl=`float specularStrength;
|
|
2068
|
-
#ifdef USE_SPECULARMAP
|
|
2069
|
-
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2070
|
-
specularStrength = texelSpecular.r;
|
|
2071
|
-
#else
|
|
2072
|
-
specularStrength = 1.0;
|
|
2073
|
-
#endif`,Ll=`#ifdef USE_SPECULARMAP
|
|
2074
|
-
uniform sampler2D specularMap;
|
|
2075
|
-
#endif`,Fl=`#if defined( TONE_MAPPING )
|
|
2076
|
-
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2077
|
-
#endif`,Ul=`#ifndef saturate
|
|
2078
|
-
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2079
|
-
#endif
|
|
2080
|
-
uniform float toneMappingExposure;
|
|
2081
|
-
vec3 LinearToneMapping( vec3 color ) {
|
|
2082
|
-
return saturate( toneMappingExposure * color );
|
|
2083
|
-
}
|
|
2084
|
-
vec3 ReinhardToneMapping( vec3 color ) {
|
|
2085
|
-
color *= toneMappingExposure;
|
|
2086
|
-
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
2087
|
-
}
|
|
2088
|
-
vec3 CineonToneMapping( vec3 color ) {
|
|
2089
|
-
color *= toneMappingExposure;
|
|
2090
|
-
color = max( vec3( 0.0 ), color - 0.004 );
|
|
2091
|
-
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
2092
|
-
}
|
|
2093
|
-
vec3 RRTAndODTFit( vec3 v ) {
|
|
2094
|
-
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
2095
|
-
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
2096
|
-
return a / b;
|
|
2097
|
-
}
|
|
2098
|
-
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
2099
|
-
const mat3 ACESInputMat = mat3(
|
|
2100
|
-
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
2101
|
-
vec3( 0.04823, 0.01566, 0.83777 )
|
|
2102
|
-
);
|
|
2103
|
-
const mat3 ACESOutputMat = mat3(
|
|
2104
|
-
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
2105
|
-
vec3( -0.07367, -0.00605, 1.07602 )
|
|
2106
|
-
);
|
|
2107
|
-
color *= toneMappingExposure / 0.6;
|
|
2108
|
-
color = ACESInputMat * color;
|
|
2109
|
-
color = RRTAndODTFit( color );
|
|
2110
|
-
color = ACESOutputMat * color;
|
|
2111
|
-
return saturate( color );
|
|
2112
|
-
}
|
|
2113
|
-
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
|
2114
|
-
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
|
2115
|
-
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
|
2116
|
-
vec3( - 0.0728, - 0.0083, 1.1187 )
|
|
2117
|
-
);
|
|
2118
|
-
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
|
2119
|
-
vec3( 0.6274, 0.0691, 0.0164 ),
|
|
2120
|
-
vec3( 0.3293, 0.9195, 0.0880 ),
|
|
2121
|
-
vec3( 0.0433, 0.0113, 0.8956 )
|
|
2122
|
-
);
|
|
2123
|
-
vec3 agxDefaultContrastApprox( vec3 x ) {
|
|
2124
|
-
vec3 x2 = x * x;
|
|
2125
|
-
vec3 x4 = x2 * x2;
|
|
2126
|
-
return + 15.5 * x4 * x2
|
|
2127
|
-
- 40.14 * x4 * x
|
|
2128
|
-
+ 31.96 * x4
|
|
2129
|
-
- 6.868 * x2 * x
|
|
2130
|
-
+ 0.4298 * x2
|
|
2131
|
-
+ 0.1191 * x
|
|
2132
|
-
- 0.00232;
|
|
2133
|
-
}
|
|
2134
|
-
vec3 AgXToneMapping( vec3 color ) {
|
|
2135
|
-
const mat3 AgXInsetMatrix = mat3(
|
|
2136
|
-
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
|
2137
|
-
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
|
2138
|
-
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
|
2139
|
-
);
|
|
2140
|
-
const mat3 AgXOutsetMatrix = mat3(
|
|
2141
|
-
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
|
2142
|
-
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
|
2143
|
-
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
|
2144
|
-
);
|
|
2145
|
-
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
|
2146
|
-
color *= toneMappingExposure;
|
|
2147
|
-
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
|
2148
|
-
color = AgXInsetMatrix * color;
|
|
2149
|
-
color = max( color, 1e-10 ); color = log2( color );
|
|
2150
|
-
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
|
2151
|
-
color = clamp( color, 0.0, 1.0 );
|
|
2152
|
-
color = agxDefaultContrastApprox( color );
|
|
2153
|
-
color = AgXOutsetMatrix * color;
|
|
2154
|
-
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
|
2155
|
-
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
|
2156
|
-
color = clamp( color, 0.0, 1.0 );
|
|
2157
|
-
return color;
|
|
2158
|
-
}
|
|
2159
|
-
vec3 NeutralToneMapping( vec3 color ) {
|
|
2160
|
-
const float StartCompression = 0.8 - 0.04;
|
|
2161
|
-
const float Desaturation = 0.15;
|
|
2162
|
-
color *= toneMappingExposure;
|
|
2163
|
-
float x = min( color.r, min( color.g, color.b ) );
|
|
2164
|
-
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
|
2165
|
-
color -= offset;
|
|
2166
|
-
float peak = max( color.r, max( color.g, color.b ) );
|
|
2167
|
-
if ( peak < StartCompression ) return color;
|
|
2168
|
-
float d = 1. - StartCompression;
|
|
2169
|
-
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
|
2170
|
-
color *= newPeak / peak;
|
|
2171
|
-
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2172
|
-
return mix( color, vec3( newPeak ), g );
|
|
2173
|
-
}
|
|
2174
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,Il=`#ifdef USE_TRANSMISSION
|
|
2175
|
-
material.transmission = transmission;
|
|
2176
|
-
material.transmissionAlpha = 1.0;
|
|
2177
|
-
material.thickness = thickness;
|
|
2178
|
-
material.attenuationDistance = attenuationDistance;
|
|
2179
|
-
material.attenuationColor = attenuationColor;
|
|
2180
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2181
|
-
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
|
2182
|
-
#endif
|
|
2183
|
-
#ifdef USE_THICKNESSMAP
|
|
2184
|
-
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
|
2185
|
-
#endif
|
|
2186
|
-
vec3 pos = vWorldPosition;
|
|
2187
|
-
vec3 v = normalize( cameraPosition - pos );
|
|
2188
|
-
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
2189
|
-
vec4 transmitted = getIBLVolumeRefraction(
|
|
2190
|
-
n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
|
|
2191
|
-
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
|
|
2192
|
-
material.attenuationColor, material.attenuationDistance );
|
|
2193
|
-
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2194
|
-
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2195
|
-
#endif`,Nl=`#ifdef USE_TRANSMISSION
|
|
2196
|
-
uniform float transmission;
|
|
2197
|
-
uniform float thickness;
|
|
2198
|
-
uniform float attenuationDistance;
|
|
2199
|
-
uniform vec3 attenuationColor;
|
|
2200
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2201
|
-
uniform sampler2D transmissionMap;
|
|
2202
|
-
#endif
|
|
2203
|
-
#ifdef USE_THICKNESSMAP
|
|
2204
|
-
uniform sampler2D thicknessMap;
|
|
2205
|
-
#endif
|
|
2206
|
-
uniform vec2 transmissionSamplerSize;
|
|
2207
|
-
uniform sampler2D transmissionSamplerMap;
|
|
2208
|
-
uniform mat4 modelMatrix;
|
|
2209
|
-
uniform mat4 projectionMatrix;
|
|
2210
|
-
varying vec3 vWorldPosition;
|
|
2211
|
-
float w0( float a ) {
|
|
2212
|
-
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
|
2213
|
-
}
|
|
2214
|
-
float w1( float a ) {
|
|
2215
|
-
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
|
2216
|
-
}
|
|
2217
|
-
float w2( float a ){
|
|
2218
|
-
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
|
2219
|
-
}
|
|
2220
|
-
float w3( float a ) {
|
|
2221
|
-
return ( 1.0 / 6.0 ) * ( a * a * a );
|
|
2222
|
-
}
|
|
2223
|
-
float g0( float a ) {
|
|
2224
|
-
return w0( a ) + w1( a );
|
|
2225
|
-
}
|
|
2226
|
-
float g1( float a ) {
|
|
2227
|
-
return w2( a ) + w3( a );
|
|
2228
|
-
}
|
|
2229
|
-
float h0( float a ) {
|
|
2230
|
-
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
|
2231
|
-
}
|
|
2232
|
-
float h1( float a ) {
|
|
2233
|
-
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
|
2234
|
-
}
|
|
2235
|
-
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
|
2236
|
-
uv = uv * texelSize.zw + 0.5;
|
|
2237
|
-
vec2 iuv = floor( uv );
|
|
2238
|
-
vec2 fuv = fract( uv );
|
|
2239
|
-
float g0x = g0( fuv.x );
|
|
2240
|
-
float g1x = g1( fuv.x );
|
|
2241
|
-
float h0x = h0( fuv.x );
|
|
2242
|
-
float h1x = h1( fuv.x );
|
|
2243
|
-
float h0y = h0( fuv.y );
|
|
2244
|
-
float h1y = h1( fuv.y );
|
|
2245
|
-
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2246
|
-
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2247
|
-
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2248
|
-
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2249
|
-
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
|
2250
|
-
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
|
2251
|
-
}
|
|
2252
|
-
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
|
2253
|
-
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
|
2254
|
-
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
|
2255
|
-
vec2 fLodSizeInv = 1.0 / fLodSize;
|
|
2256
|
-
vec2 cLodSizeInv = 1.0 / cLodSize;
|
|
2257
|
-
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
|
2258
|
-
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
|
2259
|
-
return mix( fSample, cSample, fract( lod ) );
|
|
2260
|
-
}
|
|
2261
|
-
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
2262
|
-
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
2263
|
-
vec3 modelScale;
|
|
2264
|
-
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
2265
|
-
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
2266
|
-
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
2267
|
-
return normalize( refractionVector ) * thickness * modelScale;
|
|
2268
|
-
}
|
|
2269
|
-
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
2270
|
-
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
2271
|
-
}
|
|
2272
|
-
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
2273
|
-
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
2274
|
-
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
|
2275
|
-
}
|
|
2276
|
-
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2277
|
-
if ( isinf( attenuationDistance ) ) {
|
|
2278
|
-
return vec3( 1.0 );
|
|
2279
|
-
} else {
|
|
2280
|
-
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
2281
|
-
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
2285
|
-
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
2286
|
-
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
|
|
2287
|
-
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2288
|
-
vec4 transmittedLight;
|
|
2289
|
-
vec3 transmittance;
|
|
2290
|
-
#ifdef USE_DISPERSION
|
|
2291
|
-
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
|
2292
|
-
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
|
2293
|
-
for ( int i = 0; i < 3; i ++ ) {
|
|
2294
|
-
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
|
|
2295
|
-
vec3 refractedRayExit = position + transmissionRay;
|
|
2296
|
-
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2297
|
-
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2298
|
-
refractionCoords += 1.0;
|
|
2299
|
-
refractionCoords /= 2.0;
|
|
2300
|
-
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
|
2301
|
-
transmittedLight[ i ] = transmissionSample[ i ];
|
|
2302
|
-
transmittedLight.a += transmissionSample.a;
|
|
2303
|
-
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
|
2304
|
-
}
|
|
2305
|
-
transmittedLight.a /= 3.0;
|
|
2306
|
-
#else
|
|
2307
|
-
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
2308
|
-
vec3 refractedRayExit = position + transmissionRay;
|
|
2309
|
-
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2310
|
-
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2311
|
-
refractionCoords += 1.0;
|
|
2312
|
-
refractionCoords /= 2.0;
|
|
2313
|
-
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
2314
|
-
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
2315
|
-
#endif
|
|
2316
|
-
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
|
2317
|
-
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
2318
|
-
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2319
|
-
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2320
|
-
}
|
|
2321
|
-
#endif`,Ol=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2322
|
-
varying vec2 vUv;
|
|
2323
|
-
#endif
|
|
2324
|
-
#ifdef USE_MAP
|
|
2325
|
-
varying vec2 vMapUv;
|
|
2326
|
-
#endif
|
|
2327
|
-
#ifdef USE_ALPHAMAP
|
|
2328
|
-
varying vec2 vAlphaMapUv;
|
|
2329
|
-
#endif
|
|
2330
|
-
#ifdef USE_LIGHTMAP
|
|
2331
|
-
varying vec2 vLightMapUv;
|
|
2332
|
-
#endif
|
|
2333
|
-
#ifdef USE_AOMAP
|
|
2334
|
-
varying vec2 vAoMapUv;
|
|
2335
|
-
#endif
|
|
2336
|
-
#ifdef USE_BUMPMAP
|
|
2337
|
-
varying vec2 vBumpMapUv;
|
|
2338
|
-
#endif
|
|
2339
|
-
#ifdef USE_NORMALMAP
|
|
2340
|
-
varying vec2 vNormalMapUv;
|
|
2341
|
-
#endif
|
|
2342
|
-
#ifdef USE_EMISSIVEMAP
|
|
2343
|
-
varying vec2 vEmissiveMapUv;
|
|
2344
|
-
#endif
|
|
2345
|
-
#ifdef USE_METALNESSMAP
|
|
2346
|
-
varying vec2 vMetalnessMapUv;
|
|
2347
|
-
#endif
|
|
2348
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2349
|
-
varying vec2 vRoughnessMapUv;
|
|
2350
|
-
#endif
|
|
2351
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2352
|
-
varying vec2 vAnisotropyMapUv;
|
|
2353
|
-
#endif
|
|
2354
|
-
#ifdef USE_CLEARCOATMAP
|
|
2355
|
-
varying vec2 vClearcoatMapUv;
|
|
2356
|
-
#endif
|
|
2357
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2358
|
-
varying vec2 vClearcoatNormalMapUv;
|
|
2359
|
-
#endif
|
|
2360
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2361
|
-
varying vec2 vClearcoatRoughnessMapUv;
|
|
2362
|
-
#endif
|
|
2363
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2364
|
-
varying vec2 vIridescenceMapUv;
|
|
2365
|
-
#endif
|
|
2366
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2367
|
-
varying vec2 vIridescenceThicknessMapUv;
|
|
2368
|
-
#endif
|
|
2369
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2370
|
-
varying vec2 vSheenColorMapUv;
|
|
2371
|
-
#endif
|
|
2372
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2373
|
-
varying vec2 vSheenRoughnessMapUv;
|
|
2374
|
-
#endif
|
|
2375
|
-
#ifdef USE_SPECULARMAP
|
|
2376
|
-
varying vec2 vSpecularMapUv;
|
|
2377
|
-
#endif
|
|
2378
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2379
|
-
varying vec2 vSpecularColorMapUv;
|
|
2380
|
-
#endif
|
|
2381
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2382
|
-
varying vec2 vSpecularIntensityMapUv;
|
|
2383
|
-
#endif
|
|
2384
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2385
|
-
uniform mat3 transmissionMapTransform;
|
|
2386
|
-
varying vec2 vTransmissionMapUv;
|
|
2387
|
-
#endif
|
|
2388
|
-
#ifdef USE_THICKNESSMAP
|
|
2389
|
-
uniform mat3 thicknessMapTransform;
|
|
2390
|
-
varying vec2 vThicknessMapUv;
|
|
2391
|
-
#endif`,Bl=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2392
|
-
varying vec2 vUv;
|
|
2393
|
-
#endif
|
|
2394
|
-
#ifdef USE_MAP
|
|
2395
|
-
uniform mat3 mapTransform;
|
|
2396
|
-
varying vec2 vMapUv;
|
|
2397
|
-
#endif
|
|
2398
|
-
#ifdef USE_ALPHAMAP
|
|
2399
|
-
uniform mat3 alphaMapTransform;
|
|
2400
|
-
varying vec2 vAlphaMapUv;
|
|
2401
|
-
#endif
|
|
2402
|
-
#ifdef USE_LIGHTMAP
|
|
2403
|
-
uniform mat3 lightMapTransform;
|
|
2404
|
-
varying vec2 vLightMapUv;
|
|
2405
|
-
#endif
|
|
2406
|
-
#ifdef USE_AOMAP
|
|
2407
|
-
uniform mat3 aoMapTransform;
|
|
2408
|
-
varying vec2 vAoMapUv;
|
|
2409
|
-
#endif
|
|
2410
|
-
#ifdef USE_BUMPMAP
|
|
2411
|
-
uniform mat3 bumpMapTransform;
|
|
2412
|
-
varying vec2 vBumpMapUv;
|
|
2413
|
-
#endif
|
|
2414
|
-
#ifdef USE_NORMALMAP
|
|
2415
|
-
uniform mat3 normalMapTransform;
|
|
2416
|
-
varying vec2 vNormalMapUv;
|
|
2417
|
-
#endif
|
|
2418
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2419
|
-
uniform mat3 displacementMapTransform;
|
|
2420
|
-
varying vec2 vDisplacementMapUv;
|
|
2421
|
-
#endif
|
|
2422
|
-
#ifdef USE_EMISSIVEMAP
|
|
2423
|
-
uniform mat3 emissiveMapTransform;
|
|
2424
|
-
varying vec2 vEmissiveMapUv;
|
|
2425
|
-
#endif
|
|
2426
|
-
#ifdef USE_METALNESSMAP
|
|
2427
|
-
uniform mat3 metalnessMapTransform;
|
|
2428
|
-
varying vec2 vMetalnessMapUv;
|
|
2429
|
-
#endif
|
|
2430
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2431
|
-
uniform mat3 roughnessMapTransform;
|
|
2432
|
-
varying vec2 vRoughnessMapUv;
|
|
2433
|
-
#endif
|
|
2434
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2435
|
-
uniform mat3 anisotropyMapTransform;
|
|
2436
|
-
varying vec2 vAnisotropyMapUv;
|
|
2437
|
-
#endif
|
|
2438
|
-
#ifdef USE_CLEARCOATMAP
|
|
2439
|
-
uniform mat3 clearcoatMapTransform;
|
|
2440
|
-
varying vec2 vClearcoatMapUv;
|
|
2441
|
-
#endif
|
|
2442
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2443
|
-
uniform mat3 clearcoatNormalMapTransform;
|
|
2444
|
-
varying vec2 vClearcoatNormalMapUv;
|
|
2445
|
-
#endif
|
|
2446
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2447
|
-
uniform mat3 clearcoatRoughnessMapTransform;
|
|
2448
|
-
varying vec2 vClearcoatRoughnessMapUv;
|
|
2449
|
-
#endif
|
|
2450
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2451
|
-
uniform mat3 sheenColorMapTransform;
|
|
2452
|
-
varying vec2 vSheenColorMapUv;
|
|
2453
|
-
#endif
|
|
2454
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2455
|
-
uniform mat3 sheenRoughnessMapTransform;
|
|
2456
|
-
varying vec2 vSheenRoughnessMapUv;
|
|
2457
|
-
#endif
|
|
2458
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2459
|
-
uniform mat3 iridescenceMapTransform;
|
|
2460
|
-
varying vec2 vIridescenceMapUv;
|
|
2461
|
-
#endif
|
|
2462
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2463
|
-
uniform mat3 iridescenceThicknessMapTransform;
|
|
2464
|
-
varying vec2 vIridescenceThicknessMapUv;
|
|
2465
|
-
#endif
|
|
2466
|
-
#ifdef USE_SPECULARMAP
|
|
2467
|
-
uniform mat3 specularMapTransform;
|
|
2468
|
-
varying vec2 vSpecularMapUv;
|
|
2469
|
-
#endif
|
|
2470
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2471
|
-
uniform mat3 specularColorMapTransform;
|
|
2472
|
-
varying vec2 vSpecularColorMapUv;
|
|
2473
|
-
#endif
|
|
2474
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2475
|
-
uniform mat3 specularIntensityMapTransform;
|
|
2476
|
-
varying vec2 vSpecularIntensityMapUv;
|
|
2477
|
-
#endif
|
|
2478
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2479
|
-
uniform mat3 transmissionMapTransform;
|
|
2480
|
-
varying vec2 vTransmissionMapUv;
|
|
2481
|
-
#endif
|
|
2482
|
-
#ifdef USE_THICKNESSMAP
|
|
2483
|
-
uniform mat3 thicknessMapTransform;
|
|
2484
|
-
varying vec2 vThicknessMapUv;
|
|
2485
|
-
#endif`,Gl=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2486
|
-
vUv = vec3( uv, 1 ).xy;
|
|
2487
|
-
#endif
|
|
2488
|
-
#ifdef USE_MAP
|
|
2489
|
-
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
|
2490
|
-
#endif
|
|
2491
|
-
#ifdef USE_ALPHAMAP
|
|
2492
|
-
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
|
2493
|
-
#endif
|
|
2494
|
-
#ifdef USE_LIGHTMAP
|
|
2495
|
-
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
|
2496
|
-
#endif
|
|
2497
|
-
#ifdef USE_AOMAP
|
|
2498
|
-
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
|
2499
|
-
#endif
|
|
2500
|
-
#ifdef USE_BUMPMAP
|
|
2501
|
-
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
|
2502
|
-
#endif
|
|
2503
|
-
#ifdef USE_NORMALMAP
|
|
2504
|
-
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
|
2505
|
-
#endif
|
|
2506
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2507
|
-
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
|
2508
|
-
#endif
|
|
2509
|
-
#ifdef USE_EMISSIVEMAP
|
|
2510
|
-
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
|
2511
|
-
#endif
|
|
2512
|
-
#ifdef USE_METALNESSMAP
|
|
2513
|
-
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
|
2514
|
-
#endif
|
|
2515
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2516
|
-
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2517
|
-
#endif
|
|
2518
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2519
|
-
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
|
2520
|
-
#endif
|
|
2521
|
-
#ifdef USE_CLEARCOATMAP
|
|
2522
|
-
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
|
2523
|
-
#endif
|
|
2524
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2525
|
-
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
|
2526
|
-
#endif
|
|
2527
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2528
|
-
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2529
|
-
#endif
|
|
2530
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2531
|
-
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
|
2532
|
-
#endif
|
|
2533
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2534
|
-
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
|
2535
|
-
#endif
|
|
2536
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2537
|
-
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
|
2538
|
-
#endif
|
|
2539
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2540
|
-
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2541
|
-
#endif
|
|
2542
|
-
#ifdef USE_SPECULARMAP
|
|
2543
|
-
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
|
2544
|
-
#endif
|
|
2545
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2546
|
-
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
|
2547
|
-
#endif
|
|
2548
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2549
|
-
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
|
2550
|
-
#endif
|
|
2551
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2552
|
-
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
|
2553
|
-
#endif
|
|
2554
|
-
#ifdef USE_THICKNESSMAP
|
|
2555
|
-
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2556
|
-
#endif`,zl=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2557
|
-
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2558
|
-
#ifdef USE_BATCHING
|
|
2559
|
-
worldPosition = batchingMatrix * worldPosition;
|
|
2560
|
-
#endif
|
|
2561
|
-
#ifdef USE_INSTANCING
|
|
2562
|
-
worldPosition = instanceMatrix * worldPosition;
|
|
2563
|
-
#endif
|
|
2564
|
-
worldPosition = modelMatrix * worldPosition;
|
|
2565
|
-
#endif`;const Vl=`varying vec2 vUv;
|
|
2566
|
-
uniform mat3 uvTransform;
|
|
2567
|
-
void main() {
|
|
2568
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2569
|
-
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2570
|
-
}`,Hl=`uniform sampler2D t2D;
|
|
2571
|
-
uniform float backgroundIntensity;
|
|
2572
|
-
varying vec2 vUv;
|
|
2573
|
-
void main() {
|
|
2574
|
-
vec4 texColor = texture2D( t2D, vUv );
|
|
2575
|
-
#ifdef DECODE_VIDEO_TEXTURE
|
|
2576
|
-
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 );
|
|
2577
|
-
#endif
|
|
2578
|
-
texColor.rgb *= backgroundIntensity;
|
|
2579
|
-
gl_FragColor = texColor;
|
|
2580
|
-
#include <tonemapping_fragment>
|
|
2581
|
-
#include <colorspace_fragment>
|
|
2582
|
-
}`,kl=`varying vec3 vWorldDirection;
|
|
2583
|
-
#include <common>
|
|
2584
|
-
void main() {
|
|
2585
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2586
|
-
#include <begin_vertex>
|
|
2587
|
-
#include <project_vertex>
|
|
2588
|
-
gl_Position.z = gl_Position.w;
|
|
2589
|
-
}`,Wl=`#ifdef ENVMAP_TYPE_CUBE
|
|
2590
|
-
uniform samplerCube envMap;
|
|
2591
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2592
|
-
uniform sampler2D envMap;
|
|
2593
|
-
#endif
|
|
2594
|
-
uniform float flipEnvMap;
|
|
2595
|
-
uniform float backgroundBlurriness;
|
|
2596
|
-
uniform float backgroundIntensity;
|
|
2597
|
-
uniform mat3 backgroundRotation;
|
|
2598
|
-
varying vec3 vWorldDirection;
|
|
2599
|
-
#include <cube_uv_reflection_fragment>
|
|
2600
|
-
void main() {
|
|
2601
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
2602
|
-
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
|
2603
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2604
|
-
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
|
2605
|
-
#else
|
|
2606
|
-
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2607
|
-
#endif
|
|
2608
|
-
texColor.rgb *= backgroundIntensity;
|
|
2609
|
-
gl_FragColor = texColor;
|
|
2610
|
-
#include <tonemapping_fragment>
|
|
2611
|
-
#include <colorspace_fragment>
|
|
2612
|
-
}`,Xl=`varying vec3 vWorldDirection;
|
|
2613
|
-
#include <common>
|
|
2614
|
-
void main() {
|
|
2615
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2616
|
-
#include <begin_vertex>
|
|
2617
|
-
#include <project_vertex>
|
|
2618
|
-
gl_Position.z = gl_Position.w;
|
|
2619
|
-
}`,ql=`uniform samplerCube tCube;
|
|
2620
|
-
uniform float tFlip;
|
|
2621
|
-
uniform float opacity;
|
|
2622
|
-
varying vec3 vWorldDirection;
|
|
2623
|
-
void main() {
|
|
2624
|
-
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
|
2625
|
-
gl_FragColor = texColor;
|
|
2626
|
-
gl_FragColor.a *= opacity;
|
|
2627
|
-
#include <tonemapping_fragment>
|
|
2628
|
-
#include <colorspace_fragment>
|
|
2629
|
-
}`,Yl=`#include <common>
|
|
2630
|
-
#include <batching_pars_vertex>
|
|
2631
|
-
#include <uv_pars_vertex>
|
|
2632
|
-
#include <displacementmap_pars_vertex>
|
|
2633
|
-
#include <morphtarget_pars_vertex>
|
|
2634
|
-
#include <skinning_pars_vertex>
|
|
2635
|
-
#include <logdepthbuf_pars_vertex>
|
|
2636
|
-
#include <clipping_planes_pars_vertex>
|
|
2637
|
-
varying vec2 vHighPrecisionZW;
|
|
2638
|
-
void main() {
|
|
2639
|
-
#include <uv_vertex>
|
|
2640
|
-
#include <batching_vertex>
|
|
2641
|
-
#include <skinbase_vertex>
|
|
2642
|
-
#include <morphinstance_vertex>
|
|
2643
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2644
|
-
#include <beginnormal_vertex>
|
|
2645
|
-
#include <morphnormal_vertex>
|
|
2646
|
-
#include <skinnormal_vertex>
|
|
2647
|
-
#endif
|
|
2648
|
-
#include <begin_vertex>
|
|
2649
|
-
#include <morphtarget_vertex>
|
|
2650
|
-
#include <skinning_vertex>
|
|
2651
|
-
#include <displacementmap_vertex>
|
|
2652
|
-
#include <project_vertex>
|
|
2653
|
-
#include <logdepthbuf_vertex>
|
|
2654
|
-
#include <clipping_planes_vertex>
|
|
2655
|
-
vHighPrecisionZW = gl_Position.zw;
|
|
2656
|
-
}`,Kl=`#if DEPTH_PACKING == 3200
|
|
2657
|
-
uniform float opacity;
|
|
2658
|
-
#endif
|
|
2659
|
-
#include <common>
|
|
2660
|
-
#include <packing>
|
|
2661
|
-
#include <uv_pars_fragment>
|
|
2662
|
-
#include <map_pars_fragment>
|
|
2663
|
-
#include <alphamap_pars_fragment>
|
|
2664
|
-
#include <alphatest_pars_fragment>
|
|
2665
|
-
#include <alphahash_pars_fragment>
|
|
2666
|
-
#include <logdepthbuf_pars_fragment>
|
|
2667
|
-
#include <clipping_planes_pars_fragment>
|
|
2668
|
-
varying vec2 vHighPrecisionZW;
|
|
2669
|
-
void main() {
|
|
2670
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2671
|
-
#include <clipping_planes_fragment>
|
|
2672
|
-
#if DEPTH_PACKING == 3200
|
|
2673
|
-
diffuseColor.a = opacity;
|
|
2674
|
-
#endif
|
|
2675
|
-
#include <map_fragment>
|
|
2676
|
-
#include <alphamap_fragment>
|
|
2677
|
-
#include <alphatest_fragment>
|
|
2678
|
-
#include <alphahash_fragment>
|
|
2679
|
-
#include <logdepthbuf_fragment>
|
|
2680
|
-
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2681
|
-
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
|
|
2682
|
-
#else
|
|
2683
|
-
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
|
|
2684
|
-
#endif
|
|
2685
|
-
#if DEPTH_PACKING == 3200
|
|
2686
|
-
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
2687
|
-
#elif DEPTH_PACKING == 3201
|
|
2688
|
-
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2689
|
-
#elif DEPTH_PACKING == 3202
|
|
2690
|
-
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
|
2691
|
-
#elif DEPTH_PACKING == 3203
|
|
2692
|
-
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
2693
|
-
#endif
|
|
2694
|
-
}`,Zl=`#define DISTANCE
|
|
2695
|
-
varying vec3 vWorldPosition;
|
|
2696
|
-
#include <common>
|
|
2697
|
-
#include <batching_pars_vertex>
|
|
2698
|
-
#include <uv_pars_vertex>
|
|
2699
|
-
#include <displacementmap_pars_vertex>
|
|
2700
|
-
#include <morphtarget_pars_vertex>
|
|
2701
|
-
#include <skinning_pars_vertex>
|
|
2702
|
-
#include <clipping_planes_pars_vertex>
|
|
2703
|
-
void main() {
|
|
2704
|
-
#include <uv_vertex>
|
|
2705
|
-
#include <batching_vertex>
|
|
2706
|
-
#include <skinbase_vertex>
|
|
2707
|
-
#include <morphinstance_vertex>
|
|
2708
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2709
|
-
#include <beginnormal_vertex>
|
|
2710
|
-
#include <morphnormal_vertex>
|
|
2711
|
-
#include <skinnormal_vertex>
|
|
2712
|
-
#endif
|
|
2713
|
-
#include <begin_vertex>
|
|
2714
|
-
#include <morphtarget_vertex>
|
|
2715
|
-
#include <skinning_vertex>
|
|
2716
|
-
#include <displacementmap_vertex>
|
|
2717
|
-
#include <project_vertex>
|
|
2718
|
-
#include <worldpos_vertex>
|
|
2719
|
-
#include <clipping_planes_vertex>
|
|
2720
|
-
vWorldPosition = worldPosition.xyz;
|
|
2721
|
-
}`,$l=`#define DISTANCE
|
|
2722
|
-
uniform vec3 referencePosition;
|
|
2723
|
-
uniform float nearDistance;
|
|
2724
|
-
uniform float farDistance;
|
|
2725
|
-
varying vec3 vWorldPosition;
|
|
2726
|
-
#include <common>
|
|
2727
|
-
#include <uv_pars_fragment>
|
|
2728
|
-
#include <map_pars_fragment>
|
|
2729
|
-
#include <alphamap_pars_fragment>
|
|
2730
|
-
#include <alphatest_pars_fragment>
|
|
2731
|
-
#include <alphahash_pars_fragment>
|
|
2732
|
-
#include <clipping_planes_pars_fragment>
|
|
2733
|
-
void main () {
|
|
2734
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2735
|
-
#include <clipping_planes_fragment>
|
|
2736
|
-
#include <map_fragment>
|
|
2737
|
-
#include <alphamap_fragment>
|
|
2738
|
-
#include <alphatest_fragment>
|
|
2739
|
-
#include <alphahash_fragment>
|
|
2740
|
-
float dist = length( vWorldPosition - referencePosition );
|
|
2741
|
-
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2742
|
-
dist = saturate( dist );
|
|
2743
|
-
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
|
2744
|
-
}`,jl=`varying vec3 vWorldDirection;
|
|
2745
|
-
#include <common>
|
|
2746
|
-
void main() {
|
|
2747
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2748
|
-
#include <begin_vertex>
|
|
2749
|
-
#include <project_vertex>
|
|
2750
|
-
}`,Jl=`uniform sampler2D tEquirect;
|
|
2751
|
-
varying vec3 vWorldDirection;
|
|
2752
|
-
#include <common>
|
|
2753
|
-
void main() {
|
|
2754
|
-
vec3 direction = normalize( vWorldDirection );
|
|
2755
|
-
vec2 sampleUV = equirectUv( direction );
|
|
2756
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2757
|
-
#include <tonemapping_fragment>
|
|
2758
|
-
#include <colorspace_fragment>
|
|
2759
|
-
}`,Ql=`uniform float scale;
|
|
2760
|
-
attribute float lineDistance;
|
|
2761
|
-
varying float vLineDistance;
|
|
2762
|
-
#include <common>
|
|
2763
|
-
#include <uv_pars_vertex>
|
|
2764
|
-
#include <color_pars_vertex>
|
|
2765
|
-
#include <fog_pars_vertex>
|
|
2766
|
-
#include <morphtarget_pars_vertex>
|
|
2767
|
-
#include <logdepthbuf_pars_vertex>
|
|
2768
|
-
#include <clipping_planes_pars_vertex>
|
|
2769
|
-
void main() {
|
|
2770
|
-
vLineDistance = scale * lineDistance;
|
|
2771
|
-
#include <uv_vertex>
|
|
2772
|
-
#include <color_vertex>
|
|
2773
|
-
#include <morphinstance_vertex>
|
|
2774
|
-
#include <morphcolor_vertex>
|
|
2775
|
-
#include <begin_vertex>
|
|
2776
|
-
#include <morphtarget_vertex>
|
|
2777
|
-
#include <project_vertex>
|
|
2778
|
-
#include <logdepthbuf_vertex>
|
|
2779
|
-
#include <clipping_planes_vertex>
|
|
2780
|
-
#include <fog_vertex>
|
|
2781
|
-
}`,ec=`uniform vec3 diffuse;
|
|
2782
|
-
uniform float opacity;
|
|
2783
|
-
uniform float dashSize;
|
|
2784
|
-
uniform float totalSize;
|
|
2785
|
-
varying float vLineDistance;
|
|
2786
|
-
#include <common>
|
|
2787
|
-
#include <color_pars_fragment>
|
|
2788
|
-
#include <uv_pars_fragment>
|
|
2789
|
-
#include <map_pars_fragment>
|
|
2790
|
-
#include <fog_pars_fragment>
|
|
2791
|
-
#include <logdepthbuf_pars_fragment>
|
|
2792
|
-
#include <clipping_planes_pars_fragment>
|
|
2793
|
-
void main() {
|
|
2794
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2795
|
-
#include <clipping_planes_fragment>
|
|
2796
|
-
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2797
|
-
discard;
|
|
2798
|
-
}
|
|
2799
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
2800
|
-
#include <logdepthbuf_fragment>
|
|
2801
|
-
#include <map_fragment>
|
|
2802
|
-
#include <color_fragment>
|
|
2803
|
-
outgoingLight = diffuseColor.rgb;
|
|
2804
|
-
#include <opaque_fragment>
|
|
2805
|
-
#include <tonemapping_fragment>
|
|
2806
|
-
#include <colorspace_fragment>
|
|
2807
|
-
#include <fog_fragment>
|
|
2808
|
-
#include <premultiplied_alpha_fragment>
|
|
2809
|
-
}`,tc=`#include <common>
|
|
2810
|
-
#include <batching_pars_vertex>
|
|
2811
|
-
#include <uv_pars_vertex>
|
|
2812
|
-
#include <envmap_pars_vertex>
|
|
2813
|
-
#include <color_pars_vertex>
|
|
2814
|
-
#include <fog_pars_vertex>
|
|
2815
|
-
#include <morphtarget_pars_vertex>
|
|
2816
|
-
#include <skinning_pars_vertex>
|
|
2817
|
-
#include <logdepthbuf_pars_vertex>
|
|
2818
|
-
#include <clipping_planes_pars_vertex>
|
|
2819
|
-
void main() {
|
|
2820
|
-
#include <uv_vertex>
|
|
2821
|
-
#include <color_vertex>
|
|
2822
|
-
#include <morphinstance_vertex>
|
|
2823
|
-
#include <morphcolor_vertex>
|
|
2824
|
-
#include <batching_vertex>
|
|
2825
|
-
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
2826
|
-
#include <beginnormal_vertex>
|
|
2827
|
-
#include <morphnormal_vertex>
|
|
2828
|
-
#include <skinbase_vertex>
|
|
2829
|
-
#include <skinnormal_vertex>
|
|
2830
|
-
#include <defaultnormal_vertex>
|
|
2831
|
-
#endif
|
|
2832
|
-
#include <begin_vertex>
|
|
2833
|
-
#include <morphtarget_vertex>
|
|
2834
|
-
#include <skinning_vertex>
|
|
2835
|
-
#include <project_vertex>
|
|
2836
|
-
#include <logdepthbuf_vertex>
|
|
2837
|
-
#include <clipping_planes_vertex>
|
|
2838
|
-
#include <worldpos_vertex>
|
|
2839
|
-
#include <envmap_vertex>
|
|
2840
|
-
#include <fog_vertex>
|
|
2841
|
-
}`,nc=`uniform vec3 diffuse;
|
|
2842
|
-
uniform float opacity;
|
|
2843
|
-
#ifndef FLAT_SHADED
|
|
2844
|
-
varying vec3 vNormal;
|
|
2845
|
-
#endif
|
|
2846
|
-
#include <common>
|
|
2847
|
-
#include <dithering_pars_fragment>
|
|
2848
|
-
#include <color_pars_fragment>
|
|
2849
|
-
#include <uv_pars_fragment>
|
|
2850
|
-
#include <map_pars_fragment>
|
|
2851
|
-
#include <alphamap_pars_fragment>
|
|
2852
|
-
#include <alphatest_pars_fragment>
|
|
2853
|
-
#include <alphahash_pars_fragment>
|
|
2854
|
-
#include <aomap_pars_fragment>
|
|
2855
|
-
#include <lightmap_pars_fragment>
|
|
2856
|
-
#include <envmap_common_pars_fragment>
|
|
2857
|
-
#include <envmap_pars_fragment>
|
|
2858
|
-
#include <fog_pars_fragment>
|
|
2859
|
-
#include <specularmap_pars_fragment>
|
|
2860
|
-
#include <logdepthbuf_pars_fragment>
|
|
2861
|
-
#include <clipping_planes_pars_fragment>
|
|
2862
|
-
void main() {
|
|
2863
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2864
|
-
#include <clipping_planes_fragment>
|
|
2865
|
-
#include <logdepthbuf_fragment>
|
|
2866
|
-
#include <map_fragment>
|
|
2867
|
-
#include <color_fragment>
|
|
2868
|
-
#include <alphamap_fragment>
|
|
2869
|
-
#include <alphatest_fragment>
|
|
2870
|
-
#include <alphahash_fragment>
|
|
2871
|
-
#include <specularmap_fragment>
|
|
2872
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2873
|
-
#ifdef USE_LIGHTMAP
|
|
2874
|
-
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
2875
|
-
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
|
2876
|
-
#else
|
|
2877
|
-
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2878
|
-
#endif
|
|
2879
|
-
#include <aomap_fragment>
|
|
2880
|
-
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2881
|
-
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2882
|
-
#include <envmap_fragment>
|
|
2883
|
-
#include <opaque_fragment>
|
|
2884
|
-
#include <tonemapping_fragment>
|
|
2885
|
-
#include <colorspace_fragment>
|
|
2886
|
-
#include <fog_fragment>
|
|
2887
|
-
#include <premultiplied_alpha_fragment>
|
|
2888
|
-
#include <dithering_fragment>
|
|
2889
|
-
}`,ic=`#define LAMBERT
|
|
2890
|
-
varying vec3 vViewPosition;
|
|
2891
|
-
#include <common>
|
|
2892
|
-
#include <batching_pars_vertex>
|
|
2893
|
-
#include <uv_pars_vertex>
|
|
2894
|
-
#include <displacementmap_pars_vertex>
|
|
2895
|
-
#include <envmap_pars_vertex>
|
|
2896
|
-
#include <color_pars_vertex>
|
|
2897
|
-
#include <fog_pars_vertex>
|
|
2898
|
-
#include <normal_pars_vertex>
|
|
2899
|
-
#include <morphtarget_pars_vertex>
|
|
2900
|
-
#include <skinning_pars_vertex>
|
|
2901
|
-
#include <shadowmap_pars_vertex>
|
|
2902
|
-
#include <logdepthbuf_pars_vertex>
|
|
2903
|
-
#include <clipping_planes_pars_vertex>
|
|
2904
|
-
void main() {
|
|
2905
|
-
#include <uv_vertex>
|
|
2906
|
-
#include <color_vertex>
|
|
2907
|
-
#include <morphinstance_vertex>
|
|
2908
|
-
#include <morphcolor_vertex>
|
|
2909
|
-
#include <batching_vertex>
|
|
2910
|
-
#include <beginnormal_vertex>
|
|
2911
|
-
#include <morphnormal_vertex>
|
|
2912
|
-
#include <skinbase_vertex>
|
|
2913
|
-
#include <skinnormal_vertex>
|
|
2914
|
-
#include <defaultnormal_vertex>
|
|
2915
|
-
#include <normal_vertex>
|
|
2916
|
-
#include <begin_vertex>
|
|
2917
|
-
#include <morphtarget_vertex>
|
|
2918
|
-
#include <skinning_vertex>
|
|
2919
|
-
#include <displacementmap_vertex>
|
|
2920
|
-
#include <project_vertex>
|
|
2921
|
-
#include <logdepthbuf_vertex>
|
|
2922
|
-
#include <clipping_planes_vertex>
|
|
2923
|
-
vViewPosition = - mvPosition.xyz;
|
|
2924
|
-
#include <worldpos_vertex>
|
|
2925
|
-
#include <envmap_vertex>
|
|
2926
|
-
#include <shadowmap_vertex>
|
|
2927
|
-
#include <fog_vertex>
|
|
2928
|
-
}`,rc=`#define LAMBERT
|
|
2929
|
-
uniform vec3 diffuse;
|
|
2930
|
-
uniform vec3 emissive;
|
|
2931
|
-
uniform float opacity;
|
|
2932
|
-
#include <common>
|
|
2933
|
-
#include <dithering_pars_fragment>
|
|
2934
|
-
#include <color_pars_fragment>
|
|
2935
|
-
#include <uv_pars_fragment>
|
|
2936
|
-
#include <map_pars_fragment>
|
|
2937
|
-
#include <alphamap_pars_fragment>
|
|
2938
|
-
#include <alphatest_pars_fragment>
|
|
2939
|
-
#include <alphahash_pars_fragment>
|
|
2940
|
-
#include <aomap_pars_fragment>
|
|
2941
|
-
#include <lightmap_pars_fragment>
|
|
2942
|
-
#include <emissivemap_pars_fragment>
|
|
2943
|
-
#include <cube_uv_reflection_fragment>
|
|
2944
|
-
#include <envmap_common_pars_fragment>
|
|
2945
|
-
#include <envmap_pars_fragment>
|
|
2946
|
-
#include <envmap_physical_pars_fragment>
|
|
2947
|
-
#include <fog_pars_fragment>
|
|
2948
|
-
#include <bsdfs>
|
|
2949
|
-
#include <lights_pars_begin>
|
|
2950
|
-
#include <normal_pars_fragment>
|
|
2951
|
-
#include <lights_lambert_pars_fragment>
|
|
2952
|
-
#include <shadowmap_pars_fragment>
|
|
2953
|
-
#include <bumpmap_pars_fragment>
|
|
2954
|
-
#include <normalmap_pars_fragment>
|
|
2955
|
-
#include <specularmap_pars_fragment>
|
|
2956
|
-
#include <logdepthbuf_pars_fragment>
|
|
2957
|
-
#include <clipping_planes_pars_fragment>
|
|
2958
|
-
void main() {
|
|
2959
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2960
|
-
#include <clipping_planes_fragment>
|
|
2961
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2962
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2963
|
-
#include <logdepthbuf_fragment>
|
|
2964
|
-
#include <map_fragment>
|
|
2965
|
-
#include <color_fragment>
|
|
2966
|
-
#include <alphamap_fragment>
|
|
2967
|
-
#include <alphatest_fragment>
|
|
2968
|
-
#include <alphahash_fragment>
|
|
2969
|
-
#include <specularmap_fragment>
|
|
2970
|
-
#include <normal_fragment_begin>
|
|
2971
|
-
#include <normal_fragment_maps>
|
|
2972
|
-
#include <emissivemap_fragment>
|
|
2973
|
-
#include <lights_lambert_fragment>
|
|
2974
|
-
#include <lights_fragment_begin>
|
|
2975
|
-
#include <lights_fragment_maps>
|
|
2976
|
-
#include <lights_fragment_end>
|
|
2977
|
-
#include <aomap_fragment>
|
|
2978
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2979
|
-
#include <envmap_fragment>
|
|
2980
|
-
#include <opaque_fragment>
|
|
2981
|
-
#include <tonemapping_fragment>
|
|
2982
|
-
#include <colorspace_fragment>
|
|
2983
|
-
#include <fog_fragment>
|
|
2984
|
-
#include <premultiplied_alpha_fragment>
|
|
2985
|
-
#include <dithering_fragment>
|
|
2986
|
-
}`,sc=`#define MATCAP
|
|
2987
|
-
varying vec3 vViewPosition;
|
|
2988
|
-
#include <common>
|
|
2989
|
-
#include <batching_pars_vertex>
|
|
2990
|
-
#include <uv_pars_vertex>
|
|
2991
|
-
#include <color_pars_vertex>
|
|
2992
|
-
#include <displacementmap_pars_vertex>
|
|
2993
|
-
#include <fog_pars_vertex>
|
|
2994
|
-
#include <normal_pars_vertex>
|
|
2995
|
-
#include <morphtarget_pars_vertex>
|
|
2996
|
-
#include <skinning_pars_vertex>
|
|
2997
|
-
#include <logdepthbuf_pars_vertex>
|
|
2998
|
-
#include <clipping_planes_pars_vertex>
|
|
2999
|
-
void main() {
|
|
3000
|
-
#include <uv_vertex>
|
|
3001
|
-
#include <color_vertex>
|
|
3002
|
-
#include <morphinstance_vertex>
|
|
3003
|
-
#include <morphcolor_vertex>
|
|
3004
|
-
#include <batching_vertex>
|
|
3005
|
-
#include <beginnormal_vertex>
|
|
3006
|
-
#include <morphnormal_vertex>
|
|
3007
|
-
#include <skinbase_vertex>
|
|
3008
|
-
#include <skinnormal_vertex>
|
|
3009
|
-
#include <defaultnormal_vertex>
|
|
3010
|
-
#include <normal_vertex>
|
|
3011
|
-
#include <begin_vertex>
|
|
3012
|
-
#include <morphtarget_vertex>
|
|
3013
|
-
#include <skinning_vertex>
|
|
3014
|
-
#include <displacementmap_vertex>
|
|
3015
|
-
#include <project_vertex>
|
|
3016
|
-
#include <logdepthbuf_vertex>
|
|
3017
|
-
#include <clipping_planes_vertex>
|
|
3018
|
-
#include <fog_vertex>
|
|
3019
|
-
vViewPosition = - mvPosition.xyz;
|
|
3020
|
-
}`,ac=`#define MATCAP
|
|
3021
|
-
uniform vec3 diffuse;
|
|
3022
|
-
uniform float opacity;
|
|
3023
|
-
uniform sampler2D matcap;
|
|
3024
|
-
varying vec3 vViewPosition;
|
|
3025
|
-
#include <common>
|
|
3026
|
-
#include <dithering_pars_fragment>
|
|
3027
|
-
#include <color_pars_fragment>
|
|
3028
|
-
#include <uv_pars_fragment>
|
|
3029
|
-
#include <map_pars_fragment>
|
|
3030
|
-
#include <alphamap_pars_fragment>
|
|
3031
|
-
#include <alphatest_pars_fragment>
|
|
3032
|
-
#include <alphahash_pars_fragment>
|
|
3033
|
-
#include <fog_pars_fragment>
|
|
3034
|
-
#include <normal_pars_fragment>
|
|
3035
|
-
#include <bumpmap_pars_fragment>
|
|
3036
|
-
#include <normalmap_pars_fragment>
|
|
3037
|
-
#include <logdepthbuf_pars_fragment>
|
|
3038
|
-
#include <clipping_planes_pars_fragment>
|
|
3039
|
-
void main() {
|
|
3040
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3041
|
-
#include <clipping_planes_fragment>
|
|
3042
|
-
#include <logdepthbuf_fragment>
|
|
3043
|
-
#include <map_fragment>
|
|
3044
|
-
#include <color_fragment>
|
|
3045
|
-
#include <alphamap_fragment>
|
|
3046
|
-
#include <alphatest_fragment>
|
|
3047
|
-
#include <alphahash_fragment>
|
|
3048
|
-
#include <normal_fragment_begin>
|
|
3049
|
-
#include <normal_fragment_maps>
|
|
3050
|
-
vec3 viewDir = normalize( vViewPosition );
|
|
3051
|
-
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
3052
|
-
vec3 y = cross( viewDir, x );
|
|
3053
|
-
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
3054
|
-
#ifdef USE_MATCAP
|
|
3055
|
-
vec4 matcapColor = texture2D( matcap, uv );
|
|
3056
|
-
#else
|
|
3057
|
-
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|
3058
|
-
#endif
|
|
3059
|
-
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
3060
|
-
#include <opaque_fragment>
|
|
3061
|
-
#include <tonemapping_fragment>
|
|
3062
|
-
#include <colorspace_fragment>
|
|
3063
|
-
#include <fog_fragment>
|
|
3064
|
-
#include <premultiplied_alpha_fragment>
|
|
3065
|
-
#include <dithering_fragment>
|
|
3066
|
-
}`,oc=`#define NORMAL
|
|
3067
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3068
|
-
varying vec3 vViewPosition;
|
|
3069
|
-
#endif
|
|
3070
|
-
#include <common>
|
|
3071
|
-
#include <batching_pars_vertex>
|
|
3072
|
-
#include <uv_pars_vertex>
|
|
3073
|
-
#include <displacementmap_pars_vertex>
|
|
3074
|
-
#include <normal_pars_vertex>
|
|
3075
|
-
#include <morphtarget_pars_vertex>
|
|
3076
|
-
#include <skinning_pars_vertex>
|
|
3077
|
-
#include <logdepthbuf_pars_vertex>
|
|
3078
|
-
#include <clipping_planes_pars_vertex>
|
|
3079
|
-
void main() {
|
|
3080
|
-
#include <uv_vertex>
|
|
3081
|
-
#include <batching_vertex>
|
|
3082
|
-
#include <beginnormal_vertex>
|
|
3083
|
-
#include <morphinstance_vertex>
|
|
3084
|
-
#include <morphnormal_vertex>
|
|
3085
|
-
#include <skinbase_vertex>
|
|
3086
|
-
#include <skinnormal_vertex>
|
|
3087
|
-
#include <defaultnormal_vertex>
|
|
3088
|
-
#include <normal_vertex>
|
|
3089
|
-
#include <begin_vertex>
|
|
3090
|
-
#include <morphtarget_vertex>
|
|
3091
|
-
#include <skinning_vertex>
|
|
3092
|
-
#include <displacementmap_vertex>
|
|
3093
|
-
#include <project_vertex>
|
|
3094
|
-
#include <logdepthbuf_vertex>
|
|
3095
|
-
#include <clipping_planes_vertex>
|
|
3096
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3097
|
-
vViewPosition = - mvPosition.xyz;
|
|
3098
|
-
#endif
|
|
3099
|
-
}`,lc=`#define NORMAL
|
|
3100
|
-
uniform float opacity;
|
|
3101
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3102
|
-
varying vec3 vViewPosition;
|
|
3103
|
-
#endif
|
|
3104
|
-
#include <uv_pars_fragment>
|
|
3105
|
-
#include <normal_pars_fragment>
|
|
3106
|
-
#include <bumpmap_pars_fragment>
|
|
3107
|
-
#include <normalmap_pars_fragment>
|
|
3108
|
-
#include <logdepthbuf_pars_fragment>
|
|
3109
|
-
#include <clipping_planes_pars_fragment>
|
|
3110
|
-
void main() {
|
|
3111
|
-
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
|
3112
|
-
#include <clipping_planes_fragment>
|
|
3113
|
-
#include <logdepthbuf_fragment>
|
|
3114
|
-
#include <normal_fragment_begin>
|
|
3115
|
-
#include <normal_fragment_maps>
|
|
3116
|
-
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
|
|
3117
|
-
#ifdef OPAQUE
|
|
3118
|
-
gl_FragColor.a = 1.0;
|
|
3119
|
-
#endif
|
|
3120
|
-
}`,cc=`#define PHONG
|
|
3121
|
-
varying vec3 vViewPosition;
|
|
3122
|
-
#include <common>
|
|
3123
|
-
#include <batching_pars_vertex>
|
|
3124
|
-
#include <uv_pars_vertex>
|
|
3125
|
-
#include <displacementmap_pars_vertex>
|
|
3126
|
-
#include <envmap_pars_vertex>
|
|
3127
|
-
#include <color_pars_vertex>
|
|
3128
|
-
#include <fog_pars_vertex>
|
|
3129
|
-
#include <normal_pars_vertex>
|
|
3130
|
-
#include <morphtarget_pars_vertex>
|
|
3131
|
-
#include <skinning_pars_vertex>
|
|
3132
|
-
#include <shadowmap_pars_vertex>
|
|
3133
|
-
#include <logdepthbuf_pars_vertex>
|
|
3134
|
-
#include <clipping_planes_pars_vertex>
|
|
3135
|
-
void main() {
|
|
3136
|
-
#include <uv_vertex>
|
|
3137
|
-
#include <color_vertex>
|
|
3138
|
-
#include <morphcolor_vertex>
|
|
3139
|
-
#include <batching_vertex>
|
|
3140
|
-
#include <beginnormal_vertex>
|
|
3141
|
-
#include <morphinstance_vertex>
|
|
3142
|
-
#include <morphnormal_vertex>
|
|
3143
|
-
#include <skinbase_vertex>
|
|
3144
|
-
#include <skinnormal_vertex>
|
|
3145
|
-
#include <defaultnormal_vertex>
|
|
3146
|
-
#include <normal_vertex>
|
|
3147
|
-
#include <begin_vertex>
|
|
3148
|
-
#include <morphtarget_vertex>
|
|
3149
|
-
#include <skinning_vertex>
|
|
3150
|
-
#include <displacementmap_vertex>
|
|
3151
|
-
#include <project_vertex>
|
|
3152
|
-
#include <logdepthbuf_vertex>
|
|
3153
|
-
#include <clipping_planes_vertex>
|
|
3154
|
-
vViewPosition = - mvPosition.xyz;
|
|
3155
|
-
#include <worldpos_vertex>
|
|
3156
|
-
#include <envmap_vertex>
|
|
3157
|
-
#include <shadowmap_vertex>
|
|
3158
|
-
#include <fog_vertex>
|
|
3159
|
-
}`,uc=`#define PHONG
|
|
3160
|
-
uniform vec3 diffuse;
|
|
3161
|
-
uniform vec3 emissive;
|
|
3162
|
-
uniform vec3 specular;
|
|
3163
|
-
uniform float shininess;
|
|
3164
|
-
uniform float opacity;
|
|
3165
|
-
#include <common>
|
|
3166
|
-
#include <dithering_pars_fragment>
|
|
3167
|
-
#include <color_pars_fragment>
|
|
3168
|
-
#include <uv_pars_fragment>
|
|
3169
|
-
#include <map_pars_fragment>
|
|
3170
|
-
#include <alphamap_pars_fragment>
|
|
3171
|
-
#include <alphatest_pars_fragment>
|
|
3172
|
-
#include <alphahash_pars_fragment>
|
|
3173
|
-
#include <aomap_pars_fragment>
|
|
3174
|
-
#include <lightmap_pars_fragment>
|
|
3175
|
-
#include <emissivemap_pars_fragment>
|
|
3176
|
-
#include <cube_uv_reflection_fragment>
|
|
3177
|
-
#include <envmap_common_pars_fragment>
|
|
3178
|
-
#include <envmap_pars_fragment>
|
|
3179
|
-
#include <envmap_physical_pars_fragment>
|
|
3180
|
-
#include <fog_pars_fragment>
|
|
3181
|
-
#include <bsdfs>
|
|
3182
|
-
#include <lights_pars_begin>
|
|
3183
|
-
#include <normal_pars_fragment>
|
|
3184
|
-
#include <lights_phong_pars_fragment>
|
|
3185
|
-
#include <shadowmap_pars_fragment>
|
|
3186
|
-
#include <bumpmap_pars_fragment>
|
|
3187
|
-
#include <normalmap_pars_fragment>
|
|
3188
|
-
#include <specularmap_pars_fragment>
|
|
3189
|
-
#include <logdepthbuf_pars_fragment>
|
|
3190
|
-
#include <clipping_planes_pars_fragment>
|
|
3191
|
-
void main() {
|
|
3192
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3193
|
-
#include <clipping_planes_fragment>
|
|
3194
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3195
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3196
|
-
#include <logdepthbuf_fragment>
|
|
3197
|
-
#include <map_fragment>
|
|
3198
|
-
#include <color_fragment>
|
|
3199
|
-
#include <alphamap_fragment>
|
|
3200
|
-
#include <alphatest_fragment>
|
|
3201
|
-
#include <alphahash_fragment>
|
|
3202
|
-
#include <specularmap_fragment>
|
|
3203
|
-
#include <normal_fragment_begin>
|
|
3204
|
-
#include <normal_fragment_maps>
|
|
3205
|
-
#include <emissivemap_fragment>
|
|
3206
|
-
#include <lights_phong_fragment>
|
|
3207
|
-
#include <lights_fragment_begin>
|
|
3208
|
-
#include <lights_fragment_maps>
|
|
3209
|
-
#include <lights_fragment_end>
|
|
3210
|
-
#include <aomap_fragment>
|
|
3211
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
3212
|
-
#include <envmap_fragment>
|
|
3213
|
-
#include <opaque_fragment>
|
|
3214
|
-
#include <tonemapping_fragment>
|
|
3215
|
-
#include <colorspace_fragment>
|
|
3216
|
-
#include <fog_fragment>
|
|
3217
|
-
#include <premultiplied_alpha_fragment>
|
|
3218
|
-
#include <dithering_fragment>
|
|
3219
|
-
}`,fc=`#define STANDARD
|
|
3220
|
-
varying vec3 vViewPosition;
|
|
3221
|
-
#ifdef USE_TRANSMISSION
|
|
3222
|
-
varying vec3 vWorldPosition;
|
|
3223
|
-
#endif
|
|
3224
|
-
#include <common>
|
|
3225
|
-
#include <batching_pars_vertex>
|
|
3226
|
-
#include <uv_pars_vertex>
|
|
3227
|
-
#include <displacementmap_pars_vertex>
|
|
3228
|
-
#include <color_pars_vertex>
|
|
3229
|
-
#include <fog_pars_vertex>
|
|
3230
|
-
#include <normal_pars_vertex>
|
|
3231
|
-
#include <morphtarget_pars_vertex>
|
|
3232
|
-
#include <skinning_pars_vertex>
|
|
3233
|
-
#include <shadowmap_pars_vertex>
|
|
3234
|
-
#include <logdepthbuf_pars_vertex>
|
|
3235
|
-
#include <clipping_planes_pars_vertex>
|
|
3236
|
-
void main() {
|
|
3237
|
-
#include <uv_vertex>
|
|
3238
|
-
#include <color_vertex>
|
|
3239
|
-
#include <morphinstance_vertex>
|
|
3240
|
-
#include <morphcolor_vertex>
|
|
3241
|
-
#include <batching_vertex>
|
|
3242
|
-
#include <beginnormal_vertex>
|
|
3243
|
-
#include <morphnormal_vertex>
|
|
3244
|
-
#include <skinbase_vertex>
|
|
3245
|
-
#include <skinnormal_vertex>
|
|
3246
|
-
#include <defaultnormal_vertex>
|
|
3247
|
-
#include <normal_vertex>
|
|
3248
|
-
#include <begin_vertex>
|
|
3249
|
-
#include <morphtarget_vertex>
|
|
3250
|
-
#include <skinning_vertex>
|
|
3251
|
-
#include <displacementmap_vertex>
|
|
3252
|
-
#include <project_vertex>
|
|
3253
|
-
#include <logdepthbuf_vertex>
|
|
3254
|
-
#include <clipping_planes_vertex>
|
|
3255
|
-
vViewPosition = - mvPosition.xyz;
|
|
3256
|
-
#include <worldpos_vertex>
|
|
3257
|
-
#include <shadowmap_vertex>
|
|
3258
|
-
#include <fog_vertex>
|
|
3259
|
-
#ifdef USE_TRANSMISSION
|
|
3260
|
-
vWorldPosition = worldPosition.xyz;
|
|
3261
|
-
#endif
|
|
3262
|
-
}`,hc=`#define STANDARD
|
|
3263
|
-
#ifdef PHYSICAL
|
|
3264
|
-
#define IOR
|
|
3265
|
-
#define USE_SPECULAR
|
|
3266
|
-
#endif
|
|
3267
|
-
uniform vec3 diffuse;
|
|
3268
|
-
uniform vec3 emissive;
|
|
3269
|
-
uniform float roughness;
|
|
3270
|
-
uniform float metalness;
|
|
3271
|
-
uniform float opacity;
|
|
3272
|
-
#ifdef IOR
|
|
3273
|
-
uniform float ior;
|
|
3274
|
-
#endif
|
|
3275
|
-
#ifdef USE_SPECULAR
|
|
3276
|
-
uniform float specularIntensity;
|
|
3277
|
-
uniform vec3 specularColor;
|
|
3278
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
3279
|
-
uniform sampler2D specularColorMap;
|
|
3280
|
-
#endif
|
|
3281
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
3282
|
-
uniform sampler2D specularIntensityMap;
|
|
3283
|
-
#endif
|
|
3284
|
-
#endif
|
|
3285
|
-
#ifdef USE_CLEARCOAT
|
|
3286
|
-
uniform float clearcoat;
|
|
3287
|
-
uniform float clearcoatRoughness;
|
|
3288
|
-
#endif
|
|
3289
|
-
#ifdef USE_DISPERSION
|
|
3290
|
-
uniform float dispersion;
|
|
3291
|
-
#endif
|
|
3292
|
-
#ifdef USE_IRIDESCENCE
|
|
3293
|
-
uniform float iridescence;
|
|
3294
|
-
uniform float iridescenceIOR;
|
|
3295
|
-
uniform float iridescenceThicknessMinimum;
|
|
3296
|
-
uniform float iridescenceThicknessMaximum;
|
|
3297
|
-
#endif
|
|
3298
|
-
#ifdef USE_SHEEN
|
|
3299
|
-
uniform vec3 sheenColor;
|
|
3300
|
-
uniform float sheenRoughness;
|
|
3301
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
3302
|
-
uniform sampler2D sheenColorMap;
|
|
3303
|
-
#endif
|
|
3304
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
3305
|
-
uniform sampler2D sheenRoughnessMap;
|
|
3306
|
-
#endif
|
|
3307
|
-
#endif
|
|
3308
|
-
#ifdef USE_ANISOTROPY
|
|
3309
|
-
uniform vec2 anisotropyVector;
|
|
3310
|
-
#ifdef USE_ANISOTROPYMAP
|
|
3311
|
-
uniform sampler2D anisotropyMap;
|
|
3312
|
-
#endif
|
|
3313
|
-
#endif
|
|
3314
|
-
varying vec3 vViewPosition;
|
|
3315
|
-
#include <common>
|
|
3316
|
-
#include <dithering_pars_fragment>
|
|
3317
|
-
#include <color_pars_fragment>
|
|
3318
|
-
#include <uv_pars_fragment>
|
|
3319
|
-
#include <map_pars_fragment>
|
|
3320
|
-
#include <alphamap_pars_fragment>
|
|
3321
|
-
#include <alphatest_pars_fragment>
|
|
3322
|
-
#include <alphahash_pars_fragment>
|
|
3323
|
-
#include <aomap_pars_fragment>
|
|
3324
|
-
#include <lightmap_pars_fragment>
|
|
3325
|
-
#include <emissivemap_pars_fragment>
|
|
3326
|
-
#include <iridescence_fragment>
|
|
3327
|
-
#include <cube_uv_reflection_fragment>
|
|
3328
|
-
#include <envmap_common_pars_fragment>
|
|
3329
|
-
#include <envmap_physical_pars_fragment>
|
|
3330
|
-
#include <fog_pars_fragment>
|
|
3331
|
-
#include <lights_pars_begin>
|
|
3332
|
-
#include <normal_pars_fragment>
|
|
3333
|
-
#include <lights_physical_pars_fragment>
|
|
3334
|
-
#include <transmission_pars_fragment>
|
|
3335
|
-
#include <shadowmap_pars_fragment>
|
|
3336
|
-
#include <bumpmap_pars_fragment>
|
|
3337
|
-
#include <normalmap_pars_fragment>
|
|
3338
|
-
#include <clearcoat_pars_fragment>
|
|
3339
|
-
#include <iridescence_pars_fragment>
|
|
3340
|
-
#include <roughnessmap_pars_fragment>
|
|
3341
|
-
#include <metalnessmap_pars_fragment>
|
|
3342
|
-
#include <logdepthbuf_pars_fragment>
|
|
3343
|
-
#include <clipping_planes_pars_fragment>
|
|
3344
|
-
void main() {
|
|
3345
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3346
|
-
#include <clipping_planes_fragment>
|
|
3347
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3348
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3349
|
-
#include <logdepthbuf_fragment>
|
|
3350
|
-
#include <map_fragment>
|
|
3351
|
-
#include <color_fragment>
|
|
3352
|
-
#include <alphamap_fragment>
|
|
3353
|
-
#include <alphatest_fragment>
|
|
3354
|
-
#include <alphahash_fragment>
|
|
3355
|
-
#include <roughnessmap_fragment>
|
|
3356
|
-
#include <metalnessmap_fragment>
|
|
3357
|
-
#include <normal_fragment_begin>
|
|
3358
|
-
#include <normal_fragment_maps>
|
|
3359
|
-
#include <clearcoat_normal_fragment_begin>
|
|
3360
|
-
#include <clearcoat_normal_fragment_maps>
|
|
3361
|
-
#include <emissivemap_fragment>
|
|
3362
|
-
#include <lights_physical_fragment>
|
|
3363
|
-
#include <lights_fragment_begin>
|
|
3364
|
-
#include <lights_fragment_maps>
|
|
3365
|
-
#include <lights_fragment_end>
|
|
3366
|
-
#include <aomap_fragment>
|
|
3367
|
-
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
3368
|
-
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
3369
|
-
#include <transmission_fragment>
|
|
3370
|
-
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
3371
|
-
#ifdef USE_SHEEN
|
|
3372
|
-
|
|
3373
|
-
outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
|
|
3374
|
-
|
|
3375
|
-
#endif
|
|
3376
|
-
#ifdef USE_CLEARCOAT
|
|
3377
|
-
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
|
3378
|
-
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
3379
|
-
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
|
3380
|
-
#endif
|
|
3381
|
-
#include <opaque_fragment>
|
|
3382
|
-
#include <tonemapping_fragment>
|
|
3383
|
-
#include <colorspace_fragment>
|
|
3384
|
-
#include <fog_fragment>
|
|
3385
|
-
#include <premultiplied_alpha_fragment>
|
|
3386
|
-
#include <dithering_fragment>
|
|
3387
|
-
}`,dc=`#define TOON
|
|
3388
|
-
varying vec3 vViewPosition;
|
|
3389
|
-
#include <common>
|
|
3390
|
-
#include <batching_pars_vertex>
|
|
3391
|
-
#include <uv_pars_vertex>
|
|
3392
|
-
#include <displacementmap_pars_vertex>
|
|
3393
|
-
#include <color_pars_vertex>
|
|
3394
|
-
#include <fog_pars_vertex>
|
|
3395
|
-
#include <normal_pars_vertex>
|
|
3396
|
-
#include <morphtarget_pars_vertex>
|
|
3397
|
-
#include <skinning_pars_vertex>
|
|
3398
|
-
#include <shadowmap_pars_vertex>
|
|
3399
|
-
#include <logdepthbuf_pars_vertex>
|
|
3400
|
-
#include <clipping_planes_pars_vertex>
|
|
3401
|
-
void main() {
|
|
3402
|
-
#include <uv_vertex>
|
|
3403
|
-
#include <color_vertex>
|
|
3404
|
-
#include <morphinstance_vertex>
|
|
3405
|
-
#include <morphcolor_vertex>
|
|
3406
|
-
#include <batching_vertex>
|
|
3407
|
-
#include <beginnormal_vertex>
|
|
3408
|
-
#include <morphnormal_vertex>
|
|
3409
|
-
#include <skinbase_vertex>
|
|
3410
|
-
#include <skinnormal_vertex>
|
|
3411
|
-
#include <defaultnormal_vertex>
|
|
3412
|
-
#include <normal_vertex>
|
|
3413
|
-
#include <begin_vertex>
|
|
3414
|
-
#include <morphtarget_vertex>
|
|
3415
|
-
#include <skinning_vertex>
|
|
3416
|
-
#include <displacementmap_vertex>
|
|
3417
|
-
#include <project_vertex>
|
|
3418
|
-
#include <logdepthbuf_vertex>
|
|
3419
|
-
#include <clipping_planes_vertex>
|
|
3420
|
-
vViewPosition = - mvPosition.xyz;
|
|
3421
|
-
#include <worldpos_vertex>
|
|
3422
|
-
#include <shadowmap_vertex>
|
|
3423
|
-
#include <fog_vertex>
|
|
3424
|
-
}`,pc=`#define TOON
|
|
3425
|
-
uniform vec3 diffuse;
|
|
3426
|
-
uniform vec3 emissive;
|
|
3427
|
-
uniform float opacity;
|
|
3428
|
-
#include <common>
|
|
3429
|
-
#include <dithering_pars_fragment>
|
|
3430
|
-
#include <color_pars_fragment>
|
|
3431
|
-
#include <uv_pars_fragment>
|
|
3432
|
-
#include <map_pars_fragment>
|
|
3433
|
-
#include <alphamap_pars_fragment>
|
|
3434
|
-
#include <alphatest_pars_fragment>
|
|
3435
|
-
#include <alphahash_pars_fragment>
|
|
3436
|
-
#include <aomap_pars_fragment>
|
|
3437
|
-
#include <lightmap_pars_fragment>
|
|
3438
|
-
#include <emissivemap_pars_fragment>
|
|
3439
|
-
#include <gradientmap_pars_fragment>
|
|
3440
|
-
#include <fog_pars_fragment>
|
|
3441
|
-
#include <bsdfs>
|
|
3442
|
-
#include <lights_pars_begin>
|
|
3443
|
-
#include <normal_pars_fragment>
|
|
3444
|
-
#include <lights_toon_pars_fragment>
|
|
3445
|
-
#include <shadowmap_pars_fragment>
|
|
3446
|
-
#include <bumpmap_pars_fragment>
|
|
3447
|
-
#include <normalmap_pars_fragment>
|
|
3448
|
-
#include <logdepthbuf_pars_fragment>
|
|
3449
|
-
#include <clipping_planes_pars_fragment>
|
|
3450
|
-
void main() {
|
|
3451
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3452
|
-
#include <clipping_planes_fragment>
|
|
3453
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3454
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3455
|
-
#include <logdepthbuf_fragment>
|
|
3456
|
-
#include <map_fragment>
|
|
3457
|
-
#include <color_fragment>
|
|
3458
|
-
#include <alphamap_fragment>
|
|
3459
|
-
#include <alphatest_fragment>
|
|
3460
|
-
#include <alphahash_fragment>
|
|
3461
|
-
#include <normal_fragment_begin>
|
|
3462
|
-
#include <normal_fragment_maps>
|
|
3463
|
-
#include <emissivemap_fragment>
|
|
3464
|
-
#include <lights_toon_fragment>
|
|
3465
|
-
#include <lights_fragment_begin>
|
|
3466
|
-
#include <lights_fragment_maps>
|
|
3467
|
-
#include <lights_fragment_end>
|
|
3468
|
-
#include <aomap_fragment>
|
|
3469
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
3470
|
-
#include <opaque_fragment>
|
|
3471
|
-
#include <tonemapping_fragment>
|
|
3472
|
-
#include <colorspace_fragment>
|
|
3473
|
-
#include <fog_fragment>
|
|
3474
|
-
#include <premultiplied_alpha_fragment>
|
|
3475
|
-
#include <dithering_fragment>
|
|
3476
|
-
}`,mc=`uniform float size;
|
|
3477
|
-
uniform float scale;
|
|
3478
|
-
#include <common>
|
|
3479
|
-
#include <color_pars_vertex>
|
|
3480
|
-
#include <fog_pars_vertex>
|
|
3481
|
-
#include <morphtarget_pars_vertex>
|
|
3482
|
-
#include <logdepthbuf_pars_vertex>
|
|
3483
|
-
#include <clipping_planes_pars_vertex>
|
|
3484
|
-
#ifdef USE_POINTS_UV
|
|
3485
|
-
varying vec2 vUv;
|
|
3486
|
-
uniform mat3 uvTransform;
|
|
3487
|
-
#endif
|
|
3488
|
-
void main() {
|
|
3489
|
-
#ifdef USE_POINTS_UV
|
|
3490
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
3491
|
-
#endif
|
|
3492
|
-
#include <color_vertex>
|
|
3493
|
-
#include <morphinstance_vertex>
|
|
3494
|
-
#include <morphcolor_vertex>
|
|
3495
|
-
#include <begin_vertex>
|
|
3496
|
-
#include <morphtarget_vertex>
|
|
3497
|
-
#include <project_vertex>
|
|
3498
|
-
gl_PointSize = size;
|
|
3499
|
-
#ifdef USE_SIZEATTENUATION
|
|
3500
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3501
|
-
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
3502
|
-
#endif
|
|
3503
|
-
#include <logdepthbuf_vertex>
|
|
3504
|
-
#include <clipping_planes_vertex>
|
|
3505
|
-
#include <worldpos_vertex>
|
|
3506
|
-
#include <fog_vertex>
|
|
3507
|
-
}`,_c=`uniform vec3 diffuse;
|
|
3508
|
-
uniform float opacity;
|
|
3509
|
-
#include <common>
|
|
3510
|
-
#include <color_pars_fragment>
|
|
3511
|
-
#include <map_particle_pars_fragment>
|
|
3512
|
-
#include <alphatest_pars_fragment>
|
|
3513
|
-
#include <alphahash_pars_fragment>
|
|
3514
|
-
#include <fog_pars_fragment>
|
|
3515
|
-
#include <logdepthbuf_pars_fragment>
|
|
3516
|
-
#include <clipping_planes_pars_fragment>
|
|
3517
|
-
void main() {
|
|
3518
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3519
|
-
#include <clipping_planes_fragment>
|
|
3520
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
3521
|
-
#include <logdepthbuf_fragment>
|
|
3522
|
-
#include <map_particle_fragment>
|
|
3523
|
-
#include <color_fragment>
|
|
3524
|
-
#include <alphatest_fragment>
|
|
3525
|
-
#include <alphahash_fragment>
|
|
3526
|
-
outgoingLight = diffuseColor.rgb;
|
|
3527
|
-
#include <opaque_fragment>
|
|
3528
|
-
#include <tonemapping_fragment>
|
|
3529
|
-
#include <colorspace_fragment>
|
|
3530
|
-
#include <fog_fragment>
|
|
3531
|
-
#include <premultiplied_alpha_fragment>
|
|
3532
|
-
}`,gc=`#include <common>
|
|
3533
|
-
#include <batching_pars_vertex>
|
|
3534
|
-
#include <fog_pars_vertex>
|
|
3535
|
-
#include <morphtarget_pars_vertex>
|
|
3536
|
-
#include <skinning_pars_vertex>
|
|
3537
|
-
#include <logdepthbuf_pars_vertex>
|
|
3538
|
-
#include <shadowmap_pars_vertex>
|
|
3539
|
-
void main() {
|
|
3540
|
-
#include <batching_vertex>
|
|
3541
|
-
#include <beginnormal_vertex>
|
|
3542
|
-
#include <morphinstance_vertex>
|
|
3543
|
-
#include <morphnormal_vertex>
|
|
3544
|
-
#include <skinbase_vertex>
|
|
3545
|
-
#include <skinnormal_vertex>
|
|
3546
|
-
#include <defaultnormal_vertex>
|
|
3547
|
-
#include <begin_vertex>
|
|
3548
|
-
#include <morphtarget_vertex>
|
|
3549
|
-
#include <skinning_vertex>
|
|
3550
|
-
#include <project_vertex>
|
|
3551
|
-
#include <logdepthbuf_vertex>
|
|
3552
|
-
#include <worldpos_vertex>
|
|
3553
|
-
#include <shadowmap_vertex>
|
|
3554
|
-
#include <fog_vertex>
|
|
3555
|
-
}`,xc=`uniform vec3 color;
|
|
3556
|
-
uniform float opacity;
|
|
3557
|
-
#include <common>
|
|
3558
|
-
#include <fog_pars_fragment>
|
|
3559
|
-
#include <bsdfs>
|
|
3560
|
-
#include <lights_pars_begin>
|
|
3561
|
-
#include <logdepthbuf_pars_fragment>
|
|
3562
|
-
#include <shadowmap_pars_fragment>
|
|
3563
|
-
#include <shadowmask_pars_fragment>
|
|
3564
|
-
void main() {
|
|
3565
|
-
#include <logdepthbuf_fragment>
|
|
3566
|
-
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
3567
|
-
#include <tonemapping_fragment>
|
|
3568
|
-
#include <colorspace_fragment>
|
|
3569
|
-
#include <fog_fragment>
|
|
3570
|
-
#include <premultiplied_alpha_fragment>
|
|
3571
|
-
}`,vc=`uniform float rotation;
|
|
3572
|
-
uniform vec2 center;
|
|
3573
|
-
#include <common>
|
|
3574
|
-
#include <uv_pars_vertex>
|
|
3575
|
-
#include <fog_pars_vertex>
|
|
3576
|
-
#include <logdepthbuf_pars_vertex>
|
|
3577
|
-
#include <clipping_planes_pars_vertex>
|
|
3578
|
-
void main() {
|
|
3579
|
-
#include <uv_vertex>
|
|
3580
|
-
vec4 mvPosition = modelViewMatrix[ 3 ];
|
|
3581
|
-
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
|
|
3582
|
-
#ifndef USE_SIZEATTENUATION
|
|
3583
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3584
|
-
if ( isPerspective ) scale *= - mvPosition.z;
|
|
3585
|
-
#endif
|
|
3586
|
-
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
3587
|
-
vec2 rotatedPosition;
|
|
3588
|
-
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
3589
|
-
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
3590
|
-
mvPosition.xy += rotatedPosition;
|
|
3591
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
3592
|
-
#include <logdepthbuf_vertex>
|
|
3593
|
-
#include <clipping_planes_vertex>
|
|
3594
|
-
#include <fog_vertex>
|
|
3595
|
-
}`,Sc=`uniform vec3 diffuse;
|
|
3596
|
-
uniform float opacity;
|
|
3597
|
-
#include <common>
|
|
3598
|
-
#include <uv_pars_fragment>
|
|
3599
|
-
#include <map_pars_fragment>
|
|
3600
|
-
#include <alphamap_pars_fragment>
|
|
3601
|
-
#include <alphatest_pars_fragment>
|
|
3602
|
-
#include <alphahash_pars_fragment>
|
|
3603
|
-
#include <fog_pars_fragment>
|
|
3604
|
-
#include <logdepthbuf_pars_fragment>
|
|
3605
|
-
#include <clipping_planes_pars_fragment>
|
|
3606
|
-
void main() {
|
|
3607
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3608
|
-
#include <clipping_planes_fragment>
|
|
3609
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
3610
|
-
#include <logdepthbuf_fragment>
|
|
3611
|
-
#include <map_fragment>
|
|
3612
|
-
#include <alphamap_fragment>
|
|
3613
|
-
#include <alphatest_fragment>
|
|
3614
|
-
#include <alphahash_fragment>
|
|
3615
|
-
outgoingLight = diffuseColor.rgb;
|
|
3616
|
-
#include <opaque_fragment>
|
|
3617
|
-
#include <tonemapping_fragment>
|
|
3618
|
-
#include <colorspace_fragment>
|
|
3619
|
-
#include <fog_fragment>
|
|
3620
|
-
}`,Ue={alphahash_fragment:Va,alphahash_pars_fragment:Ha,alphamap_fragment:ka,alphamap_pars_fragment:Wa,alphatest_fragment:Xa,alphatest_pars_fragment:qa,aomap_fragment:Ya,aomap_pars_fragment:Ka,batching_pars_vertex:Za,batching_vertex:$a,begin_vertex:ja,beginnormal_vertex:Ja,bsdfs:Qa,iridescence_fragment:eo,bumpmap_pars_fragment:to,clipping_planes_fragment:no,clipping_planes_pars_fragment:io,clipping_planes_pars_vertex:ro,clipping_planes_vertex:so,color_fragment:ao,color_pars_fragment:oo,color_pars_vertex:lo,color_vertex:co,common:uo,cube_uv_reflection_fragment:fo,defaultnormal_vertex:ho,displacementmap_pars_vertex:po,displacementmap_vertex:mo,emissivemap_fragment:_o,emissivemap_pars_fragment:go,colorspace_fragment:xo,colorspace_pars_fragment:vo,envmap_fragment:So,envmap_common_pars_fragment:Mo,envmap_pars_fragment:Eo,envmap_pars_vertex:To,envmap_physical_pars_fragment:Uo,envmap_vertex:yo,fog_vertex:Ao,fog_pars_vertex:bo,fog_fragment:Ro,fog_pars_fragment:Co,gradientmap_pars_fragment:wo,lightmap_pars_fragment:Po,lights_lambert_fragment:Do,lights_lambert_pars_fragment:Lo,lights_pars_begin:Fo,lights_toon_fragment:Io,lights_toon_pars_fragment:No,lights_phong_fragment:Oo,lights_phong_pars_fragment:Bo,lights_physical_fragment:Go,lights_physical_pars_fragment:zo,lights_fragment_begin:Vo,lights_fragment_maps:Ho,lights_fragment_end:ko,logdepthbuf_fragment:Wo,logdepthbuf_pars_fragment:Xo,logdepthbuf_pars_vertex:qo,logdepthbuf_vertex:Yo,map_fragment:Ko,map_pars_fragment:Zo,map_particle_fragment:$o,map_particle_pars_fragment:jo,metalnessmap_fragment:Jo,metalnessmap_pars_fragment:Qo,morphinstance_vertex:el,morphcolor_vertex:tl,morphnormal_vertex:nl,morphtarget_pars_vertex:il,morphtarget_vertex:rl,normal_fragment_begin:sl,normal_fragment_maps:al,normal_pars_fragment:ol,normal_pars_vertex:ll,normal_vertex:cl,normalmap_pars_fragment:ul,clearcoat_normal_fragment_begin:fl,clearcoat_normal_fragment_maps:hl,clearcoat_pars_fragment:dl,iridescence_pars_fragment:pl,opaque_fragment:ml,packing:_l,premultiplied_alpha_fragment:gl,project_vertex:xl,dithering_fragment:vl,dithering_pars_fragment:Sl,roughnessmap_fragment:Ml,roughnessmap_pars_fragment:El,shadowmap_pars_fragment:Tl,shadowmap_pars_vertex:yl,shadowmap_vertex:Al,shadowmask_pars_fragment:bl,skinbase_vertex:Rl,skinning_pars_vertex:Cl,skinning_vertex:wl,skinnormal_vertex:Pl,specularmap_fragment:Dl,specularmap_pars_fragment:Ll,tonemapping_fragment:Fl,tonemapping_pars_fragment:Ul,transmission_fragment:Il,transmission_pars_fragment:Nl,uv_pars_fragment:Ol,uv_pars_vertex:Bl,uv_vertex:Gl,worldpos_vertex:zl,background_vert:Vl,background_frag:Hl,backgroundCube_vert:kl,backgroundCube_frag:Wl,cube_vert:Xl,cube_frag:ql,depth_vert:Yl,depth_frag:Kl,distance_vert:Zl,distance_frag:$l,equirect_vert:jl,equirect_frag:Jl,linedashed_vert:Ql,linedashed_frag:ec,meshbasic_vert:tc,meshbasic_frag:nc,meshlambert_vert:ic,meshlambert_frag:rc,meshmatcap_vert:sc,meshmatcap_frag:ac,meshnormal_vert:oc,meshnormal_frag:lc,meshphong_vert:cc,meshphong_frag:uc,meshphysical_vert:fc,meshphysical_frag:hc,meshtoon_vert:dc,meshtoon_frag:pc,points_vert:mc,points_frag:_c,shadow_vert:gc,shadow_frag:xc,sprite_vert:vc,sprite_frag:Sc},ae={common:{diffuse:{value:new We(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Le}},envmap:{envMap:{value:null},envMapRotation:{value:new Le},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Le}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Le}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Le},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Le},normalScale:{value:new $e(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Le},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Le}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Le}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Le}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new We(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 We(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0},uvTransform:{value:new Le}},sprite:{diffuse:{value:new We(16777215)},opacity:{value:1},center:{value:new $e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}}},Gt={basic:{uniforms:vt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:vt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new We(0)},envMapIntensity:{value:1}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:vt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new We(0)},specular:{value:new We(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:vt([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new We(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:vt([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new We(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:vt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:vt([ae.points,ae.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:vt([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:vt([ae.common,ae.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:vt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:vt([ae.sprite,ae.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new Le},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Le}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distance:{uniforms:vt([ae.common,ae.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distance_vert,fragmentShader:Ue.distance_frag},shadow:{uniforms:vt([ae.lights,ae.fog,{color:{value:new We(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};Gt.physical={uniforms:vt([Gt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Le},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Le},clearcoatNormalScale:{value:new $e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Le},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Le},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Le},sheen:{value:0},sheenColor:{value:new We(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Le},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Le},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Le},transmissionSamplerSize:{value:new $e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Le},attenuationDistance:{value:0},attenuationColor:{value:new We(0)},specularColor:{value:new We(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Le},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Le},anisotropyVector:{value:new $e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Le}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const Ri={r:0,b:0,g:0},mn=new jt,Mc=new rt;function Ec(i,e,t,n,r,s){const a=new We(0);let o=r===!0?0:1,c,l,h=null,m=0,u=null;function _(M){let A=M.isScene===!0?M.background:null;if(A&&A.isTexture){const y=M.backgroundBlurriness>0;A=e.get(A,y)}return A}function g(M){let A=!1;const y=_(M);y===null?d(a,o):y&&y.isColor&&(d(y,1),A=!0);const P=i.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,s):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||A)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(M,A){const y=_(A);y&&(y.isCubeTexture||y.mapping===306)?(l===void 0&&(l=new Jt(new ei(1,1,1),new Ht({name:"BackgroundCubeMaterial",uniforms:Nn(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(P,b,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),mn.copy(A.backgroundRotation),mn.x*=-1,mn.y*=-1,mn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(mn.y*=-1,mn.z*=-1),l.material.uniforms.envMap.value=y,l.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,l.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Mc.makeRotationFromEuler(mn)),l.material.toneMapped=ze.getTransfer(y.colorSpace)!==Ye,(h!==y||m!==y.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,h=y,m=y.version,u=i.toneMapping),l.layers.enableAll(),M.unshift(l,l.geometry,l.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Jt(new Ii(2,2),new Ht({name:"BackgroundMaterial",uniforms:Nn(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=ze.getTransfer(y.colorSpace)!==Ye,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||m!==y.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=y,m=y.version,u=i.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function d(M,A){M.getRGB(Ri,Os(i)),t.buffers.color.setClear(Ri.r,Ri.g,Ri.b,A,s)}function f(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(M,A=1){a.set(M),o=A,d(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(M){o=M,d(a,o)},render:g,addToRenderList:S,dispose:f}}function Tc(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(C,V,G,k,H){let B=!1;const O=m(C,k,G,V);s!==O&&(s=O,l(s.object)),B=_(C,k,G,H),B&&g(C,k,G,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),(B||a)&&(a=!1,y(C,V,G,k),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function c(){return i.createVertexArray()}function l(C){return i.bindVertexArray(C)}function h(C){return i.deleteVertexArray(C)}function m(C,V,G,k){const H=k.wireframe===!0;let B=n[V.id];B===void 0&&(B={},n[V.id]=B);const O=C.isInstancedMesh===!0?C.id:0;let Q=B[O];Q===void 0&&(Q={},B[O]=Q);let $=Q[G.id];$===void 0&&($={},Q[G.id]=$);let ce=$[H];return ce===void 0&&(ce=u(c()),$[H]=ce),ce}function u(C){const V=[],G=[],k=[];for(let H=0;H<t;H++)V[H]=0,G[H]=0,k[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:G,attributeDivisors:k,object:C,attributes:{},index:null}}function _(C,V,G,k){const H=s.attributes,B=V.attributes;let O=0;const Q=G.getAttributes();for(const $ in Q)if(Q[$].location>=0){const pe=H[$];let fe=B[$];if(fe===void 0&&($==="instanceMatrix"&&C.instanceMatrix&&(fe=C.instanceMatrix),$==="instanceColor"&&C.instanceColor&&(fe=C.instanceColor)),pe===void 0||pe.attribute!==fe||fe&&pe.data!==fe.data)return!0;O++}return s.attributesNum!==O||s.index!==k}function g(C,V,G,k){const H={},B=V.attributes;let O=0;const Q=G.getAttributes();for(const $ in Q)if(Q[$].location>=0){let pe=B[$];pe===void 0&&($==="instanceMatrix"&&C.instanceMatrix&&(pe=C.instanceMatrix),$==="instanceColor"&&C.instanceColor&&(pe=C.instanceColor));const fe={};fe.attribute=pe,pe&&pe.data&&(fe.data=pe.data),H[$]=fe,O++}s.attributes=H,s.attributesNum=O,s.index=k}function S(){const C=s.newAttributes;for(let V=0,G=C.length;V<G;V++)C[V]=0}function d(C){f(C,0)}function f(C,V){const G=s.newAttributes,k=s.enabledAttributes,H=s.attributeDivisors;G[C]=1,k[C]===0&&(i.enableVertexAttribArray(C),k[C]=1),H[C]!==V&&(i.vertexAttribDivisor(C,V),H[C]=V)}function M(){const C=s.newAttributes,V=s.enabledAttributes;for(let G=0,k=V.length;G<k;G++)V[G]!==C[G]&&(i.disableVertexAttribArray(G),V[G]=0)}function A(C,V,G,k,H,B,O){O===!0?i.vertexAttribIPointer(C,V,G,H,B):i.vertexAttribPointer(C,V,G,k,H,B)}function y(C,V,G,k){S();const H=k.attributes,B=G.getAttributes(),O=V.defaultAttributeValues;for(const Q in B){const $=B[Q];if($.location>=0){let ce=H[Q];if(ce===void 0&&(Q==="instanceMatrix"&&C.instanceMatrix&&(ce=C.instanceMatrix),Q==="instanceColor"&&C.instanceColor&&(ce=C.instanceColor)),ce!==void 0){const pe=ce.normalized,fe=ce.itemSize,Fe=e.get(ce);if(Fe===void 0)continue;const nt=Fe.buffer,tt=Fe.type,K=Fe.bytesPerElement,ne=tt===i.INT||tt===i.UNSIGNED_INT||ce.gpuType===1013;if(ce.isInterleavedBufferAttribute){const se=ce.data,De=se.stride,Ae=ce.offset;if(se.isInstancedInterleavedBuffer){for(let Ce=0;Ce<$.locationSize;Ce++)f($.location+Ce,se.meshPerAttribute);C.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Ce=0;Ce<$.locationSize;Ce++)d($.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,nt);for(let Ce=0;Ce<$.locationSize;Ce++)A($.location+Ce,fe/$.locationSize,tt,pe,De*K,(Ae+fe/$.locationSize*Ce)*K,ne)}else{if(ce.isInstancedBufferAttribute){for(let se=0;se<$.locationSize;se++)f($.location+se,ce.meshPerAttribute);C.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=ce.meshPerAttribute*ce.count)}else for(let se=0;se<$.locationSize;se++)d($.location+se);i.bindBuffer(i.ARRAY_BUFFER,nt);for(let se=0;se<$.locationSize;se++)A($.location+se,fe/$.locationSize,tt,pe,fe*K,fe/$.locationSize*se*K,ne)}}else if(O!==void 0){const pe=O[Q];if(pe!==void 0)switch(pe.length){case 2:i.vertexAttrib2fv($.location,pe);break;case 3:i.vertexAttrib3fv($.location,pe);break;case 4:i.vertexAttrib4fv($.location,pe);break;default:i.vertexAttrib1fv($.location,pe)}}}}M()}function P(){T();for(const C in n){const V=n[C];for(const G in V){const k=V[G];for(const H in k){const B=k[H];for(const O in B)h(B[O].object),delete B[O];delete k[H]}}delete n[C]}}function b(C){if(n[C.id]===void 0)return;const V=n[C.id];for(const G in V){const k=V[G];for(const H in k){const B=k[H];for(const O in B)h(B[O].object),delete B[O];delete k[H]}}delete n[C.id]}function L(C){for(const V in n){const G=n[V];for(const k in G){const H=G[k];if(H[C.id]===void 0)continue;const B=H[C.id];for(const O in B)h(B[O].object),delete B[O];delete H[C.id]}}}function x(C){for(const V in n){const G=n[V],k=C.isInstancedMesh===!0?C.id:0,H=G[k];if(H!==void 0){for(const B in H){const O=H[B];for(const Q in O)h(O[Q].object),delete O[Q];delete H[B]}delete G[k],Object.keys(G).length===0&&delete n[V]}}}function T(){Y(),a=!0,s!==r&&(s=r,l(s.object))}function Y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:T,resetDefaultState:Y,dispose:P,releaseStatesOfGeometry:b,releaseStatesOfObject:x,releaseStatesOfProgram:L,initAttributes:S,enableAttribute:d,disableUnusedAttributes:M}}function yc(i,e,t){let n;function r(l){n=l}function s(l,h){i.drawArrays(n,l,h),t.update(h,n,1)}function a(l,h,m){m!==0&&(i.drawArraysInstanced(n,l,h,m),t.update(h,n,m))}function o(l,h,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,m);let _=0;for(let g=0;g<m;g++)_+=h[g];t.update(_,n,1)}function c(l,h,m,u){if(m===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let g=0;g<l.length;g++)a(l[g],h[g],u[g]);else{_.multiDrawArraysInstancedWEBGL(n,l,0,h,0,u,0,m);let g=0;for(let S=0;S<m;S++)g+=h[S]*u[S];t.update(g,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function Ac(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(L){return!(L!==1023&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(L){const x=L===1016&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==1009&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==1015&&!x)}function c(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(Re("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const m=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),_=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=i.getParameter(i.MAX_TEXTURE_SIZE),d=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),P=i.getParameter(i.MAX_SAMPLES),b=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:m,reversedDepthBuffer:u,maxTextures:_,maxVertexTextures:g,maxTextureSize:S,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:M,maxVaryings:A,maxFragmentUniforms:y,maxSamples:P,samples:b}}function bc(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new gn,o=new Le,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,u){const _=m.length!==0||u||n!==0||r;return r=u,n=m.length,_},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,u){t=h(m,u,0)},this.setState=function(m,u,_){const g=m.clippingPlanes,S=m.clipIntersection,d=m.clipShadows,f=i.get(m);if(!r||g===null||g.length===0||s&&!d)s?h(null):l();else{const M=s?0:n,A=M*4;let y=f.clippingState||null;c.value=y,y=h(g,u,A,_);for(let P=0;P!==A;++P)y[P]=t[P];f.clippingState=y,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=M}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(m,u,_,g){const S=m!==null?m.length:0;let d=null;if(S!==0){if(d=c.value,g!==!0||d===null){const f=_+S*4,M=u.matrixWorldInverse;o.getNormalMatrix(M),(d===null||d.length<f)&&(d=new Float32Array(f));for(let A=0,y=_;A!==S;++A,y+=4)a.copy(m[A]).applyMatrix4(M,o),a.normal.toArray(d,y),d[y+3]=a.constant}c.value=d,c.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,d}}const ln=4,rs=[.125,.215,.35,.446,.526,.582],xn=20,Rc=256,Yn=new Gs,ss=new We;let fr=null,hr=0,dr=0,pr=!1;const Cc=new I;class as{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=Cc}=s;fr=this._renderer.getRenderTarget(),hr=this._renderer.getActiveCubeFace(),dr=this._renderer.getActiveMipmapLevel(),pr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=cs(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ls(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(fr,hr,dr),this._renderer.xr.enabled=pr,e.scissorTest=!1,Fn(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),fr=this._renderer.getRenderTarget(),hr=this._renderer.getActiveCubeFace(),dr=this._renderer.getActiveMipmapLevel(),pr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:In,depthBuffer:!1},r=os(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=os(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=wc(s)),this._blurMaterial=Dc(s,e,t),this._ggxMaterial=Pc(s,e,t)}return r}_compileMaterial(e){const t=new Jt(new It,e);this._renderer.compile(t,Yn)}_sceneToCubeUV(e,t,n,r,s){const c=new Lt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],m=this._renderer,u=m.autoClear,_=m.toneMapping;m.getClearColor(ss),m.toneMapping=0,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(r),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Jt(new ei,new Fs({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const S=this._backgroundBox,d=S.material;let f=!1;const M=e.background;M?M.isColor&&(d.color.copy(M),e.background=null,f=!0):(d.color.copy(ss),f=!0);for(let A=0;A<6;A++){const y=A%3;y===0?(c.up.set(0,l[A],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+h[A],s.y,s.z)):y===1?(c.up.set(0,0,l[A]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+h[A],s.z)):(c.up.set(0,l[A],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+h[A]));const P=this._cubeSize;Fn(r,y*P,A>2?P:0,P,P),m.setRenderTarget(r),f&&m.render(S,c),m.render(e,c)}m.toneMapping=_,m.autoClear=u,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=cs()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ls());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;Fn(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Yn)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),m=Math.sqrt(l*l-h*h),u=0+l*1.25,_=m*u,{_lodMax:g}=this,S=this._sizeLods[n],d=3*S*(n>g-ln?n-g+ln:0),f=4*(this._cubeSize-S);c.envMap.value=e.texture,c.roughness.value=_,c.mipInt.value=g-t,Fn(s,d,f,3*S,2*S),r.setRenderTarget(s),r.render(o,Yn),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=g-n,Fn(e,d,f,3*S,2*S),r.setRenderTarget(e),r.render(o,Yn)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&He("blur direction must be either latitudinal or longitudinal!");const h=3,m=this._lodMeshes[r];m.material=l;const u=l.uniforms,_=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*_):2*Math.PI/(2*xn-1),S=s/g,d=isFinite(s)?1+Math.floor(h*S):xn;d>xn&&Re(`sigmaRadians, ${s}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${xn}`);const f=[];let M=0;for(let L=0;L<xn;++L){const x=L/S,T=Math.exp(-x*x/2);f.push(T),L===0?M+=T:L<d&&(M+=2*T)}for(let L=0;L<f.length;L++)f[L]=f[L]/M;u.envMap.value=e.texture,u.samples.value=d,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:A}=this;u.dTheta.value=g,u.mipInt.value=A-n;const y=this._sizeLods[r],P=3*y*(r>A-ln?r-A+ln:0),b=4*(this._cubeSize-y);Fn(t,P,b,3*y,2*y),c.setRenderTarget(t),c.render(m,Yn)}}function wc(i){const e=[],t=[],n=[];let r=i;const s=i-ln+1+rs.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let c=1/o;a>i-ln?c=rs[a-i+ln-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),h=-l,m=1+l,u=[h,h,m,h,m,m,h,h,m,m,h,m],_=6,g=6,S=3,d=2,f=1,M=new Float32Array(S*g*_),A=new Float32Array(d*g*_),y=new Float32Array(f*g*_);for(let b=0;b<_;b++){const L=b%3*2/3-1,x=b>2?0:-1,T=[L,x,0,L+2/3,x,0,L+2/3,x+1,0,L,x,0,L+2/3,x+1,0,L,x+1,0];M.set(T,S*g*b),A.set(u,d*g*b);const Y=[b,b,b,b,b,b];y.set(Y,f*g*b)}const P=new It;P.setAttribute("position",new Vt(M,S)),P.setAttribute("uv",new Vt(A,d)),P.setAttribute("faceIndex",new Vt(y,f)),n.push(new Jt(P,null)),r>ln&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function os(i,e,t){const n=new zt(i,e,t);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fn(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Pc(i,e,t){return new Ht({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Rc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ni(),fragmentShader:`
|
|
3621
|
-
|
|
3622
|
-
precision highp float;
|
|
3623
|
-
precision highp int;
|
|
3624
|
-
|
|
3625
|
-
varying vec3 vOutputDirection;
|
|
3626
|
-
|
|
3627
|
-
uniform sampler2D envMap;
|
|
3628
|
-
uniform float roughness;
|
|
3629
|
-
uniform float mipInt;
|
|
3630
|
-
|
|
3631
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
3632
|
-
#include <cube_uv_reflection_fragment>
|
|
3633
|
-
|
|
3634
|
-
#define PI 3.14159265359
|
|
3635
|
-
|
|
3636
|
-
// Van der Corput radical inverse
|
|
3637
|
-
float radicalInverse_VdC(uint bits) {
|
|
3638
|
-
bits = (bits << 16u) | (bits >> 16u);
|
|
3639
|
-
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
3640
|
-
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
3641
|
-
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
3642
|
-
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
3643
|
-
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
|
-
// Hammersley sequence
|
|
3647
|
-
vec2 hammersley(uint i, uint N) {
|
|
3648
|
-
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
3649
|
-
}
|
|
3650
|
-
|
|
3651
|
-
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
3652
|
-
// "Sampling the GGX Distribution of Visible Normals"
|
|
3653
|
-
// https://jcgt.org/published/0007/04/01/
|
|
3654
|
-
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
3655
|
-
float alpha = roughness * roughness;
|
|
3656
|
-
|
|
3657
|
-
// Section 4.1: Orthonormal basis
|
|
3658
|
-
vec3 T1 = vec3(1.0, 0.0, 0.0);
|
|
3659
|
-
vec3 T2 = cross(V, T1);
|
|
3660
|
-
|
|
3661
|
-
// Section 4.2: Parameterization of projected area
|
|
3662
|
-
float r = sqrt(Xi.x);
|
|
3663
|
-
float phi = 2.0 * PI * Xi.y;
|
|
3664
|
-
float t1 = r * cos(phi);
|
|
3665
|
-
float t2 = r * sin(phi);
|
|
3666
|
-
float s = 0.5 * (1.0 + V.z);
|
|
3667
|
-
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
3668
|
-
|
|
3669
|
-
// Section 4.3: Reprojection onto hemisphere
|
|
3670
|
-
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
|
|
3671
|
-
|
|
3672
|
-
// Section 3.4: Transform back to ellipsoid configuration
|
|
3673
|
-
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
void main() {
|
|
3677
|
-
vec3 N = normalize(vOutputDirection);
|
|
3678
|
-
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
3679
|
-
|
|
3680
|
-
vec3 prefilteredColor = vec3(0.0);
|
|
3681
|
-
float totalWeight = 0.0;
|
|
3682
|
-
|
|
3683
|
-
// For very low roughness, just sample the environment directly
|
|
3684
|
-
if (roughness < 0.001) {
|
|
3685
|
-
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
3686
|
-
return;
|
|
3687
|
-
}
|
|
3688
|
-
|
|
3689
|
-
// Tangent space basis for VNDF sampling
|
|
3690
|
-
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
3691
|
-
vec3 tangent = normalize(cross(up, N));
|
|
3692
|
-
vec3 bitangent = cross(N, tangent);
|
|
3693
|
-
|
|
3694
|
-
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
3695
|
-
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
3696
|
-
|
|
3697
|
-
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
3698
|
-
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
3699
|
-
|
|
3700
|
-
// Transform H back to world space
|
|
3701
|
-
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
3702
|
-
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
3703
|
-
|
|
3704
|
-
float NdotL = max(dot(N, L), 0.0);
|
|
3705
|
-
|
|
3706
|
-
if(NdotL > 0.0) {
|
|
3707
|
-
// Sample environment at fixed mip level
|
|
3708
|
-
// VNDF importance sampling handles the distribution filtering
|
|
3709
|
-
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
3710
|
-
|
|
3711
|
-
// Weight by NdotL for the split-sum approximation
|
|
3712
|
-
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
3713
|
-
prefilteredColor += sampleColor * NdotL;
|
|
3714
|
-
totalWeight += NdotL;
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
|
-
if (totalWeight > 0.0) {
|
|
3719
|
-
prefilteredColor = prefilteredColor / totalWeight;
|
|
3720
|
-
}
|
|
3721
|
-
|
|
3722
|
-
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
3723
|
-
}
|
|
3724
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function Dc(i,e,t){const n=new Float32Array(xn),r=new I(0,1,0);return new Ht({name:"SphericalGaussianBlur",defines:{n:xn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ni(),fragmentShader:`
|
|
3725
|
-
|
|
3726
|
-
precision mediump float;
|
|
3727
|
-
precision mediump int;
|
|
3728
|
-
|
|
3729
|
-
varying vec3 vOutputDirection;
|
|
3730
|
-
|
|
3731
|
-
uniform sampler2D envMap;
|
|
3732
|
-
uniform int samples;
|
|
3733
|
-
uniform float weights[ n ];
|
|
3734
|
-
uniform bool latitudinal;
|
|
3735
|
-
uniform float dTheta;
|
|
3736
|
-
uniform float mipInt;
|
|
3737
|
-
uniform vec3 poleAxis;
|
|
3738
|
-
|
|
3739
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
3740
|
-
#include <cube_uv_reflection_fragment>
|
|
3741
|
-
|
|
3742
|
-
vec3 getSample( float theta, vec3 axis ) {
|
|
3743
|
-
|
|
3744
|
-
float cosTheta = cos( theta );
|
|
3745
|
-
// Rodrigues' axis-angle rotation
|
|
3746
|
-
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
3747
|
-
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
3748
|
-
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
3749
|
-
|
|
3750
|
-
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
3751
|
-
|
|
3752
|
-
}
|
|
3753
|
-
|
|
3754
|
-
void main() {
|
|
3755
|
-
|
|
3756
|
-
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
3757
|
-
|
|
3758
|
-
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
3759
|
-
|
|
3760
|
-
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
3761
|
-
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
|
-
axis = normalize( axis );
|
|
3765
|
-
|
|
3766
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
3767
|
-
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
3768
|
-
|
|
3769
|
-
for ( int i = 1; i < n; i++ ) {
|
|
3770
|
-
|
|
3771
|
-
if ( i >= samples ) {
|
|
3772
|
-
|
|
3773
|
-
break;
|
|
3774
|
-
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
float theta = dTheta * float( i );
|
|
3778
|
-
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
3779
|
-
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
3780
|
-
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
}
|
|
3784
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function ls(){return new Ht({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ni(),fragmentShader:`
|
|
3785
|
-
|
|
3786
|
-
precision mediump float;
|
|
3787
|
-
precision mediump int;
|
|
3788
|
-
|
|
3789
|
-
varying vec3 vOutputDirection;
|
|
3790
|
-
|
|
3791
|
-
uniform sampler2D envMap;
|
|
3792
|
-
|
|
3793
|
-
#include <common>
|
|
3794
|
-
|
|
3795
|
-
void main() {
|
|
3796
|
-
|
|
3797
|
-
vec3 outputDirection = normalize( vOutputDirection );
|
|
3798
|
-
vec2 uv = equirectUv( outputDirection );
|
|
3799
|
-
|
|
3800
|
-
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3801
|
-
|
|
3802
|
-
}
|
|
3803
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function cs(){return new Ht({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ni(),fragmentShader:`
|
|
3804
|
-
|
|
3805
|
-
precision mediump float;
|
|
3806
|
-
precision mediump int;
|
|
3807
|
-
|
|
3808
|
-
uniform float flipEnvMap;
|
|
3809
|
-
|
|
3810
|
-
varying vec3 vOutputDirection;
|
|
3811
|
-
|
|
3812
|
-
uniform samplerCube envMap;
|
|
3813
|
-
|
|
3814
|
-
void main() {
|
|
3815
|
-
|
|
3816
|
-
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3817
|
-
|
|
3818
|
-
}
|
|
3819
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function Ni(){return`
|
|
3820
|
-
|
|
3821
|
-
precision mediump float;
|
|
3822
|
-
precision mediump int;
|
|
3823
|
-
|
|
3824
|
-
attribute float faceIndex;
|
|
3825
|
-
|
|
3826
|
-
varying vec3 vOutputDirection;
|
|
3827
|
-
|
|
3828
|
-
// RH coordinate system; PMREM face-indexing convention
|
|
3829
|
-
vec3 getDirection( vec2 uv, float face ) {
|
|
3830
|
-
|
|
3831
|
-
uv = 2.0 * uv - 1.0;
|
|
3832
|
-
|
|
3833
|
-
vec3 direction = vec3( uv, 1.0 );
|
|
3834
|
-
|
|
3835
|
-
if ( face == 0.0 ) {
|
|
3836
|
-
|
|
3837
|
-
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
3838
|
-
|
|
3839
|
-
} else if ( face == 1.0 ) {
|
|
3840
|
-
|
|
3841
|
-
direction = direction.xzy;
|
|
3842
|
-
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
3843
|
-
|
|
3844
|
-
} else if ( face == 2.0 ) {
|
|
3845
|
-
|
|
3846
|
-
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
3847
|
-
|
|
3848
|
-
} else if ( face == 3.0 ) {
|
|
3849
|
-
|
|
3850
|
-
direction = direction.zyx;
|
|
3851
|
-
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
3852
|
-
|
|
3853
|
-
} else if ( face == 4.0 ) {
|
|
3854
|
-
|
|
3855
|
-
direction = direction.xzy;
|
|
3856
|
-
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
3857
|
-
|
|
3858
|
-
} else if ( face == 5.0 ) {
|
|
3859
|
-
|
|
3860
|
-
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
3861
|
-
|
|
3862
|
-
}
|
|
3863
|
-
|
|
3864
|
-
return direction;
|
|
3865
|
-
|
|
3866
|
-
}
|
|
3867
|
-
|
|
3868
|
-
void main() {
|
|
3869
|
-
|
|
3870
|
-
vOutputDirection = getDirection( uv, faceIndex );
|
|
3871
|
-
gl_Position = vec4( position, 1.0 );
|
|
3872
|
-
|
|
3873
|
-
}
|
|
3874
|
-
`}class Vs extends zt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Is(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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 n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
3875
|
-
|
|
3876
|
-
varying vec3 vWorldDirection;
|
|
3877
|
-
|
|
3878
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
3879
|
-
|
|
3880
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
3881
|
-
|
|
3882
|
-
}
|
|
3883
|
-
|
|
3884
|
-
void main() {
|
|
3885
|
-
|
|
3886
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
3887
|
-
|
|
3888
|
-
#include <begin_vertex>
|
|
3889
|
-
#include <project_vertex>
|
|
3890
|
-
|
|
3891
|
-
}
|
|
3892
|
-
`,fragmentShader:`
|
|
3893
|
-
|
|
3894
|
-
uniform sampler2D tEquirect;
|
|
3895
|
-
|
|
3896
|
-
varying vec3 vWorldDirection;
|
|
3897
|
-
|
|
3898
|
-
#include <common>
|
|
3899
|
-
|
|
3900
|
-
void main() {
|
|
3901
|
-
|
|
3902
|
-
vec3 direction = normalize( vWorldDirection );
|
|
3903
|
-
|
|
3904
|
-
vec2 sampleUV = equirectUv( direction );
|
|
3905
|
-
|
|
3906
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
3907
|
-
|
|
3908
|
-
}
|
|
3909
|
-
`},r=new ei(5,5,5),s=new Ht({name:"CubemapFromEquirect",uniforms:Nn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;const a=new Jt(r,s),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=1006),new Oa(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function Lc(i){let e=new WeakMap,t=new WeakMap,n=null;function r(u,_=!1){return u==null?null:_?a(u):s(u)}function s(u){if(u&&u.isTexture){const _=u.mapping;if(_===303||_===304)if(e.has(u)){const g=e.get(u).texture;return o(g,u.mapping)}else{const g=u.image;if(g&&g.height>0){const S=new Vs(g.height);return S.fromEquirectangularTexture(i,u),e.set(u,S),u.addEventListener("dispose",l),o(S.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const _=u.mapping,g=_===303||_===304,S=_===301||_===302;if(g||S){let d=t.get(u);const f=d!==void 0?d.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return n===null&&(n=new as(i)),d=g?n.fromEquirectangular(u,d):n.fromCubemap(u,d),d.texture.pmremVersion=u.pmremVersion,t.set(u,d),d.texture;if(d!==void 0)return d.texture;{const M=u.image;return g&&M&&M.height>0||S&&M&&c(M)?(n===null&&(n=new as(i)),d=g?n.fromEquirectangular(u):n.fromCubemap(u),d.texture.pmremVersion=u.pmremVersion,t.set(u,d),u.addEventListener("dispose",h),d.texture):null}}}return u}function o(u,_){return _===303?u.mapping=301:_===304&&(u.mapping=302),u}function c(u){let _=0;const g=6;for(let S=0;S<g;S++)u[S]!==void 0&&_++;return _===g}function l(u){const _=u.target;_.removeEventListener("dispose",l);const g=e.get(_);g!==void 0&&(e.delete(_),g.dispose())}function h(u){const _=u.target;_.removeEventListener("dispose",h);const g=t.get(_);g!==void 0&&(t.delete(_),g.dispose())}function m(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:m}}function Fc(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Li("WebGLRenderer: "+n+" extension not supported."),r}}}function Uc(i,e,t,n){const r={},s=new WeakMap;function a(m){const u=m.target;u.index!==null&&e.remove(u.index);for(const g in u.attributes)e.remove(u.attributes[g]);u.removeEventListener("dispose",a),delete r[u.id];const _=s.get(u);_&&(e.remove(_),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(m,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function c(m){const u=m.attributes;for(const _ in u)e.update(u[_],i.ARRAY_BUFFER)}function l(m){const u=[],_=m.index,g=m.attributes.position;let S=0;if(g===void 0)return;if(_!==null){const M=_.array;S=_.version;for(let A=0,y=M.length;A<y;A+=3){const P=M[A+0],b=M[A+1],L=M[A+2];u.push(P,b,b,L,L,P)}}else{const M=g.array;S=g.version;for(let A=0,y=M.length/3-1;A<y;A+=3){const P=A+0,b=A+1,L=A+2;u.push(P,b,b,L,L,P)}}const d=new(g.count>=65535?Ls:Ds)(u,1);d.version=S;const f=s.get(m);f&&e.remove(f),s.set(m,d)}function h(m){const u=s.get(m);if(u){const _=m.index;_!==null&&u.version<_.version&&l(m)}else l(m);return s.get(m)}return{get:o,update:c,getWireframeAttribute:h}}function Ic(i,e,t){let n;function r(u){n=u}let s,a;function o(u){s=u.type,a=u.bytesPerElement}function c(u,_){i.drawElements(n,_,s,u*a),t.update(_,n,1)}function l(u,_,g){g!==0&&(i.drawElementsInstanced(n,_,s,u*a,g),t.update(_,n,g))}function h(u,_,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,_,0,s,u,0,g);let d=0;for(let f=0;f<g;f++)d+=_[f];t.update(d,n,1)}function m(u,_,g,S){if(g===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let f=0;f<u.length;f++)l(u[f]/a,_[f],S[f]);else{d.multiDrawElementsInstancedWEBGL(n,_,0,s,u,0,S,0,g);let f=0;for(let M=0;M<g;M++)f+=_[M]*S[M];t.update(f,n,1)}}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=m}function Nc(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:He("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Oc(i,e,t){const n=new WeakMap,r=new ot;function s(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,m=h!==void 0?h.length:0;let u=n.get(o);if(u===void 0||u.count!==m){let T=function(){L.dispose(),n.delete(o),o.removeEventListener("dispose",T)};u!==void 0&&u.texture.dispose();const _=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,S=o.morphAttributes.color!==void 0,d=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let A=0;_===!0&&(A=1),g===!0&&(A=2),S===!0&&(A=3);let y=o.attributes.position.count*A,P=1;y>e.maxTextureSize&&(P=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const b=new Float32Array(y*P*4*m),L=new Cs(b,y,P,m);L.type=1015,L.needsUpdate=!0;const x=A*4;for(let Y=0;Y<m;Y++){const C=d[Y],V=f[Y],G=M[Y],k=y*P*4*Y;for(let H=0;H<C.count;H++){const B=H*x;_===!0&&(r.fromBufferAttribute(C,H),b[k+B+0]=r.x,b[k+B+1]=r.y,b[k+B+2]=r.z,b[k+B+3]=0),g===!0&&(r.fromBufferAttribute(V,H),b[k+B+4]=r.x,b[k+B+5]=r.y,b[k+B+6]=r.z,b[k+B+7]=0),S===!0&&(r.fromBufferAttribute(G,H),b[k+B+8]=r.x,b[k+B+9]=r.y,b[k+B+10]=r.z,b[k+B+11]=G.itemSize===4?r.w:1)}}u={count:m,texture:L,size:new $e(y,P)},n.set(o,u),o.addEventListener("dispose",T)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let _=0;for(let S=0;S<l.length;S++)_+=l[S];const g=o.morphTargetsRelative?1:1-_;c.getUniforms().setValue(i,"morphTargetBaseInfluence",g),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function Bc(i,e,t,n,r){let s=new WeakMap;function a(l){const h=r.render.frame,m=l.geometry,u=e.get(l,m);if(s.get(u)!==h&&(e.update(u),s.set(u,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),s.get(l)!==h&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),s.set(l,h))),l.isSkinnedMesh){const _=l.skeleton;s.get(_)!==h&&(_.update(),s.set(_,h))}return u}function o(){s=new WeakMap}function c(l){const h=l.target;h.removeEventListener("dispose",c),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}const Gc={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function zc(i,e,t,n,r){const s=new zt(e,t,{type:i,depthBuffer:n,stencilBuffer:r}),a=new zt(e,t,{type:1016,depthBuffer:!1,stencilBuffer:!1}),o=new It;o.setAttribute("position",new Ut([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Ut([0,2,0,0,2,0],2));const c=new Ua({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
3910
|
-
precision highp float;
|
|
3911
|
-
|
|
3912
|
-
uniform mat4 modelViewMatrix;
|
|
3913
|
-
uniform mat4 projectionMatrix;
|
|
3914
|
-
|
|
3915
|
-
attribute vec3 position;
|
|
3916
|
-
attribute vec2 uv;
|
|
3917
|
-
|
|
3918
|
-
varying vec2 vUv;
|
|
3919
|
-
|
|
3920
|
-
void main() {
|
|
3921
|
-
vUv = uv;
|
|
3922
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3923
|
-
}`,fragmentShader:`
|
|
3924
|
-
precision highp float;
|
|
3925
|
-
|
|
3926
|
-
uniform sampler2D tDiffuse;
|
|
3927
|
-
|
|
3928
|
-
varying vec2 vUv;
|
|
3929
|
-
|
|
3930
|
-
#include <tonemapping_pars_fragment>
|
|
3931
|
-
#include <colorspace_pars_fragment>
|
|
3932
|
-
|
|
3933
|
-
void main() {
|
|
3934
|
-
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
3935
|
-
|
|
3936
|
-
#ifdef LINEAR_TONE_MAPPING
|
|
3937
|
-
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
3938
|
-
#elif defined( REINHARD_TONE_MAPPING )
|
|
3939
|
-
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
3940
|
-
#elif defined( CINEON_TONE_MAPPING )
|
|
3941
|
-
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
3942
|
-
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
3943
|
-
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
3944
|
-
#elif defined( AGX_TONE_MAPPING )
|
|
3945
|
-
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
3946
|
-
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
3947
|
-
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
3948
|
-
#elif defined( CUSTOM_TONE_MAPPING )
|
|
3949
|
-
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
3950
|
-
#endif
|
|
3951
|
-
|
|
3952
|
-
#ifdef SRGB_TRANSFER
|
|
3953
|
-
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
3954
|
-
#endif
|
|
3955
|
-
}`,depthTest:!1,depthWrite:!1}),l=new Jt(o,c),h=new Gs(-1,1,1,-1,0,1);let m=null,u=null,_=!1,g,S=null,d=[],f=!1;this.setSize=function(M,A){s.setSize(M,A),a.setSize(M,A);for(let y=0;y<d.length;y++){const P=d[y];P.setSize&&P.setSize(M,A)}},this.setEffects=function(M){d=M,f=d.length>0&&d[0].isRenderPass===!0;const A=s.width,y=s.height;for(let P=0;P<d.length;P++){const b=d[P];b.setSize&&b.setSize(A,y)}},this.begin=function(M,A){if(_||M.toneMapping===0&&d.length===0)return!1;if(S=A,A!==null){const y=A.width,P=A.height;(s.width!==y||s.height!==P)&&this.setSize(y,P)}return f===!1&&M.setRenderTarget(s),g=M.toneMapping,M.toneMapping=0,!0},this.hasRenderPass=function(){return f},this.end=function(M,A){M.toneMapping=g,_=!0;let y=s,P=a;for(let b=0;b<d.length;b++){const L=d[b];if(L.enabled!==!1&&(L.render(M,P,y,A),L.needsSwap!==!1)){const x=y;y=P,P=x}}if(m!==M.outputColorSpace||u!==M.toneMapping){m=M.outputColorSpace,u=M.toneMapping,c.defines={},ze.getTransfer(m)===Ye&&(c.defines.SRGB_TRANSFER="");const b=Gc[u];b&&(c.defines[b]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=y.texture,M.setRenderTarget(S),M.render(l,h),S=null,_=!1},this.isCompositing=function(){return _},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),c.dispose()}}const Hs=new St,vr=new $n(1,1),ks=new Cs,Ws=new ca,Xs=new Is,us=[],fs=[],hs=new Float32Array(16),ds=new Float32Array(9),ps=new Float32Array(4);function zn(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=us[r];if(s===void 0&&(s=new Float32Array(r),us[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function ut(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ft(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Oi(i,e){let t=fs[e];t===void 0&&(t=new Int32Array(e),fs[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Vc(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Hc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ut(t,e))return;i.uniform2fv(this.addr,e),ft(t,e)}}function kc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ut(t,e))return;i.uniform3fv(this.addr,e),ft(t,e)}}function Wc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ut(t,e))return;i.uniform4fv(this.addr,e),ft(t,e)}}function Xc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(ut(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ft(t,e)}else{if(ut(t,n))return;ps.set(n),i.uniformMatrix2fv(this.addr,!1,ps),ft(t,n)}}function qc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(ut(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ft(t,e)}else{if(ut(t,n))return;ds.set(n),i.uniformMatrix3fv(this.addr,!1,ds),ft(t,n)}}function Yc(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(ut(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ft(t,e)}else{if(ut(t,n))return;hs.set(n),i.uniformMatrix4fv(this.addr,!1,hs),ft(t,n)}}function Kc(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Zc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ut(t,e))return;i.uniform2iv(this.addr,e),ft(t,e)}}function $c(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ut(t,e))return;i.uniform3iv(this.addr,e),ft(t,e)}}function jc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ut(t,e))return;i.uniform4iv(this.addr,e),ft(t,e)}}function Jc(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Qc(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ut(t,e))return;i.uniform2uiv(this.addr,e),ft(t,e)}}function eu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ut(t,e))return;i.uniform3uiv(this.addr,e),ft(t,e)}}function tu(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ut(t,e))return;i.uniform4uiv(this.addr,e),ft(t,e)}}function nu(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(vr.compareFunction=t.isReversedDepthBuffer()?518:515,s=vr):s=Hs,t.setTexture2D(e||s,r)}function iu(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Ws,r)}function ru(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Xs,r)}function su(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||ks,r)}function au(i){switch(i){case 5126:return Vc;case 35664:return Hc;case 35665:return kc;case 35666:return Wc;case 35674:return Xc;case 35675:return qc;case 35676:return Yc;case 5124:case 35670:return Kc;case 35667:case 35671:return Zc;case 35668:case 35672:return $c;case 35669:case 35673:return jc;case 5125:return Jc;case 36294:return Qc;case 36295:return eu;case 36296:return tu;case 35678:case 36198:case 36298:case 36306:case 35682:return nu;case 35679:case 36299:case 36307:return iu;case 35680:case 36300:case 36308:case 36293:return ru;case 36289:case 36303:case 36311:case 36292:return su}}function ou(i,e){i.uniform1fv(this.addr,e)}function lu(i,e){const t=zn(e,this.size,2);i.uniform2fv(this.addr,t)}function cu(i,e){const t=zn(e,this.size,3);i.uniform3fv(this.addr,t)}function uu(i,e){const t=zn(e,this.size,4);i.uniform4fv(this.addr,t)}function fu(i,e){const t=zn(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function hu(i,e){const t=zn(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function du(i,e){const t=zn(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function pu(i,e){i.uniform1iv(this.addr,e)}function mu(i,e){i.uniform2iv(this.addr,e)}function _u(i,e){i.uniform3iv(this.addr,e)}function gu(i,e){i.uniform4iv(this.addr,e)}function xu(i,e){i.uniform1uiv(this.addr,e)}function vu(i,e){i.uniform2uiv(this.addr,e)}function Su(i,e){i.uniform3uiv(this.addr,e)}function Mu(i,e){i.uniform4uiv(this.addr,e)}function Eu(i,e,t){const n=this.cache,r=e.length,s=Oi(t,r);ut(n,s)||(i.uniform1iv(this.addr,s),ft(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=vr:a=Hs;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Tu(i,e,t){const n=this.cache,r=e.length,s=Oi(t,r);ut(n,s)||(i.uniform1iv(this.addr,s),ft(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Ws,s[a])}function yu(i,e,t){const n=this.cache,r=e.length,s=Oi(t,r);ut(n,s)||(i.uniform1iv(this.addr,s),ft(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Xs,s[a])}function Au(i,e,t){const n=this.cache,r=e.length,s=Oi(t,r);ut(n,s)||(i.uniform1iv(this.addr,s),ft(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||ks,s[a])}function bu(i){switch(i){case 5126:return ou;case 35664:return lu;case 35665:return cu;case 35666:return uu;case 35674:return fu;case 35675:return hu;case 35676:return du;case 5124:case 35670:return pu;case 35667:case 35671:return mu;case 35668:case 35672:return _u;case 35669:case 35673:return gu;case 5125:return xu;case 36294:return vu;case 36295:return Su;case 36296:return Mu;case 35678:case 36198:case 36298:case 36306:case 35682:return Eu;case 35679:case 36299:case 36307:return Tu;case 35680:case 36300:case 36308:case 36293:return yu;case 36289:case 36303:case 36311:case 36292:return Au}}class Ru{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=au(t.type)}}class Cu{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=bu(t.type)}}class wu{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const mr=/(\w+)(\])?(\[|\.)?/g;function ms(i,e){i.seq.push(e),i.map[e.id]=e}function Pu(i,e,t){const n=i.name,r=n.length;for(mr.lastIndex=0;;){const s=mr.exec(n),a=mr.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){ms(t,l===void 0?new Ru(o,i,e):new Cu(o,i,e));break}else{let m=t.map[o];m===void 0&&(m=new wu(o),ms(t,m)),t=m}}}class wi{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);Pu(o,c,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function _s(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Du=37297;let Lu=0;function Fu(i,e){const t=i.split(`
|
|
3956
|
-
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
|
|
3957
|
-
`)}const gs=new Le;function Uu(i){ze._getMatrix(gs,ze.workingColorSpace,i);const e=`mat3( ${gs.elements.map(t=>t.toFixed(4))} )`;switch(ze.getTransfer(i)){case Pi:return[e,"LinearTransferOETF"];case Ye:return[e,"sRGBTransferOETF"];default:return Re("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function xs(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
|
|
3958
|
-
|
|
3959
|
-
`+s+`
|
|
3960
|
-
|
|
3961
|
-
`+Fu(i.getShaderSource(e),o)}else return s}function Iu(i,e){const t=Uu(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
3962
|
-
`)}const Nu={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"};function Ou(i,e){const t=Nu[e];return t===void 0?(Re("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ci=new I;function Bu(){ze.getLuminanceCoefficients(Ci);const i=Ci.x.toFixed(4),e=Ci.y.toFixed(4),t=Ci.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
3963
|
-
`)}function Gu(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Zn).join(`
|
|
3964
|
-
`)}function zu(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3965
|
-
`)}function Vu(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Zn(i){return i!==""}function vs(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ss(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Hu=/^[ \t]*#include +<([\w\d./]+)>/gm;function Sr(i){return i.replace(Hu,Wu)}const ku=new Map;function Wu(i,e){let t=Ue[e];if(t===void 0){const n=ku.get(e);if(n!==void 0)t=Ue[n],Re('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Sr(t)}const Xu=/#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 Ms(i){return i.replace(Xu,qu)}function qu(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Es(i){let e=`precision ${i.precision} float;
|
|
3966
|
-
precision ${i.precision} int;
|
|
3967
|
-
precision ${i.precision} sampler2D;
|
|
3968
|
-
precision ${i.precision} samplerCube;
|
|
3969
|
-
precision ${i.precision} sampler3D;
|
|
3970
|
-
precision ${i.precision} sampler2DArray;
|
|
3971
|
-
precision ${i.precision} sampler2DShadow;
|
|
3972
|
-
precision ${i.precision} samplerCubeShadow;
|
|
3973
|
-
precision ${i.precision} sampler2DArrayShadow;
|
|
3974
|
-
precision ${i.precision} isampler2D;
|
|
3975
|
-
precision ${i.precision} isampler3D;
|
|
3976
|
-
precision ${i.precision} isamplerCube;
|
|
3977
|
-
precision ${i.precision} isampler2DArray;
|
|
3978
|
-
precision ${i.precision} usampler2D;
|
|
3979
|
-
precision ${i.precision} usampler3D;
|
|
3980
|
-
precision ${i.precision} usamplerCube;
|
|
3981
|
-
precision ${i.precision} usampler2DArray;
|
|
3982
|
-
`;return i.precision==="highp"?e+=`
|
|
3983
|
-
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
3984
|
-
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
3985
|
-
#define LOW_PRECISION`),e}const Yu={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"};function Ku(i){return Yu[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Zu={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"};function $u(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Zu[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const ju={302:"ENVMAP_MODE_REFRACTION"};function Ju(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":ju[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Qu={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function ef(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Qu[i.combine]||"ENVMAP_BLENDING_NONE"}function tf(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function nf(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=Ku(t),l=$u(t),h=Ju(t),m=ef(t),u=tf(t),_=Gu(t),g=zu(s),S=r.createProgram();let d,f,M=t.glslVersion?"#version "+t.glslVersion+`
|
|
3986
|
-
`:"";t.isRawShaderMaterial?(d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Zn).join(`
|
|
3987
|
-
`),d.length>0&&(d+=`
|
|
3988
|
-
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Zn).join(`
|
|
3989
|
-
`),f.length>0&&(f+=`
|
|
3990
|
-
`)):(d=[Es(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+h:"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
|
|
3991
|
-
`].filter(Zn).join(`
|
|
3992
|
-
`),f=[Es(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+m:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==0?"#define TONE_MAPPING":"",t.toneMapping!==0?Ue.tonemapping_pars_fragment:"",t.toneMapping!==0?Ou("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ue.colorspace_pars_fragment,Iu("linearToOutputTexel",t.outputColorSpace),Bu(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3993
|
-
`].filter(Zn).join(`
|
|
3994
|
-
`)),a=Sr(a),a=vs(a,t),a=Ss(a,t),o=Sr(o),o=vs(o,t),o=Ss(o,t),a=Ms(a),o=Ms(o),t.isRawShaderMaterial!==!0&&(M=`#version 300 es
|
|
3995
|
-
`,d=[_,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3996
|
-
`)+`
|
|
3997
|
-
`+d,f=["#define varying in",t.glslVersion===Lr?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Lr?"":"#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(`
|
|
3998
|
-
`)+`
|
|
3999
|
-
`+f);const A=M+d+a,y=M+f+o,P=_s(r,r.VERTEX_SHADER,A),b=_s(r,r.FRAGMENT_SHADER,y);r.attachShader(S,P),r.attachShader(S,b),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S);function L(C){if(i.debug.checkShaderErrors){const V=r.getProgramInfoLog(S)||"",G=r.getShaderInfoLog(P)||"",k=r.getShaderInfoLog(b)||"",H=V.trim(),B=G.trim(),O=k.trim();let Q=!0,$=!0;if(r.getProgramParameter(S,r.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,S,P,b);else{const ce=xs(r,P,"vertex"),pe=xs(r,b,"fragment");He("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,r.VALIDATE_STATUS)+`
|
|
4000
|
-
|
|
4001
|
-
Material Name: `+C.name+`
|
|
4002
|
-
Material Type: `+C.type+`
|
|
4003
|
-
|
|
4004
|
-
Program Info Log: `+H+`
|
|
4005
|
-
`+ce+`
|
|
4006
|
-
`+pe)}else H!==""?Re("WebGLProgram: Program Info Log:",H):(B===""||O==="")&&($=!1);$&&(C.diagnostics={runnable:Q,programLog:H,vertexShader:{log:B,prefix:d},fragmentShader:{log:O,prefix:f}})}r.deleteShader(P),r.deleteShader(b),x=new wi(r,S),T=Vu(r,S)}let x;this.getUniforms=function(){return x===void 0&&L(this),x};let T;this.getAttributes=function(){return T===void 0&&L(this),T};let Y=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return Y===!1&&(Y=r.getProgramParameter(S,Du)),Y},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Lu++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=P,this.fragmentShader=b,this}let rf=0;class sf{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),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 n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new af(e),t.set(e,n)),n}}class af{constructor(e){this.id=rf++,this.code=e,this.usedTimes=0}}function of(i,e,t,n,r,s){const a=new ws,o=new sf,c=new Set,l=[],h=new Map,m=n.logarithmicDepthBuffer;let u=n.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 g(x){return c.add(x),x===0?"uv":`uv${x}`}function S(x,T,Y,C,V){const G=C.fog,k=V.geometry,H=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?C.environment:null,B=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,O=e.get(x.envMap||H,B),Q=O&&O.mapping===306?O.image.height:null,$=_[x.type];x.precision!==null&&(u=n.getMaxPrecision(x.precision),u!==x.precision&&Re("WebGLProgram.getParameters:",x.precision,"not supported, using",u,"instead."));const ce=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,pe=ce!==void 0?ce.length:0;let fe=0;k.morphAttributes.position!==void 0&&(fe=1),k.morphAttributes.normal!==void 0&&(fe=2),k.morphAttributes.color!==void 0&&(fe=3);let Fe,nt,tt,K;if($){const qe=Gt[$];Fe=qe.vertexShader,nt=qe.fragmentShader}else Fe=x.vertexShader,nt=x.fragmentShader,o.update(x),tt=o.getVertexShaderID(x),K=o.getFragmentShaderID(x);const ne=i.getRenderTarget(),se=i.state.buffers.depth.getReversed(),De=V.isInstancedMesh===!0,Ae=V.isBatchedMesh===!0,Ce=!!x.map,ht=!!x.matcap,Ge=!!O,Xe=!!x.aoMap,je=!!x.lightMap,Ie=!!x.bumpMap,st=!!x.normalMap,R=!!x.displacementMap,lt=!!x.emissiveMap,ke=!!x.metalnessMap,Qe=!!x.roughnessMap,Se=x.anisotropy>0,E=x.clearcoat>0,p=x.dispersion>0,D=x.iridescence>0,q=x.sheen>0,Z=x.transmission>0,X=Se&&!!x.anisotropyMap,me=E&&!!x.clearcoatMap,ie=E&&!!x.clearcoatNormalMap,ye=E&&!!x.clearcoatRoughnessMap,be=D&&!!x.iridescenceMap,j=D&&!!x.iridescenceThicknessMap,ee=q&&!!x.sheenColorMap,_e=q&&!!x.sheenRoughnessMap,xe=!!x.specularMap,ue=!!x.specularColorMap,Ne=!!x.specularIntensityMap,w=Z&&!!x.transmissionMap,re=Z&&!!x.thicknessMap,te=!!x.gradientMap,de=!!x.alphaMap,J=x.alphaTest>0,W=!!x.alphaHash,ge=!!x.extensions;let we=0;x.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(we=i.toneMapping);const et={shaderID:$,shaderType:x.type,shaderName:x.name,vertexShader:Fe,fragmentShader:nt,defines:x.defines,customVertexShaderID:tt,customFragmentShaderID:K,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:u,batching:Ae,batchingColor:Ae&&V._colorsTexture!==null,instancing:De,instancingColor:De&&V.instanceColor!==null,instancingMorph:De&&V.morphTexture!==null,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:In,alphaToCoverage:!!x.alphaToCoverage,map:Ce,matcap:ht,envMap:Ge,envMapMode:Ge&&O.mapping,envMapCubeUVHeight:Q,aoMap:Xe,lightMap:je,bumpMap:Ie,normalMap:st,displacementMap:R,emissiveMap:lt,normalMapObjectSpace:st&&x.normalMapType===1,normalMapTangentSpace:st&&x.normalMapType===0,metalnessMap:ke,roughnessMap:Qe,anisotropy:Se,anisotropyMap:X,clearcoat:E,clearcoatMap:me,clearcoatNormalMap:ie,clearcoatRoughnessMap:ye,dispersion:p,iridescence:D,iridescenceMap:be,iridescenceThicknessMap:j,sheen:q,sheenColorMap:ee,sheenRoughnessMap:_e,specularMap:xe,specularColorMap:ue,specularIntensityMap:Ne,transmission:Z,transmissionMap:w,thicknessMap:re,gradientMap:te,opaque:x.transparent===!1&&x.blending===1&&x.alphaToCoverage===!1,alphaMap:de,alphaTest:J,alphaHash:W,combine:x.combine,mapUv:Ce&&g(x.map.channel),aoMapUv:Xe&&g(x.aoMap.channel),lightMapUv:je&&g(x.lightMap.channel),bumpMapUv:Ie&&g(x.bumpMap.channel),normalMapUv:st&&g(x.normalMap.channel),displacementMapUv:R&&g(x.displacementMap.channel),emissiveMapUv:lt&&g(x.emissiveMap.channel),metalnessMapUv:ke&&g(x.metalnessMap.channel),roughnessMapUv:Qe&&g(x.roughnessMap.channel),anisotropyMapUv:X&&g(x.anisotropyMap.channel),clearcoatMapUv:me&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:ie&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ye&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:be&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:j&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:ee&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:_e&&g(x.sheenRoughnessMap.channel),specularMapUv:xe&&g(x.specularMap.channel),specularColorMapUv:ue&&g(x.specularColorMap.channel),specularIntensityMapUv:Ne&&g(x.specularIntensityMap.channel),transmissionMapUv:w&&g(x.transmissionMap.channel),thicknessMapUv:re&&g(x.thicknessMap.channel),alphaMapUv:de&&g(x.alphaMap.channel),vertexTangents:!!k.attributes.tangent&&(st||Se),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!k.attributes.uv&&(Ce||de),fog:!!G,useFog:x.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||k.attributes.normal===void 0&&st===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:se,skinning:V.isSkinnedMesh===!0,morphTargets:k.morphAttributes.position!==void 0,morphNormals:k.morphAttributes.normal!==void 0,morphColors:k.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:fe,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&Y.length>0,shadowMapType:i.shadowMap.type,toneMapping:we,decodeVideoTexture:Ce&&x.map.isVideoTexture===!0&&ze.getTransfer(x.map.colorSpace)===Ye,decodeVideoTextureEmissive:lt&&x.emissiveMap.isVideoTexture===!0&&ze.getTransfer(x.emissiveMap.colorSpace)===Ye,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===2,flipSided:x.side===1,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ge&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ge&&x.extensions.multiDraw===!0||Ae)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return et.vertexUv1s=c.has(1),et.vertexUv2s=c.has(2),et.vertexUv3s=c.has(3),c.clear(),et}function d(x){const T=[];if(x.shaderID?T.push(x.shaderID):(T.push(x.customVertexShaderID),T.push(x.customFragmentShaderID)),x.defines!==void 0)for(const Y in x.defines)T.push(Y),T.push(x.defines[Y]);return x.isRawShaderMaterial===!1&&(f(T,x),M(T,x),T.push(i.outputColorSpace)),T.push(x.customProgramCacheKey),T.join()}function f(x,T){x.push(T.precision),x.push(T.outputColorSpace),x.push(T.envMapMode),x.push(T.envMapCubeUVHeight),x.push(T.mapUv),x.push(T.alphaMapUv),x.push(T.lightMapUv),x.push(T.aoMapUv),x.push(T.bumpMapUv),x.push(T.normalMapUv),x.push(T.displacementMapUv),x.push(T.emissiveMapUv),x.push(T.metalnessMapUv),x.push(T.roughnessMapUv),x.push(T.anisotropyMapUv),x.push(T.clearcoatMapUv),x.push(T.clearcoatNormalMapUv),x.push(T.clearcoatRoughnessMapUv),x.push(T.iridescenceMapUv),x.push(T.iridescenceThicknessMapUv),x.push(T.sheenColorMapUv),x.push(T.sheenRoughnessMapUv),x.push(T.specularMapUv),x.push(T.specularColorMapUv),x.push(T.specularIntensityMapUv),x.push(T.transmissionMapUv),x.push(T.thicknessMapUv),x.push(T.combine),x.push(T.fogExp2),x.push(T.sizeAttenuation),x.push(T.morphTargetsCount),x.push(T.morphAttributeCount),x.push(T.numDirLights),x.push(T.numPointLights),x.push(T.numSpotLights),x.push(T.numSpotLightMaps),x.push(T.numHemiLights),x.push(T.numRectAreaLights),x.push(T.numDirLightShadows),x.push(T.numPointLightShadows),x.push(T.numSpotLightShadows),x.push(T.numSpotLightShadowsWithMaps),x.push(T.numLightProbes),x.push(T.shadowMapType),x.push(T.toneMapping),x.push(T.numClippingPlanes),x.push(T.numClipIntersection),x.push(T.depthPacking)}function M(x,T){a.disableAll(),T.instancing&&a.enable(0),T.instancingColor&&a.enable(1),T.instancingMorph&&a.enable(2),T.matcap&&a.enable(3),T.envMap&&a.enable(4),T.normalMapObjectSpace&&a.enable(5),T.normalMapTangentSpace&&a.enable(6),T.clearcoat&&a.enable(7),T.iridescence&&a.enable(8),T.alphaTest&&a.enable(9),T.vertexColors&&a.enable(10),T.vertexAlphas&&a.enable(11),T.vertexUv1s&&a.enable(12),T.vertexUv2s&&a.enable(13),T.vertexUv3s&&a.enable(14),T.vertexTangents&&a.enable(15),T.anisotropy&&a.enable(16),T.alphaHash&&a.enable(17),T.batching&&a.enable(18),T.dispersion&&a.enable(19),T.batchingColor&&a.enable(20),T.gradientMap&&a.enable(21),x.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.reversedDepthBuffer&&a.enable(4),T.skinning&&a.enable(5),T.morphTargets&&a.enable(6),T.morphNormals&&a.enable(7),T.morphColors&&a.enable(8),T.premultipliedAlpha&&a.enable(9),T.shadowMapEnabled&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),T.decodeVideoTexture&&a.enable(19),T.decodeVideoTextureEmissive&&a.enable(20),T.alphaToCoverage&&a.enable(21),x.push(a.mask)}function A(x){const T=_[x.type];let Y;if(T){const C=Gt[T];Y=Da.clone(C.uniforms)}else Y=x.uniforms;return Y}function y(x,T){let Y=h.get(T);return Y!==void 0?++Y.usedTimes:(Y=new nf(i,T,x,r),l.push(Y),h.set(T,Y)),Y}function P(x){if(--x.usedTimes===0){const T=l.indexOf(x);l[T]=l[l.length-1],l.pop(),h.delete(x.cacheKey),x.destroy()}}function b(x){o.remove(x)}function L(){o.dispose()}return{getParameters:S,getProgramCacheKey:d,getUniforms:A,acquireProgram:y,releaseProgram:P,releaseShaderCache:b,programs:l,dispose:L}}function lf(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,c){i.get(a)[o]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function cf(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function Ts(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function ys(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u){let _=0;return u.isInstancedMesh&&(_+=2),u.isSkinnedMesh&&(_+=1),_}function o(u,_,g,S,d,f){let M=i[e];return M===void 0?(M={id:u.id,object:u,geometry:_,material:g,materialVariant:a(u),groupOrder:S,renderOrder:u.renderOrder,z:d,group:f},i[e]=M):(M.id=u.id,M.object=u,M.geometry=_,M.material=g,M.materialVariant=a(u),M.groupOrder=S,M.renderOrder=u.renderOrder,M.z=d,M.group=f),e++,M}function c(u,_,g,S,d,f){const M=o(u,_,g,S,d,f);g.transmission>0?n.push(M):g.transparent===!0?r.push(M):t.push(M)}function l(u,_,g,S,d,f){const M=o(u,_,g,S,d,f);g.transmission>0?n.unshift(M):g.transparent===!0?r.unshift(M):t.unshift(M)}function h(u,_){t.length>1&&t.sort(u||cf),n.length>1&&n.sort(_||Ts),r.length>1&&r.sort(_||Ts)}function m(){for(let u=e,_=i.length;u<_;u++){const g=i[u];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:c,unshift:l,finish:m,sort:h}}function uf(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new ys,i.set(n,[a])):r>=s.length?(a=new ys,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function ff(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new We};break;case"SpotLight":t={position:new I,direction:new I,color:new We,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new We,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new We,groundColor:new We};break;case"RectAreaLight":t={color:new We,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function hf(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let df=0;function pf(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function mf(i){const e=new ff,t=hf(),n={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 l=0;l<9;l++)n.probe.push(new I);const r=new I,s=new rt,a=new rt;function o(l){let h=0,m=0,u=0;for(let T=0;T<9;T++)n.probe[T].set(0,0,0);let _=0,g=0,S=0,d=0,f=0,M=0,A=0,y=0,P=0,b=0,L=0;l.sort(pf);for(let T=0,Y=l.length;T<Y;T++){const C=l[T],V=C.color,G=C.intensity,k=C.distance;let H=null;if(C.shadow&&C.shadow.map&&(C.shadow.map.texture.format===1030?H=C.shadow.map.texture:H=C.shadow.map.depthTexture||C.shadow.map.texture),C.isAmbientLight)h+=V.r*G,m+=V.g*G,u+=V.b*G;else if(C.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(C.sh.coefficients[B],G);L++}else if(C.isDirectionalLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const O=C.shadow,Q=t.get(C);Q.shadowIntensity=O.intensity,Q.shadowBias=O.bias,Q.shadowNormalBias=O.normalBias,Q.shadowRadius=O.radius,Q.shadowMapSize=O.mapSize,n.directionalShadow[_]=Q,n.directionalShadowMap[_]=H,n.directionalShadowMatrix[_]=C.shadow.matrix,M++}n.directional[_]=B,_++}else if(C.isSpotLight){const B=e.get(C);B.position.setFromMatrixPosition(C.matrixWorld),B.color.copy(V).multiplyScalar(G),B.distance=k,B.coneCos=Math.cos(C.angle),B.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),B.decay=C.decay,n.spot[S]=B;const O=C.shadow;if(C.map&&(n.spotLightMap[P]=C.map,P++,O.updateMatrices(C),C.castShadow&&b++),n.spotLightMatrix[S]=O.matrix,C.castShadow){const Q=t.get(C);Q.shadowIntensity=O.intensity,Q.shadowBias=O.bias,Q.shadowNormalBias=O.normalBias,Q.shadowRadius=O.radius,Q.shadowMapSize=O.mapSize,n.spotShadow[S]=Q,n.spotShadowMap[S]=H,y++}S++}else if(C.isRectAreaLight){const B=e.get(C);B.color.copy(V).multiplyScalar(G),B.halfWidth.set(C.width*.5,0,0),B.halfHeight.set(0,C.height*.5,0),n.rectArea[d]=B,d++}else if(C.isPointLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity),B.distance=C.distance,B.decay=C.decay,C.castShadow){const O=C.shadow,Q=t.get(C);Q.shadowIntensity=O.intensity,Q.shadowBias=O.bias,Q.shadowNormalBias=O.normalBias,Q.shadowRadius=O.radius,Q.shadowMapSize=O.mapSize,Q.shadowCameraNear=O.camera.near,Q.shadowCameraFar=O.camera.far,n.pointShadow[g]=Q,n.pointShadowMap[g]=H,n.pointShadowMatrix[g]=C.shadow.matrix,A++}n.point[g]=B,g++}else if(C.isHemisphereLight){const B=e.get(C);B.skyColor.copy(C.color).multiplyScalar(G),B.groundColor.copy(C.groundColor).multiplyScalar(G),n.hemi[f]=B,f++}}d>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ae.LTC_FLOAT_1,n.rectAreaLTC2=ae.LTC_FLOAT_2):(n.rectAreaLTC1=ae.LTC_HALF_1,n.rectAreaLTC2=ae.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=m,n.ambient[2]=u;const x=n.hash;(x.directionalLength!==_||x.pointLength!==g||x.spotLength!==S||x.rectAreaLength!==d||x.hemiLength!==f||x.numDirectionalShadows!==M||x.numPointShadows!==A||x.numSpotShadows!==y||x.numSpotMaps!==P||x.numLightProbes!==L)&&(n.directional.length=_,n.spot.length=S,n.rectArea.length=d,n.point.length=g,n.hemi.length=f,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=A,n.spotLightMatrix.length=y+P-b,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=L,x.directionalLength=_,x.pointLength=g,x.spotLength=S,x.rectAreaLength=d,x.hemiLength=f,x.numDirectionalShadows=M,x.numPointShadows=A,x.numSpotShadows=y,x.numSpotMaps=P,x.numLightProbes=L,n.version=df++)}function c(l,h){let m=0,u=0,_=0,g=0,S=0;const d=h.matrixWorldInverse;for(let f=0,M=l.length;f<M;f++){const A=l[f];if(A.isDirectionalLight){const y=n.directional[m];y.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(d),m++}else if(A.isSpotLight){const y=n.spot[_];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(d),y.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(d),_++}else if(A.isRectAreaLight){const y=n.rectArea[g];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(d),a.identity(),s.copy(A.matrixWorld),s.premultiply(d),a.extractRotation(s),y.halfWidth.set(A.width*.5,0,0),y.halfHeight.set(0,A.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),g++}else if(A.isPointLight){const y=n.point[u];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(d),u++}else if(A.isHemisphereLight){const y=n.hemi[S];y.direction.setFromMatrixPosition(A.matrixWorld),y.direction.transformDirection(d),S++}}}return{setup:o,setupView:c,state:n}}function As(i){const e=new mf(i),t=[],n=[];function r(h){l.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function _f(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new As(i),e.set(r,[o])):s>=a.length?(o=new As(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const gf=`void main() {
|
|
4007
|
-
gl_Position = vec4( position, 1.0 );
|
|
4008
|
-
}`,xf=`uniform sampler2D shadow_pass;
|
|
4009
|
-
uniform vec2 resolution;
|
|
4010
|
-
uniform float radius;
|
|
4011
|
-
void main() {
|
|
4012
|
-
const float samples = float( VSM_SAMPLES );
|
|
4013
|
-
float mean = 0.0;
|
|
4014
|
-
float squared_mean = 0.0;
|
|
4015
|
-
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|
4016
|
-
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|
4017
|
-
for ( float i = 0.0; i < samples; i ++ ) {
|
|
4018
|
-
float uvOffset = uvStart + i * uvStride;
|
|
4019
|
-
#ifdef HORIZONTAL_PASS
|
|
4020
|
-
vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
|
|
4021
|
-
mean += distribution.x;
|
|
4022
|
-
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
4023
|
-
#else
|
|
4024
|
-
float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
|
|
4025
|
-
mean += depth;
|
|
4026
|
-
squared_mean += depth * depth;
|
|
4027
|
-
#endif
|
|
4028
|
-
}
|
|
4029
|
-
mean = mean / samples;
|
|
4030
|
-
squared_mean = squared_mean / samples;
|
|
4031
|
-
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4032
|
-
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4033
|
-
}`,vf=[new I(1,0,0),new I(-1,0,0),new I(0,1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1)],Sf=[new I(0,-1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1),new I(0,-1,0),new I(0,-1,0)],bs=new rt,Kn=new I,_r=new I;function Mf(i,e,t){let n=new Us;const r=new $e,s=new $e,a=new ot,o=new Ia,c=new Na,l={},h=t.maxTextureSize,m={0:1,1:0,2:2},u=new Ht({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $e},radius:{value:4}},vertexShader:gf,fragmentShader:xf}),_=u.clone();_.defines.HORIZONTAL_PASS=1;const g=new It;g.setAttribute("position",new Vt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new Jt(g,u),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let f=this.type;this.render=function(b,L,x){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||b.length===0)return;this.type===2&&(Re("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);const T=i.getRenderTarget(),Y=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),V=i.state;V.setBlending(0),V.buffers.depth.getReversed()===!0?V.buffers.color.setClear(0,0,0,0):V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const G=f!==this.type;G&&L.traverse(function(k){k.material&&(Array.isArray(k.material)?k.material.forEach(H=>H.needsUpdate=!0):k.material.needsUpdate=!0)});for(let k=0,H=b.length;k<H;k++){const B=b[k],O=B.shadow;if(O===void 0){Re("WebGLShadowMap:",B,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;r.copy(O.mapSize);const Q=O.getFrameExtents();r.multiply(Q),s.copy(O.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/Q.x),r.x=s.x*Q.x,O.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/Q.y),r.y=s.y*Q.y,O.mapSize.y=s.y));const $=i.state.buffers.depth.getReversed();if(O.camera._reversedDepth=$,O.map===null||G===!0){if(O.map!==null&&(O.map.depthTexture!==null&&(O.map.depthTexture.dispose(),O.map.depthTexture=null),O.map.dispose()),this.type===3){if(B.isPointLight){Re("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}O.map=new zt(r.x,r.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),O.map.texture.name=B.name+".shadowMap",O.map.depthTexture=new $n(r.x,r.y,1015),O.map.depthTexture.name=B.name+".shadowMapDepth",O.map.depthTexture.format=1026,O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=1003,O.map.depthTexture.magFilter=1003}else B.isPointLight?(O.map=new Vs(r.x),O.map.depthTexture=new wa(r.x,1014)):(O.map=new zt(r.x,r.y),O.map.depthTexture=new $n(r.x,r.y,1014)),O.map.depthTexture.name=B.name+".shadowMap",O.map.depthTexture.format=1026,this.type===1?(O.map.depthTexture.compareFunction=$?518:515,O.map.depthTexture.minFilter=1006,O.map.depthTexture.magFilter=1006):(O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=1003,O.map.depthTexture.magFilter=1003);O.camera.updateProjectionMatrix()}const ce=O.map.isWebGLCubeRenderTarget?6:1;for(let pe=0;pe<ce;pe++){if(O.map.isWebGLCubeRenderTarget)i.setRenderTarget(O.map,pe),i.clear();else{pe===0&&(i.setRenderTarget(O.map),i.clear());const fe=O.getViewport(pe);a.set(s.x*fe.x,s.y*fe.y,s.x*fe.z,s.y*fe.w),V.viewport(a)}if(B.isPointLight){const fe=O.camera,Fe=O.matrix,nt=B.distance||fe.far;nt!==fe.far&&(fe.far=nt,fe.updateProjectionMatrix()),Kn.setFromMatrixPosition(B.matrixWorld),fe.position.copy(Kn),_r.copy(fe.position),_r.add(vf[pe]),fe.up.copy(Sf[pe]),fe.lookAt(_r),fe.updateMatrixWorld(),Fe.makeTranslation(-Kn.x,-Kn.y,-Kn.z),bs.multiplyMatrices(fe.projectionMatrix,fe.matrixWorldInverse),O._frustum.setFromProjectionMatrix(bs,fe.coordinateSystem,fe.reversedDepth)}else O.updateMatrices(B);n=O.getFrustum(),y(L,x,O.camera,B,this.type)}O.isPointLightShadow!==!0&&this.type===3&&M(O,x),O.needsUpdate=!1}f=this.type,d.needsUpdate=!1,i.setRenderTarget(T,Y,C)};function M(b,L){const x=e.update(S);u.defines.VSM_SAMPLES!==b.blurSamples&&(u.defines.VSM_SAMPLES=b.blurSamples,_.defines.VSM_SAMPLES=b.blurSamples,u.needsUpdate=!0,_.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new zt(r.x,r.y,{format:1030,type:1016})),u.uniforms.shadow_pass.value=b.map.depthTexture,u.uniforms.resolution.value=b.mapSize,u.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(L,null,x,u,S,null),_.uniforms.shadow_pass.value=b.mapPass.texture,_.uniforms.resolution.value=b.mapSize,_.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(L,null,x,_,S,null)}function A(b,L,x,T){let Y=null;const C=x.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0)Y=C;else if(Y=x.isPointLight===!0?c:o,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const V=Y.uuid,G=L.uuid;let k=l[V];k===void 0&&(k={},l[V]=k);let H=k[G];H===void 0&&(H=Y.clone(),k[G]=H,L.addEventListener("dispose",P)),Y=H}if(Y.visible=L.visible,Y.wireframe=L.wireframe,T===3?Y.side=L.shadowSide!==null?L.shadowSide:L.side:Y.side=L.shadowSide!==null?L.shadowSide:m[L.side],Y.alphaMap=L.alphaMap,Y.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,Y.map=L.map,Y.clipShadows=L.clipShadows,Y.clippingPlanes=L.clippingPlanes,Y.clipIntersection=L.clipIntersection,Y.displacementMap=L.displacementMap,Y.displacementScale=L.displacementScale,Y.displacementBias=L.displacementBias,Y.wireframeLinewidth=L.wireframeLinewidth,Y.linewidth=L.linewidth,x.isPointLight===!0&&Y.isMeshDistanceMaterial===!0){const V=i.properties.get(Y);V.light=x}return Y}function y(b,L,x,T,Y){if(b.visible===!1)return;if(b.layers.test(L.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&Y===3)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,b.matrixWorld);const G=e.update(b),k=b.material;if(Array.isArray(k)){const H=G.groups;for(let B=0,O=H.length;B<O;B++){const Q=H[B],$=k[Q.materialIndex];if($&&$.visible){const ce=A(b,$,T,Y);b.onBeforeShadow(i,b,L,x,G,ce,Q),i.renderBufferDirect(x,null,G,ce,b,Q),b.onAfterShadow(i,b,L,x,G,ce,Q)}}}else if(k.visible){const H=A(b,k,T,Y);b.onBeforeShadow(i,b,L,x,G,H,null),i.renderBufferDirect(x,null,G,H,b,null),b.onAfterShadow(i,b,L,x,G,H,null)}}const V=b.children;for(let G=0,k=V.length;G<k;G++)y(V[G],L,x,T,Y)}function P(b){b.target.removeEventListener("dispose",P);for(const x in l){const T=l[x],Y=b.target.uuid;Y in T&&(T[Y].dispose(),delete T[Y])}}}function Ef(i,e){function t(){let w=!1;const re=new ot;let te=null;const de=new ot(0,0,0,0);return{setMask:function(J){te!==J&&!w&&(i.colorMask(J,J,J,J),te=J)},setLocked:function(J){w=J},setClear:function(J,W,ge,we,et){et===!0&&(J*=we,W*=we,ge*=we),re.set(J,W,ge,we),de.equals(re)===!1&&(i.clearColor(J,W,ge,we),de.copy(re))},reset:function(){w=!1,te=null,de.set(-1,0,0,0)}}}function n(){let w=!1,re=!1,te=null,de=null,J=null;return{setReversed:function(W){if(re!==W){const ge=e.get("EXT_clip_control");W?ge.clipControlEXT(ge.LOWER_LEFT_EXT,ge.ZERO_TO_ONE_EXT):ge.clipControlEXT(ge.LOWER_LEFT_EXT,ge.NEGATIVE_ONE_TO_ONE_EXT),re=W;const we=J;J=null,this.setClear(we)}},getReversed:function(){return re},setTest:function(W){W?ne(i.DEPTH_TEST):se(i.DEPTH_TEST)},setMask:function(W){te!==W&&!w&&(i.depthMask(W),te=W)},setFunc:function(W){if(re&&(W=na[W]),de!==W){switch(W){case 0:i.depthFunc(i.NEVER);break;case 1:i.depthFunc(i.ALWAYS);break;case 2:i.depthFunc(i.LESS);break;case 3:i.depthFunc(i.LEQUAL);break;case 4:i.depthFunc(i.EQUAL);break;case 5:i.depthFunc(i.GEQUAL);break;case 6:i.depthFunc(i.GREATER);break;case 7:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}de=W}},setLocked:function(W){w=W},setClear:function(W){J!==W&&(J=W,re&&(W=1-W),i.clearDepth(W))},reset:function(){w=!1,te=null,de=null,J=null,re=!1}}}function r(){let w=!1,re=null,te=null,de=null,J=null,W=null,ge=null,we=null,et=null;return{setTest:function(qe){w||(qe?ne(i.STENCIL_TEST):se(i.STENCIL_TEST))},setMask:function(qe){re!==qe&&!w&&(i.stencilMask(qe),re=qe)},setFunc:function(qe,kt,Wt){(te!==qe||de!==kt||J!==Wt)&&(i.stencilFunc(qe,kt,Wt),te=qe,de=kt,J=Wt)},setOp:function(qe,kt,Wt){(W!==qe||ge!==kt||we!==Wt)&&(i.stencilOp(qe,kt,Wt),W=qe,ge=kt,we=Wt)},setLocked:function(qe){w=qe},setClear:function(qe){et!==qe&&(i.clearStencil(qe),et=qe)},reset:function(){w=!1,re=null,te=null,de=null,J=null,W=null,ge=null,we=null,et=null}}}const s=new t,a=new n,o=new r,c=new WeakMap,l=new WeakMap;let h={},m={},u=new WeakMap,_=[],g=null,S=!1,d=null,f=null,M=null,A=null,y=null,P=null,b=null,L=new We(0,0,0),x=0,T=!1,Y=null,C=null,V=null,G=null,k=null;const H=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,O=0;const Q=i.getParameter(i.VERSION);Q.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(Q)[1]),B=O>=1):Q.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),B=O>=2);let $=null,ce={};const pe=i.getParameter(i.SCISSOR_BOX),fe=i.getParameter(i.VIEWPORT),Fe=new ot().fromArray(pe),nt=new ot().fromArray(fe);function tt(w,re,te,de){const J=new Uint8Array(4),W=i.createTexture();i.bindTexture(w,W),i.texParameteri(w,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(w,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ge=0;ge<te;ge++)w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY?i.texImage3D(re,0,i.RGBA,1,1,de,0,i.RGBA,i.UNSIGNED_BYTE,J):i.texImage2D(re+ge,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,J);return W}const K={};K[i.TEXTURE_2D]=tt(i.TEXTURE_2D,i.TEXTURE_2D,1),K[i.TEXTURE_CUBE_MAP]=tt(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),K[i.TEXTURE_2D_ARRAY]=tt(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),K[i.TEXTURE_3D]=tt(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ne(i.DEPTH_TEST),a.setFunc(3),Ie(!1),st(1),ne(i.CULL_FACE),Xe(0);function ne(w){h[w]!==!0&&(i.enable(w),h[w]=!0)}function se(w){h[w]!==!1&&(i.disable(w),h[w]=!1)}function De(w,re){return m[w]!==re?(i.bindFramebuffer(w,re),m[w]=re,w===i.DRAW_FRAMEBUFFER&&(m[i.FRAMEBUFFER]=re),w===i.FRAMEBUFFER&&(m[i.DRAW_FRAMEBUFFER]=re),!0):!1}function Ae(w,re){let te=_,de=!1;if(w){te=u.get(re),te===void 0&&(te=[],u.set(re,te));const J=w.textures;if(te.length!==J.length||te[0]!==i.COLOR_ATTACHMENT0){for(let W=0,ge=J.length;W<ge;W++)te[W]=i.COLOR_ATTACHMENT0+W;te.length=J.length,de=!0}}else te[0]!==i.BACK&&(te[0]=i.BACK,de=!0);de&&i.drawBuffers(te)}function Ce(w){return g!==w?(i.useProgram(w),g=w,!0):!1}const ht={100:i.FUNC_ADD,101:i.FUNC_SUBTRACT,102:i.FUNC_REVERSE_SUBTRACT};ht[103]=i.MIN,ht[104]=i.MAX;const Ge={200:i.ZERO,201:i.ONE,202:i.SRC_COLOR,204:i.SRC_ALPHA,210:i.SRC_ALPHA_SATURATE,208:i.DST_COLOR,206:i.DST_ALPHA,203:i.ONE_MINUS_SRC_COLOR,205:i.ONE_MINUS_SRC_ALPHA,209:i.ONE_MINUS_DST_COLOR,207:i.ONE_MINUS_DST_ALPHA,211:i.CONSTANT_COLOR,212:i.ONE_MINUS_CONSTANT_COLOR,213:i.CONSTANT_ALPHA,214:i.ONE_MINUS_CONSTANT_ALPHA};function Xe(w,re,te,de,J,W,ge,we,et,qe){if(w===0){S===!0&&(se(i.BLEND),S=!1);return}if(S===!1&&(ne(i.BLEND),S=!0),w!==5){if(w!==d||qe!==T){if((f!==100||y!==100)&&(i.blendEquation(i.FUNC_ADD),f=100,y=100),qe)switch(w){case 1:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFunc(i.ONE,i.ONE);break;case 3:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case 4:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:He("WebGLState: Invalid blending: ",w);break}else switch(w){case 1:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case 3:He("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:He("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:He("WebGLState: Invalid blending: ",w);break}M=null,A=null,P=null,b=null,L.set(0,0,0),x=0,d=w,T=qe}return}J=J||re,W=W||te,ge=ge||de,(re!==f||J!==y)&&(i.blendEquationSeparate(ht[re],ht[J]),f=re,y=J),(te!==M||de!==A||W!==P||ge!==b)&&(i.blendFuncSeparate(Ge[te],Ge[de],Ge[W],Ge[ge]),M=te,A=de,P=W,b=ge),(we.equals(L)===!1||et!==x)&&(i.blendColor(we.r,we.g,we.b,et),L.copy(we),x=et),d=w,T=!1}function je(w,re){w.side===2?se(i.CULL_FACE):ne(i.CULL_FACE);let te=w.side===1;re&&(te=!te),Ie(te),w.blending===1&&w.transparent===!1?Xe(0):Xe(w.blending,w.blendEquation,w.blendSrc,w.blendDst,w.blendEquationAlpha,w.blendSrcAlpha,w.blendDstAlpha,w.blendColor,w.blendAlpha,w.premultipliedAlpha),a.setFunc(w.depthFunc),a.setTest(w.depthTest),a.setMask(w.depthWrite),s.setMask(w.colorWrite);const de=w.stencilWrite;o.setTest(de),de&&(o.setMask(w.stencilWriteMask),o.setFunc(w.stencilFunc,w.stencilRef,w.stencilFuncMask),o.setOp(w.stencilFail,w.stencilZFail,w.stencilZPass)),lt(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits),w.alphaToCoverage===!0?ne(i.SAMPLE_ALPHA_TO_COVERAGE):se(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ie(w){Y!==w&&(w?i.frontFace(i.CW):i.frontFace(i.CCW),Y=w)}function st(w){w!==0?(ne(i.CULL_FACE),w!==C&&(w===1?i.cullFace(i.BACK):w===2?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):se(i.CULL_FACE),C=w}function R(w){w!==V&&(B&&i.lineWidth(w),V=w)}function lt(w,re,te){w?(ne(i.POLYGON_OFFSET_FILL),(G!==re||k!==te)&&(G=re,k=te,a.getReversed()&&(re=-re),i.polygonOffset(re,te))):se(i.POLYGON_OFFSET_FILL)}function ke(w){w?ne(i.SCISSOR_TEST):se(i.SCISSOR_TEST)}function Qe(w){w===void 0&&(w=i.TEXTURE0+H-1),$!==w&&(i.activeTexture(w),$=w)}function Se(w,re,te){te===void 0&&($===null?te=i.TEXTURE0+H-1:te=$);let de=ce[te];de===void 0&&(de={type:void 0,texture:void 0},ce[te]=de),(de.type!==w||de.texture!==re)&&($!==te&&(i.activeTexture(te),$=te),i.bindTexture(w,re||K[w]),de.type=w,de.texture=re)}function E(){const w=ce[$];w!==void 0&&w.type!==void 0&&(i.bindTexture(w.type,null),w.type=void 0,w.texture=void 0)}function p(){try{i.compressedTexImage2D(...arguments)}catch(w){He("WebGLState:",w)}}function D(){try{i.compressedTexImage3D(...arguments)}catch(w){He("WebGLState:",w)}}function q(){try{i.texSubImage2D(...arguments)}catch(w){He("WebGLState:",w)}}function Z(){try{i.texSubImage3D(...arguments)}catch(w){He("WebGLState:",w)}}function X(){try{i.compressedTexSubImage2D(...arguments)}catch(w){He("WebGLState:",w)}}function me(){try{i.compressedTexSubImage3D(...arguments)}catch(w){He("WebGLState:",w)}}function ie(){try{i.texStorage2D(...arguments)}catch(w){He("WebGLState:",w)}}function ye(){try{i.texStorage3D(...arguments)}catch(w){He("WebGLState:",w)}}function be(){try{i.texImage2D(...arguments)}catch(w){He("WebGLState:",w)}}function j(){try{i.texImage3D(...arguments)}catch(w){He("WebGLState:",w)}}function ee(w){Fe.equals(w)===!1&&(i.scissor(w.x,w.y,w.z,w.w),Fe.copy(w))}function _e(w){nt.equals(w)===!1&&(i.viewport(w.x,w.y,w.z,w.w),nt.copy(w))}function xe(w,re){let te=l.get(re);te===void 0&&(te=new WeakMap,l.set(re,te));let de=te.get(w);de===void 0&&(de=i.getUniformBlockIndex(re,w.name),te.set(w,de))}function ue(w,re){const de=l.get(re).get(w);c.get(re)!==de&&(i.uniformBlockBinding(re,de,w.__bindingPointIndex),c.set(re,de))}function Ne(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},$=null,ce={},m={},u=new WeakMap,_=[],g=null,S=!1,d=null,f=null,M=null,A=null,y=null,P=null,b=null,L=new We(0,0,0),x=0,T=!1,Y=null,C=null,V=null,G=null,k=null,Fe.set(0,0,i.canvas.width,i.canvas.height),nt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ne,disable:se,bindFramebuffer:De,drawBuffers:Ae,useProgram:Ce,setBlending:Xe,setMaterial:je,setFlipSided:Ie,setCullFace:st,setLineWidth:R,setPolygonOffset:lt,setScissorTest:ke,activeTexture:Qe,bindTexture:Se,unbindTexture:E,compressedTexImage2D:p,compressedTexImage3D:D,texImage2D:be,texImage3D:j,updateUBOMapping:xe,uniformBlockBinding:ue,texStorage2D:ie,texStorage3D:ye,texSubImage2D:q,texSubImage3D:Z,compressedTexSubImage2D:X,compressedTexSubImage3D:me,scissor:ee,viewport:_e,reset:Ne}}function Tf(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new $e,h=new WeakMap;let m;const u=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(E,p){return _?new OffscreenCanvas(E,p):Di("canvas")}function S(E,p,D){let q=1;const Z=Se(E);if((Z.width>D||Z.height>D)&&(q=D/Math.max(Z.width,Z.height)),q<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const X=Math.floor(q*Z.width),me=Math.floor(q*Z.height);m===void 0&&(m=g(X,me));const ie=p?g(X,me):m;return ie.width=X,ie.height=me,ie.getContext("2d").drawImage(E,0,0,X,me),Re("WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+X+"x"+me+")."),ie}else return"data"in E&&Re("WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),E;return E}function d(E){return E.generateMipmaps}function f(E){i.generateMipmap(E)}function M(E){return E.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?i.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function A(E,p,D,q,Z=!1){if(E!==null){if(i[E]!==void 0)return i[E];Re("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let X=p;if(p===i.RED&&(D===i.FLOAT&&(X=i.R32F),D===i.HALF_FLOAT&&(X=i.R16F),D===i.UNSIGNED_BYTE&&(X=i.R8)),p===i.RED_INTEGER&&(D===i.UNSIGNED_BYTE&&(X=i.R8UI),D===i.UNSIGNED_SHORT&&(X=i.R16UI),D===i.UNSIGNED_INT&&(X=i.R32UI),D===i.BYTE&&(X=i.R8I),D===i.SHORT&&(X=i.R16I),D===i.INT&&(X=i.R32I)),p===i.RG&&(D===i.FLOAT&&(X=i.RG32F),D===i.HALF_FLOAT&&(X=i.RG16F),D===i.UNSIGNED_BYTE&&(X=i.RG8)),p===i.RG_INTEGER&&(D===i.UNSIGNED_BYTE&&(X=i.RG8UI),D===i.UNSIGNED_SHORT&&(X=i.RG16UI),D===i.UNSIGNED_INT&&(X=i.RG32UI),D===i.BYTE&&(X=i.RG8I),D===i.SHORT&&(X=i.RG16I),D===i.INT&&(X=i.RG32I)),p===i.RGB_INTEGER&&(D===i.UNSIGNED_BYTE&&(X=i.RGB8UI),D===i.UNSIGNED_SHORT&&(X=i.RGB16UI),D===i.UNSIGNED_INT&&(X=i.RGB32UI),D===i.BYTE&&(X=i.RGB8I),D===i.SHORT&&(X=i.RGB16I),D===i.INT&&(X=i.RGB32I)),p===i.RGBA_INTEGER&&(D===i.UNSIGNED_BYTE&&(X=i.RGBA8UI),D===i.UNSIGNED_SHORT&&(X=i.RGBA16UI),D===i.UNSIGNED_INT&&(X=i.RGBA32UI),D===i.BYTE&&(X=i.RGBA8I),D===i.SHORT&&(X=i.RGBA16I),D===i.INT&&(X=i.RGBA32I)),p===i.RGB&&(D===i.UNSIGNED_INT_5_9_9_9_REV&&(X=i.RGB9_E5),D===i.UNSIGNED_INT_10F_11F_11F_REV&&(X=i.R11F_G11F_B10F)),p===i.RGBA){const me=Z?Pi:ze.getTransfer(q);D===i.FLOAT&&(X=i.RGBA32F),D===i.HALF_FLOAT&&(X=i.RGBA16F),D===i.UNSIGNED_BYTE&&(X=me===Ye?i.SRGB8_ALPHA8:i.RGBA8),D===i.UNSIGNED_SHORT_4_4_4_4&&(X=i.RGBA4),D===i.UNSIGNED_SHORT_5_5_5_1&&(X=i.RGB5_A1)}return(X===i.R16F||X===i.R32F||X===i.RG16F||X===i.RG32F||X===i.RGBA16F||X===i.RGBA32F)&&e.get("EXT_color_buffer_float"),X}function y(E,p){let D;return E?p===null||p===1014||p===1020?D=i.DEPTH24_STENCIL8:p===1015?D=i.DEPTH32F_STENCIL8:p===1012&&(D=i.DEPTH24_STENCIL8,Re("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):p===null||p===1014||p===1020?D=i.DEPTH_COMPONENT24:p===1015?D=i.DEPTH_COMPONENT32F:p===1012&&(D=i.DEPTH_COMPONENT16),D}function P(E,p){return d(E)===!0||E.isFramebufferTexture&&E.minFilter!==1003&&E.minFilter!==1006?Math.log2(Math.max(p.width,p.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?p.mipmaps.length:1}function b(E){const p=E.target;p.removeEventListener("dispose",b),x(p),p.isVideoTexture&&h.delete(p)}function L(E){const p=E.target;p.removeEventListener("dispose",L),Y(p)}function x(E){const p=n.get(E);if(p.__webglInit===void 0)return;const D=E.source,q=u.get(D);if(q){const Z=q[p.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&T(E),Object.keys(q).length===0&&u.delete(D)}n.remove(E)}function T(E){const p=n.get(E);i.deleteTexture(p.__webglTexture);const D=E.source,q=u.get(D);delete q[p.__cacheKey],a.memory.textures--}function Y(E){const p=n.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),n.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let q=0;q<6;q++){if(Array.isArray(p.__webglFramebuffer[q]))for(let Z=0;Z<p.__webglFramebuffer[q].length;Z++)i.deleteFramebuffer(p.__webglFramebuffer[q][Z]);else i.deleteFramebuffer(p.__webglFramebuffer[q]);p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer[q])}else{if(Array.isArray(p.__webglFramebuffer))for(let q=0;q<p.__webglFramebuffer.length;q++)i.deleteFramebuffer(p.__webglFramebuffer[q]);else i.deleteFramebuffer(p.__webglFramebuffer);if(p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer),p.__webglMultisampledFramebuffer&&i.deleteFramebuffer(p.__webglMultisampledFramebuffer),p.__webglColorRenderbuffer)for(let q=0;q<p.__webglColorRenderbuffer.length;q++)p.__webglColorRenderbuffer[q]&&i.deleteRenderbuffer(p.__webglColorRenderbuffer[q]);p.__webglDepthRenderbuffer&&i.deleteRenderbuffer(p.__webglDepthRenderbuffer)}const D=E.textures;for(let q=0,Z=D.length;q<Z;q++){const X=n.get(D[q]);X.__webglTexture&&(i.deleteTexture(X.__webglTexture),a.memory.textures--),n.remove(D[q])}n.remove(E)}let C=0;function V(){C=0}function G(){const E=C;return E>=r.maxTextures&&Re("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),C+=1,E}function k(E){const p=[];return p.push(E.wrapS),p.push(E.wrapT),p.push(E.wrapR||0),p.push(E.magFilter),p.push(E.minFilter),p.push(E.anisotropy),p.push(E.internalFormat),p.push(E.format),p.push(E.type),p.push(E.generateMipmaps),p.push(E.premultiplyAlpha),p.push(E.flipY),p.push(E.unpackAlignment),p.push(E.colorSpace),p.join()}function H(E,p){const D=n.get(E);if(E.isVideoTexture&&ke(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&D.__version!==E.version){const q=E.image;if(q===null)Re("WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)Re("WebGLRenderer: Texture marked for update but image is incomplete");else{K(D,E,p);return}}else E.isExternalTexture&&(D.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,D.__webglTexture,i.TEXTURE0+p)}function B(E,p){const D=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&D.__version!==E.version){K(D,E,p);return}else E.isExternalTexture&&(D.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,D.__webglTexture,i.TEXTURE0+p)}function O(E,p){const D=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&D.__version!==E.version){K(D,E,p);return}t.bindTexture(i.TEXTURE_3D,D.__webglTexture,i.TEXTURE0+p)}function Q(E,p){const D=n.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&D.__version!==E.version){ne(D,E,p);return}t.bindTexture(i.TEXTURE_CUBE_MAP,D.__webglTexture,i.TEXTURE0+p)}const $={1e3:i.REPEAT,1001:i.CLAMP_TO_EDGE,1002:i.MIRRORED_REPEAT},ce={1003:i.NEAREST,1004:i.NEAREST_MIPMAP_NEAREST,1005:i.NEAREST_MIPMAP_LINEAR,1006:i.LINEAR,1007:i.LINEAR_MIPMAP_NEAREST,1008:i.LINEAR_MIPMAP_LINEAR},pe={512:i.NEVER,519:i.ALWAYS,513:i.LESS,515:i.LEQUAL,514:i.EQUAL,518:i.GEQUAL,516:i.GREATER,517:i.NOTEQUAL};function fe(E,p){if(p.type===1015&&e.has("OES_texture_float_linear")===!1&&(p.magFilter===1006||p.magFilter===1007||p.magFilter===1005||p.magFilter===1008||p.minFilter===1006||p.minFilter===1007||p.minFilter===1005||p.minFilter===1008)&&Re("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(E,i.TEXTURE_WRAP_S,$[p.wrapS]),i.texParameteri(E,i.TEXTURE_WRAP_T,$[p.wrapT]),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,$[p.wrapR]),i.texParameteri(E,i.TEXTURE_MAG_FILTER,ce[p.magFilter]),i.texParameteri(E,i.TEXTURE_MIN_FILTER,ce[p.minFilter]),p.compareFunction&&(i.texParameteri(E,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(E,i.TEXTURE_COMPARE_FUNC,pe[p.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(p.magFilter===1003||p.minFilter!==1005&&p.minFilter!==1008||p.type===1015&&e.has("OES_texture_float_linear")===!1)return;if(p.anisotropy>1||n.get(p).__currentAnisotropy){const D=e.get("EXT_texture_filter_anisotropic");i.texParameterf(E,D.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(p.anisotropy,r.getMaxAnisotropy())),n.get(p).__currentAnisotropy=p.anisotropy}}}function Fe(E,p){let D=!1;E.__webglInit===void 0&&(E.__webglInit=!0,p.addEventListener("dispose",b));const q=p.source;let Z=u.get(q);Z===void 0&&(Z={},u.set(q,Z));const X=k(p);if(X!==E.__cacheKey){Z[X]===void 0&&(Z[X]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,D=!0),Z[X].usedTimes++;const me=Z[E.__cacheKey];me!==void 0&&(Z[E.__cacheKey].usedTimes--,me.usedTimes===0&&T(p)),E.__cacheKey=X,E.__webglTexture=Z[X].texture}return D}function nt(E,p,D){return Math.floor(Math.floor(E/D)/p)}function tt(E,p,D,q){const X=E.updateRanges;if(X.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,p.width,p.height,D,q,p.data);else{X.sort((j,ee)=>j.start-ee.start);let me=0;for(let j=1;j<X.length;j++){const ee=X[me],_e=X[j],xe=ee.start+ee.count,ue=nt(_e.start,p.width,4),Ne=nt(ee.start,p.width,4);_e.start<=xe+1&&ue===Ne&&nt(_e.start+_e.count-1,p.width,4)===ue?ee.count=Math.max(ee.count,_e.start+_e.count-ee.start):(++me,X[me]=_e)}X.length=me+1;const ie=i.getParameter(i.UNPACK_ROW_LENGTH),ye=i.getParameter(i.UNPACK_SKIP_PIXELS),be=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,p.width);for(let j=0,ee=X.length;j<ee;j++){const _e=X[j],xe=Math.floor(_e.start/4),ue=Math.ceil(_e.count/4),Ne=xe%p.width,w=Math.floor(xe/p.width),re=ue,te=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,Ne),i.pixelStorei(i.UNPACK_SKIP_ROWS,w),t.texSubImage2D(i.TEXTURE_2D,0,Ne,w,re,te,D,q,p.data)}E.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,ie),i.pixelStorei(i.UNPACK_SKIP_PIXELS,ye),i.pixelStorei(i.UNPACK_SKIP_ROWS,be)}}function K(E,p,D){let q=i.TEXTURE_2D;(p.isDataArrayTexture||p.isCompressedArrayTexture)&&(q=i.TEXTURE_2D_ARRAY),p.isData3DTexture&&(q=i.TEXTURE_3D);const Z=Fe(E,p),X=p.source;t.bindTexture(q,E.__webglTexture,i.TEXTURE0+D);const me=n.get(X);if(X.version!==me.__version||Z===!0){t.activeTexture(i.TEXTURE0+D);const ie=ze.getPrimaries(ze.workingColorSpace),ye=p.colorSpace===""?null:ze.getPrimaries(p.colorSpace),be=p.colorSpace===""||ie===ye?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,be);let j=S(p.image,!1,r.maxTextureSize);j=Qe(p,j);const ee=s.convert(p.format,p.colorSpace),_e=s.convert(p.type);let xe=A(p.internalFormat,ee,_e,p.colorSpace,p.isVideoTexture);fe(q,p);let ue;const Ne=p.mipmaps,w=p.isVideoTexture!==!0,re=me.__version===void 0||Z===!0,te=X.dataReady,de=P(p,j);if(p.isDepthTexture)xe=y(p.format===1027,p.type),re&&(w?t.texStorage2D(i.TEXTURE_2D,1,xe,j.width,j.height):t.texImage2D(i.TEXTURE_2D,0,xe,j.width,j.height,0,ee,_e,null));else if(p.isDataTexture)if(Ne.length>0){w&&re&&t.texStorage2D(i.TEXTURE_2D,de,xe,Ne[0].width,Ne[0].height);for(let J=0,W=Ne.length;J<W;J++)ue=Ne[J],w?te&&t.texSubImage2D(i.TEXTURE_2D,J,0,0,ue.width,ue.height,ee,_e,ue.data):t.texImage2D(i.TEXTURE_2D,J,xe,ue.width,ue.height,0,ee,_e,ue.data);p.generateMipmaps=!1}else w?(re&&t.texStorage2D(i.TEXTURE_2D,de,xe,j.width,j.height),te&&tt(p,j,ee,_e)):t.texImage2D(i.TEXTURE_2D,0,xe,j.width,j.height,0,ee,_e,j.data);else if(p.isCompressedTexture)if(p.isCompressedArrayTexture){w&&re&&t.texStorage3D(i.TEXTURE_2D_ARRAY,de,xe,Ne[0].width,Ne[0].height,j.depth);for(let J=0,W=Ne.length;J<W;J++)if(ue=Ne[J],p.format!==1023)if(ee!==null)if(w){if(te)if(p.layerUpdates.size>0){const ge=is(ue.width,ue.height,p.format,p.type);for(const we of p.layerUpdates){const et=ue.data.subarray(we*ge/ue.data.BYTES_PER_ELEMENT,(we+1)*ge/ue.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,we,ue.width,ue.height,1,ee,et)}p.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,ue.width,ue.height,j.depth,ee,ue.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,J,xe,ue.width,ue.height,j.depth,0,ue.data,0,0);else Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else w?te&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,ue.width,ue.height,j.depth,ee,_e,ue.data):t.texImage3D(i.TEXTURE_2D_ARRAY,J,xe,ue.width,ue.height,j.depth,0,ee,_e,ue.data)}else{w&&re&&t.texStorage2D(i.TEXTURE_2D,de,xe,Ne[0].width,Ne[0].height);for(let J=0,W=Ne.length;J<W;J++)ue=Ne[J],p.format!==1023?ee!==null?w?te&&t.compressedTexSubImage2D(i.TEXTURE_2D,J,0,0,ue.width,ue.height,ee,ue.data):t.compressedTexImage2D(i.TEXTURE_2D,J,xe,ue.width,ue.height,0,ue.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):w?te&&t.texSubImage2D(i.TEXTURE_2D,J,0,0,ue.width,ue.height,ee,_e,ue.data):t.texImage2D(i.TEXTURE_2D,J,xe,ue.width,ue.height,0,ee,_e,ue.data)}else if(p.isDataArrayTexture)if(w){if(re&&t.texStorage3D(i.TEXTURE_2D_ARRAY,de,xe,j.width,j.height,j.depth),te)if(p.layerUpdates.size>0){const J=is(j.width,j.height,p.format,p.type);for(const W of p.layerUpdates){const ge=j.data.subarray(W*J/j.data.BYTES_PER_ELEMENT,(W+1)*J/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,W,j.width,j.height,1,ee,_e,ge)}p.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,ee,_e,j.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,xe,j.width,j.height,j.depth,0,ee,_e,j.data);else if(p.isData3DTexture)w?(re&&t.texStorage3D(i.TEXTURE_3D,de,xe,j.width,j.height,j.depth),te&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,ee,_e,j.data)):t.texImage3D(i.TEXTURE_3D,0,xe,j.width,j.height,j.depth,0,ee,_e,j.data);else if(p.isFramebufferTexture){if(re)if(w)t.texStorage2D(i.TEXTURE_2D,de,xe,j.width,j.height);else{let J=j.width,W=j.height;for(let ge=0;ge<de;ge++)t.texImage2D(i.TEXTURE_2D,ge,xe,J,W,0,ee,_e,null),J>>=1,W>>=1}}else if(Ne.length>0){if(w&&re){const J=Se(Ne[0]);t.texStorage2D(i.TEXTURE_2D,de,xe,J.width,J.height)}for(let J=0,W=Ne.length;J<W;J++)ue=Ne[J],w?te&&t.texSubImage2D(i.TEXTURE_2D,J,0,0,ee,_e,ue):t.texImage2D(i.TEXTURE_2D,J,xe,ee,_e,ue);p.generateMipmaps=!1}else if(w){if(re){const J=Se(j);t.texStorage2D(i.TEXTURE_2D,de,xe,J.width,J.height)}te&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ee,_e,j)}else t.texImage2D(i.TEXTURE_2D,0,xe,ee,_e,j);d(p)&&f(q),me.__version=X.version,p.onUpdate&&p.onUpdate(p)}E.__version=p.version}function ne(E,p,D){if(p.image.length!==6)return;const q=Fe(E,p),Z=p.source;t.bindTexture(i.TEXTURE_CUBE_MAP,E.__webglTexture,i.TEXTURE0+D);const X=n.get(Z);if(Z.version!==X.__version||q===!0){t.activeTexture(i.TEXTURE0+D);const me=ze.getPrimaries(ze.workingColorSpace),ie=p.colorSpace===""?null:ze.getPrimaries(p.colorSpace),ye=p.colorSpace===""||me===ie?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);const be=p.isCompressedTexture||p.image[0].isCompressedTexture,j=p.image[0]&&p.image[0].isDataTexture,ee=[];for(let W=0;W<6;W++)!be&&!j?ee[W]=S(p.image[W],!0,r.maxCubemapSize):ee[W]=j?p.image[W].image:p.image[W],ee[W]=Qe(p,ee[W]);const _e=ee[0],xe=s.convert(p.format,p.colorSpace),ue=s.convert(p.type),Ne=A(p.internalFormat,xe,ue,p.colorSpace),w=p.isVideoTexture!==!0,re=X.__version===void 0||q===!0,te=Z.dataReady;let de=P(p,_e);fe(i.TEXTURE_CUBE_MAP,p);let J;if(be){w&&re&&t.texStorage2D(i.TEXTURE_CUBE_MAP,de,Ne,_e.width,_e.height);for(let W=0;W<6;W++){J=ee[W].mipmaps;for(let ge=0;ge<J.length;ge++){const we=J[ge];p.format!==1023?xe!==null?w?te&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge,0,0,we.width,we.height,xe,we.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge,Ne,we.width,we.height,0,we.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):w?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge,0,0,we.width,we.height,xe,ue,we.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge,Ne,we.width,we.height,0,xe,ue,we.data)}}}else{if(J=p.mipmaps,w&&re){J.length>0&&de++;const W=Se(ee[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,de,Ne,W.width,W.height)}for(let W=0;W<6;W++)if(j){w?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,ee[W].width,ee[W].height,xe,ue,ee[W].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,Ne,ee[W].width,ee[W].height,0,xe,ue,ee[W].data);for(let ge=0;ge<J.length;ge++){const et=J[ge].image[W].image;w?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge+1,0,0,et.width,et.height,xe,ue,et.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge+1,Ne,et.width,et.height,0,xe,ue,et.data)}}else{w?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,xe,ue,ee[W]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,Ne,xe,ue,ee[W]);for(let ge=0;ge<J.length;ge++){const we=J[ge];w?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge+1,0,0,xe,ue,we.image[W]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,ge+1,Ne,xe,ue,we.image[W])}}}d(p)&&f(i.TEXTURE_CUBE_MAP),X.__version=Z.version,p.onUpdate&&p.onUpdate(p)}E.__version=p.version}function se(E,p,D,q,Z,X){const me=s.convert(D.format,D.colorSpace),ie=s.convert(D.type),ye=A(D.internalFormat,me,ie,D.colorSpace),be=n.get(p),j=n.get(D);if(j.__renderTarget=p,!be.__hasExternalTextures){const ee=Math.max(1,p.width>>X),_e=Math.max(1,p.height>>X);Z===i.TEXTURE_3D||Z===i.TEXTURE_2D_ARRAY?t.texImage3D(Z,X,ye,ee,_e,p.depth,0,me,ie,null):t.texImage2D(Z,X,ye,ee,_e,0,me,ie,null)}t.bindFramebuffer(i.FRAMEBUFFER,E),lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,q,Z,j.__webglTexture,0,R(p)):(Z===i.TEXTURE_2D||Z>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,q,Z,j.__webglTexture,X),t.bindFramebuffer(i.FRAMEBUFFER,null)}function De(E,p,D){if(i.bindRenderbuffer(i.RENDERBUFFER,E),p.depthBuffer){const q=p.depthTexture,Z=q&&q.isDepthTexture?q.type:null,X=y(p.stencilBuffer,Z),me=p.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(p),X,p.width,p.height):D?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(p),X,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,X,p.width,p.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,me,i.RENDERBUFFER,E)}else{const q=p.textures;for(let Z=0;Z<q.length;Z++){const X=q[Z],me=s.convert(X.format,X.colorSpace),ie=s.convert(X.type),ye=A(X.internalFormat,me,ie,X.colorSpace);lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(p),ye,p.width,p.height):D?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(p),ye,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,ye,p.width,p.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ae(E,p,D){const q=p.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,E),!(p.depthTexture&&p.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Z=n.get(p.depthTexture);if(Z.__renderTarget=p,(!Z.__webglTexture||p.depthTexture.image.width!==p.width||p.depthTexture.image.height!==p.height)&&(p.depthTexture.image.width=p.width,p.depthTexture.image.height=p.height,p.depthTexture.needsUpdate=!0),q){if(Z.__webglInit===void 0&&(Z.__webglInit=!0,p.depthTexture.addEventListener("dispose",b)),Z.__webglTexture===void 0){Z.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),fe(i.TEXTURE_CUBE_MAP,p.depthTexture);const be=s.convert(p.depthTexture.format),j=s.convert(p.depthTexture.type);let ee;p.depthTexture.format===1026?ee=i.DEPTH_COMPONENT24:p.depthTexture.format===1027&&(ee=i.DEPTH24_STENCIL8);for(let _e=0;_e<6;_e++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,ee,p.width,p.height,0,be,j,null)}}else H(p.depthTexture,0);const X=Z.__webglTexture,me=R(p),ie=q?i.TEXTURE_CUBE_MAP_POSITIVE_X+D:i.TEXTURE_2D,ye=p.depthTexture.format===1027?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(p.depthTexture.format===1026)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,ye,ie,X,0,me):i.framebufferTexture2D(i.FRAMEBUFFER,ye,ie,X,0);else if(p.depthTexture.format===1027)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,ye,ie,X,0,me):i.framebufferTexture2D(i.FRAMEBUFFER,ye,ie,X,0);else throw new Error("Unknown depthTexture format")}function Ce(E){const p=n.get(E),D=E.isWebGLCubeRenderTarget===!0;if(p.__boundDepthTexture!==E.depthTexture){const q=E.depthTexture;if(p.__depthDisposeCallback&&p.__depthDisposeCallback(),q){const Z=()=>{delete p.__boundDepthTexture,delete p.__depthDisposeCallback,q.removeEventListener("dispose",Z)};q.addEventListener("dispose",Z),p.__depthDisposeCallback=Z}p.__boundDepthTexture=q}if(E.depthTexture&&!p.__autoAllocateDepthBuffer)if(D)for(let q=0;q<6;q++)Ae(p.__webglFramebuffer[q],E,q);else{const q=E.texture.mipmaps;q&&q.length>0?Ae(p.__webglFramebuffer[0],E,0):Ae(p.__webglFramebuffer,E,0)}else if(D){p.__webglDepthbuffer=[];for(let q=0;q<6;q++)if(t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[q]),p.__webglDepthbuffer[q]===void 0)p.__webglDepthbuffer[q]=i.createRenderbuffer(),De(p.__webglDepthbuffer[q],E,!1);else{const Z=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,X=p.__webglDepthbuffer[q];i.bindRenderbuffer(i.RENDERBUFFER,X),i.framebufferRenderbuffer(i.FRAMEBUFFER,Z,i.RENDERBUFFER,X)}}else{const q=E.texture.mipmaps;if(q&&q.length>0?t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer),p.__webglDepthbuffer===void 0)p.__webglDepthbuffer=i.createRenderbuffer(),De(p.__webglDepthbuffer,E,!1);else{const Z=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,X=p.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,X),i.framebufferRenderbuffer(i.FRAMEBUFFER,Z,i.RENDERBUFFER,X)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ht(E,p,D){const q=n.get(E);p!==void 0&&se(q.__webglFramebuffer,E,E.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),D!==void 0&&Ce(E)}function Ge(E){const p=E.texture,D=n.get(E),q=n.get(p);E.addEventListener("dispose",L);const Z=E.textures,X=E.isWebGLCubeRenderTarget===!0,me=Z.length>1;if(me||(q.__webglTexture===void 0&&(q.__webglTexture=i.createTexture()),q.__version=p.version,a.memory.textures++),X){D.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(p.mipmaps&&p.mipmaps.length>0){D.__webglFramebuffer[ie]=[];for(let ye=0;ye<p.mipmaps.length;ye++)D.__webglFramebuffer[ie][ye]=i.createFramebuffer()}else D.__webglFramebuffer[ie]=i.createFramebuffer()}else{if(p.mipmaps&&p.mipmaps.length>0){D.__webglFramebuffer=[];for(let ie=0;ie<p.mipmaps.length;ie++)D.__webglFramebuffer[ie]=i.createFramebuffer()}else D.__webglFramebuffer=i.createFramebuffer();if(me)for(let ie=0,ye=Z.length;ie<ye;ie++){const be=n.get(Z[ie]);be.__webglTexture===void 0&&(be.__webglTexture=i.createTexture(),a.memory.textures++)}if(E.samples>0&<(E)===!1){D.__webglMultisampledFramebuffer=i.createFramebuffer(),D.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,D.__webglMultisampledFramebuffer);for(let ie=0;ie<Z.length;ie++){const ye=Z[ie];D.__webglColorRenderbuffer[ie]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,D.__webglColorRenderbuffer[ie]);const be=s.convert(ye.format,ye.colorSpace),j=s.convert(ye.type),ee=A(ye.internalFormat,be,j,ye.colorSpace,E.isXRRenderTarget===!0),_e=R(E);i.renderbufferStorageMultisample(i.RENDERBUFFER,_e,ee,E.width,E.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ie,i.RENDERBUFFER,D.__webglColorRenderbuffer[ie])}i.bindRenderbuffer(i.RENDERBUFFER,null),E.depthBuffer&&(D.__webglDepthRenderbuffer=i.createRenderbuffer(),De(D.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(X){t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),fe(i.TEXTURE_CUBE_MAP,p);for(let ie=0;ie<6;ie++)if(p.mipmaps&&p.mipmaps.length>0)for(let ye=0;ye<p.mipmaps.length;ye++)se(D.__webglFramebuffer[ie][ye],E,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ie,ye);else se(D.__webglFramebuffer[ie],E,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0);d(p)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(me){for(let ie=0,ye=Z.length;ie<ye;ie++){const be=Z[ie],j=n.get(be);let ee=i.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(ee=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ee,j.__webglTexture),fe(ee,be),se(D.__webglFramebuffer,E,be,i.COLOR_ATTACHMENT0+ie,ee,0),d(be)&&f(ee)}t.unbindTexture()}else{let ie=i.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(ie=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ie,q.__webglTexture),fe(ie,p),p.mipmaps&&p.mipmaps.length>0)for(let ye=0;ye<p.mipmaps.length;ye++)se(D.__webglFramebuffer[ye],E,p,i.COLOR_ATTACHMENT0,ie,ye);else se(D.__webglFramebuffer,E,p,i.COLOR_ATTACHMENT0,ie,0);d(p)&&f(ie),t.unbindTexture()}E.depthBuffer&&Ce(E)}function Xe(E){const p=E.textures;for(let D=0,q=p.length;D<q;D++){const Z=p[D];if(d(Z)){const X=M(E),me=n.get(Z).__webglTexture;t.bindTexture(X,me),f(X),t.unbindTexture()}}}const je=[],Ie=[];function st(E){if(E.samples>0){if(lt(E)===!1){const p=E.textures,D=E.width,q=E.height;let Z=i.COLOR_BUFFER_BIT;const X=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,me=n.get(E),ie=p.length>1;if(ie)for(let be=0;be<p.length;be++)t.bindFramebuffer(i.FRAMEBUFFER,me.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+be,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,me.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+be,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,me.__webglMultisampledFramebuffer);const ye=E.texture.mipmaps;ye&&ye.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,me.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,me.__webglFramebuffer);for(let be=0;be<p.length;be++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(Z|=i.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(Z|=i.STENCIL_BUFFER_BIT)),ie){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,me.__webglColorRenderbuffer[be]);const j=n.get(p[be]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,j,0)}i.blitFramebuffer(0,0,D,q,0,0,D,q,Z,i.NEAREST),c===!0&&(je.length=0,Ie.length=0,je.push(i.COLOR_ATTACHMENT0+be),E.depthBuffer&&E.resolveDepthBuffer===!1&&(je.push(X),Ie.push(X),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,Ie)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,je))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ie)for(let be=0;be<p.length;be++){t.bindFramebuffer(i.FRAMEBUFFER,me.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+be,i.RENDERBUFFER,me.__webglColorRenderbuffer[be]);const j=n.get(p[be]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,me.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+be,i.TEXTURE_2D,j,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,me.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&c){const p=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[p])}}}function R(E){return Math.min(r.maxSamples,E.samples)}function lt(E){const p=n.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&p.__useRenderToTexture!==!1}function ke(E){const p=a.render.frame;h.get(E)!==p&&(h.set(E,p),E.update())}function Qe(E,p){const D=E.colorSpace,q=E.format,Z=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||D!==In&&D!==""&&(ze.getTransfer(D)===Ye?(q!==1023||Z!==1009)&&Re("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):He("WebGLTextures: Unsupported texture color space:",D)),p}function Se(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(l.width=E.naturalWidth||E.width,l.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(l.width=E.displayWidth,l.height=E.displayHeight):(l.width=E.width,l.height=E.height),l}this.allocateTextureUnit=G,this.resetTextureUnits=V,this.setTexture2D=H,this.setTexture2DArray=B,this.setTexture3D=O,this.setTextureCube=Q,this.rebindTextures=ht,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Xe,this.updateMultisampleRenderTarget=st,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=se,this.useMultisampledRTT=lt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function yf(i,e){function t(n,r=""){let s;const a=ze.getTransfer(r);if(n===1009)return i.UNSIGNED_BYTE;if(n===1017)return i.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return i.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return i.BYTE;if(n===1011)return i.SHORT;if(n===1012)return i.UNSIGNED_SHORT;if(n===1013)return i.INT;if(n===1014)return i.UNSIGNED_INT;if(n===1015)return i.FLOAT;if(n===1016)return i.HALF_FLOAT;if(n===1021)return i.ALPHA;if(n===1022)return i.RGB;if(n===1023)return i.RGBA;if(n===1026)return i.DEPTH_COMPONENT;if(n===1027)return i.DEPTH_STENCIL;if(n===1028)return i.RED;if(n===1029)return i.RED_INTEGER;if(n===1030)return i.RG;if(n===1031)return i.RG_INTEGER;if(n===1033)return i.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===Ye)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===33776)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===33776)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===35840)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===36196||n===37492)return a===Ye?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===37496)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return s.COMPRESSED_R11_EAC;if(n===37489)return s.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return s.COMPRESSED_RG11_EAC;if(n===37491)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===37808)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===Ye?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===36492)return a===Ye?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===36283)return s.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Af=`
|
|
4034
|
-
void main() {
|
|
4035
|
-
|
|
4036
|
-
gl_Position = vec4( position, 1.0 );
|
|
4037
|
-
|
|
4038
|
-
}`,bf=`
|
|
4039
|
-
uniform sampler2DArray depthColor;
|
|
4040
|
-
uniform float depthWidth;
|
|
4041
|
-
uniform float depthHeight;
|
|
4042
|
-
|
|
4043
|
-
void main() {
|
|
4044
|
-
|
|
4045
|
-
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
|
4046
|
-
|
|
4047
|
-
if ( coord.x >= 1.0 ) {
|
|
4048
|
-
|
|
4049
|
-
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
4050
|
-
|
|
4051
|
-
} else {
|
|
4052
|
-
|
|
4053
|
-
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
4054
|
-
|
|
4055
|
-
}
|
|
4056
|
-
|
|
4057
|
-
}`;class Rf{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Ns(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ht({vertexShader:Af,fragmentShader:bf,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new Ii(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Cf extends On{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,m=null,u=null,_=null,g=null;const S=typeof XRWebGLBinding<"u",d=new Rf,f={},M=t.getContextAttributes();let A=null,y=null;const P=[],b=[],L=new $e;let x=null;const T=new Lt;T.viewport=new ot;const Y=new Lt;Y.viewport=new ot;const C=[T,Y],V=new Ba;let G=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let ne=P[K];return ne===void 0&&(ne=new Yi,P[K]=ne),ne.getTargetRaySpace()},this.getControllerGrip=function(K){let ne=P[K];return ne===void 0&&(ne=new Yi,P[K]=ne),ne.getGripSpace()},this.getHand=function(K){let ne=P[K];return ne===void 0&&(ne=new Yi,P[K]=ne),ne.getHandSpace()};function H(K){const ne=b.indexOf(K.inputSource);if(ne===-1)return;const se=P[ne];se!==void 0&&(se.update(K.inputSource,K.frame,l||a),se.dispatchEvent({type:K.type,data:K.inputSource}))}function B(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",B),r.removeEventListener("inputsourceschange",O);for(let K=0;K<P.length;K++){const ne=b[K];ne!==null&&(b[K]=null,P[K].disconnect(ne))}G=null,k=null,d.reset();for(const K in f)delete f[K];e.setRenderTarget(A),_=null,u=null,m=null,r=null,y=null,tt.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){s=K,n.isPresenting===!0&&Re("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){o=K,n.isPresenting===!0&&Re("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(K){l=K},this.getBaseLayer=function(){return u!==null?u:_},this.getBinding=function(){return m===null&&S&&(m=new XRWebGLBinding(r,t)),m},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(K){if(r=K,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",B),r.addEventListener("inputsourceschange",O),M.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(L),S&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,De=null,Ae=null;M.depth&&(Ae=M.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=M.stencil?1027:1026,De=M.stencil?1020:1014);const Ce={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};m=this.getBinding(),u=m.createProjectionLayer(Ce),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),y=new zt(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new $n(u.textureWidth,u.textureHeight,De,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const se={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:s};_=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:_}),e.setPixelRatio(1),e.setSize(_.framebufferWidth,_.framebufferHeight,!1),y=new zt(_.framebufferWidth,_.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:_.ignoreDepthValues===!1,resolveStencilBuffer:_.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),tt.setContext(r),tt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return d.getDepthTexture()};function O(K){for(let ne=0;ne<K.removed.length;ne++){const se=K.removed[ne],De=b.indexOf(se);De>=0&&(b[De]=null,P[De].disconnect(se))}for(let ne=0;ne<K.added.length;ne++){const se=K.added[ne];let De=b.indexOf(se);if(De===-1){for(let Ce=0;Ce<P.length;Ce++)if(Ce>=b.length){b.push(se),De=Ce;break}else if(b[Ce]===null){b[Ce]=se,De=Ce;break}if(De===-1)break}const Ae=P[De];Ae&&Ae.connect(se)}}const Q=new I,$=new I;function ce(K,ne,se){Q.setFromMatrixPosition(ne.matrixWorld),$.setFromMatrixPosition(se.matrixWorld);const De=Q.distanceTo($),Ae=ne.projectionMatrix.elements,Ce=se.projectionMatrix.elements,ht=Ae[14]/(Ae[10]-1),Ge=Ae[14]/(Ae[10]+1),Xe=(Ae[9]+1)/Ae[5],je=(Ae[9]-1)/Ae[5],Ie=(Ae[8]-1)/Ae[0],st=(Ce[8]+1)/Ce[0],R=ht*Ie,lt=ht*st,ke=De/(-Ie+st),Qe=ke*-Ie;if(ne.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(Qe),K.translateZ(ke),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert(),Ae[10]===-1)K.projectionMatrix.copy(ne.projectionMatrix),K.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{const Se=ht+ke,E=Ge+ke,p=R-Qe,D=lt+(De-Qe),q=Xe*Ge/E*Se,Z=je*Ge/E*Se;K.projectionMatrix.makePerspective(p,D,q,Z,Se,E),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}}function pe(K,ne){ne===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ne.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(r===null)return;let ne=K.near,se=K.far;d.texture!==null&&(d.depthNear>0&&(ne=d.depthNear),d.depthFar>0&&(se=d.depthFar)),V.near=Y.near=T.near=ne,V.far=Y.far=T.far=se,(G!==V.near||k!==V.far)&&(r.updateRenderState({depthNear:V.near,depthFar:V.far}),G=V.near,k=V.far),V.layers.mask=K.layers.mask|6,T.layers.mask=V.layers.mask&-5,Y.layers.mask=V.layers.mask&-3;const De=K.parent,Ae=V.cameras;pe(V,De);for(let Ce=0;Ce<Ae.length;Ce++)pe(Ae[Ce],De);Ae.length===2?ce(V,T,Y):V.projectionMatrix.copy(T.projectionMatrix),fe(K,V,De)};function fe(K,ne,se){se===null?K.matrix.copy(ne.matrixWorld):(K.matrix.copy(se.matrixWorld),K.matrix.invert(),K.matrix.multiply(ne.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(ne.projectionMatrix),K.projectionMatrixInverse.copy(ne.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=gr*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(u===null&&_===null))return c},this.setFoveation=function(K){c=K,u!==null&&(u.fixedFoveation=K),_!==null&&_.fixedFoveation!==void 0&&(_.fixedFoveation=K)},this.hasDepthSensing=function(){return d.texture!==null},this.getDepthSensingMesh=function(){return d.getMesh(V)},this.getCameraTexture=function(K){return f[K]};let Fe=null;function nt(K,ne){if(h=ne.getViewerPose(l||a),g=ne,h!==null){const se=h.views;_!==null&&(e.setRenderTargetFramebuffer(y,_.framebuffer),e.setRenderTarget(y));let De=!1;se.length!==V.cameras.length&&(V.cameras.length=0,De=!0);for(let Ge=0;Ge<se.length;Ge++){const Xe=se[Ge];let je=null;if(_!==null)je=_.getViewport(Xe);else{const st=m.getViewSubImage(u,Xe);je=st.viewport,Ge===0&&(e.setRenderTargetTextures(y,st.colorTexture,st.depthStencilTexture),e.setRenderTarget(y))}let Ie=C[Ge];Ie===void 0&&(Ie=new Lt,Ie.layers.enable(Ge),Ie.viewport=new ot,C[Ge]=Ie),Ie.matrix.fromArray(Xe.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(Xe.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(je.x,je.y,je.width,je.height),Ge===0&&(V.matrix.copy(Ie.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),De===!0&&V.cameras.push(Ie)}const Ae=r.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&S){m=n.getBinding();const Ge=m.getDepthInformation(se[0]);Ge&&Ge.isValid&&Ge.texture&&d.init(Ge,r.renderState)}if(Ae&&Ae.includes("camera-access")&&S){e.state.unbindTexture(),m=n.getBinding();for(let Ge=0;Ge<se.length;Ge++){const Xe=se[Ge].camera;if(Xe){let je=f[Xe];je||(je=new Ns,f[Xe]=je);const Ie=m.getCameraImage(Xe);je.sourceTexture=Ie}}}}for(let se=0;se<P.length;se++){const De=b[se],Ae=P[se];De!==null&&Ae!==void 0&&Ae.update(De,ne,l||a)}Fe&&Fe(K,ne),ne.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ne}),g=null}const tt=new zs;tt.setAnimationLoop(nt),this.setAnimationLoop=function(K){Fe=K},this.dispose=function(){}}}const _n=new jt,wf=new rt;function Pf(i,e){function t(d,f){d.matrixAutoUpdate===!0&&d.updateMatrix(),f.value.copy(d.matrix)}function n(d,f){f.color.getRGB(d.fogColor.value,Os(i)),f.isFog?(d.fogNear.value=f.near,d.fogFar.value=f.far):f.isFogExp2&&(d.fogDensity.value=f.density)}function r(d,f,M,A,y){f.isMeshBasicMaterial?s(d,f):f.isMeshLambertMaterial?(s(d,f),f.envMap&&(d.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(d,f),m(d,f)):f.isMeshPhongMaterial?(s(d,f),h(d,f),f.envMap&&(d.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(d,f),u(d,f),f.isMeshPhysicalMaterial&&_(d,f,y)):f.isMeshMatcapMaterial?(s(d,f),g(d,f)):f.isMeshDepthMaterial?s(d,f):f.isMeshDistanceMaterial?(s(d,f),S(d,f)):f.isMeshNormalMaterial?s(d,f):f.isLineBasicMaterial?(a(d,f),f.isLineDashedMaterial&&o(d,f)):f.isPointsMaterial?c(d,f,M,A):f.isSpriteMaterial?l(d,f):f.isShadowMaterial?(d.color.value.copy(f.color),d.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(d,f){d.opacity.value=f.opacity,f.color&&d.diffuse.value.copy(f.color),f.emissive&&d.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(d.map.value=f.map,t(f.map,d.mapTransform)),f.alphaMap&&(d.alphaMap.value=f.alphaMap,t(f.alphaMap,d.alphaMapTransform)),f.bumpMap&&(d.bumpMap.value=f.bumpMap,t(f.bumpMap,d.bumpMapTransform),d.bumpScale.value=f.bumpScale,f.side===1&&(d.bumpScale.value*=-1)),f.normalMap&&(d.normalMap.value=f.normalMap,t(f.normalMap,d.normalMapTransform),d.normalScale.value.copy(f.normalScale),f.side===1&&d.normalScale.value.negate()),f.displacementMap&&(d.displacementMap.value=f.displacementMap,t(f.displacementMap,d.displacementMapTransform),d.displacementScale.value=f.displacementScale,d.displacementBias.value=f.displacementBias),f.emissiveMap&&(d.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,d.emissiveMapTransform)),f.specularMap&&(d.specularMap.value=f.specularMap,t(f.specularMap,d.specularMapTransform)),f.alphaTest>0&&(d.alphaTest.value=f.alphaTest);const M=e.get(f),A=M.envMap,y=M.envMapRotation;A&&(d.envMap.value=A,_n.copy(y),_n.x*=-1,_n.y*=-1,_n.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(_n.y*=-1,_n.z*=-1),d.envMapRotation.value.setFromMatrix4(wf.makeRotationFromEuler(_n)),d.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=f.reflectivity,d.ior.value=f.ior,d.refractionRatio.value=f.refractionRatio),f.lightMap&&(d.lightMap.value=f.lightMap,d.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,d.lightMapTransform)),f.aoMap&&(d.aoMap.value=f.aoMap,d.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,d.aoMapTransform))}function a(d,f){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,f.map&&(d.map.value=f.map,t(f.map,d.mapTransform))}function o(d,f){d.dashSize.value=f.dashSize,d.totalSize.value=f.dashSize+f.gapSize,d.scale.value=f.scale}function c(d,f,M,A){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,d.size.value=f.size*M,d.scale.value=A*.5,f.map&&(d.map.value=f.map,t(f.map,d.uvTransform)),f.alphaMap&&(d.alphaMap.value=f.alphaMap,t(f.alphaMap,d.alphaMapTransform)),f.alphaTest>0&&(d.alphaTest.value=f.alphaTest)}function l(d,f){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,d.rotation.value=f.rotation,f.map&&(d.map.value=f.map,t(f.map,d.mapTransform)),f.alphaMap&&(d.alphaMap.value=f.alphaMap,t(f.alphaMap,d.alphaMapTransform)),f.alphaTest>0&&(d.alphaTest.value=f.alphaTest)}function h(d,f){d.specular.value.copy(f.specular),d.shininess.value=Math.max(f.shininess,1e-4)}function m(d,f){f.gradientMap&&(d.gradientMap.value=f.gradientMap)}function u(d,f){d.metalness.value=f.metalness,f.metalnessMap&&(d.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,d.metalnessMapTransform)),d.roughness.value=f.roughness,f.roughnessMap&&(d.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,d.roughnessMapTransform)),f.envMap&&(d.envMapIntensity.value=f.envMapIntensity)}function _(d,f,M){d.ior.value=f.ior,f.sheen>0&&(d.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),d.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(d.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,d.sheenColorMapTransform)),f.sheenRoughnessMap&&(d.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,d.sheenRoughnessMapTransform))),f.clearcoat>0&&(d.clearcoat.value=f.clearcoat,d.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(d.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,d.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(d.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===1&&d.clearcoatNormalScale.value.negate())),f.dispersion>0&&(d.dispersion.value=f.dispersion),f.iridescence>0&&(d.iridescence.value=f.iridescence,d.iridescenceIOR.value=f.iridescenceIOR,d.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(d.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,d.iridescenceMapTransform)),f.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),f.transmission>0&&(d.transmission.value=f.transmission,d.transmissionSamplerMap.value=M.texture,d.transmissionSamplerSize.value.set(M.width,M.height),f.transmissionMap&&(d.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,d.transmissionMapTransform)),d.thickness.value=f.thickness,f.thicknessMap&&(d.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=f.attenuationDistance,d.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(d.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(d.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=f.specularIntensity,d.specularColor.value.copy(f.specularColor),f.specularColorMap&&(d.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,d.specularColorMapTransform)),f.specularIntensityMap&&(d.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,d.specularIntensityMapTransform))}function g(d,f){f.matcap&&(d.matcap.value=f.matcap)}function S(d,f){const M=e.get(f).light;d.referencePosition.value.setFromMatrixPosition(M.matrixWorld),d.nearDistance.value=M.shadow.camera.near,d.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Df(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,A){const y=A.program;n.uniformBlockBinding(M,y)}function l(M,A){let y=r[M.id];y===void 0&&(g(M),y=h(M),r[M.id]=y,M.addEventListener("dispose",d));const P=A.program;n.updateUBOMapping(M,P);const b=e.render.frame;s[M.id]!==b&&(u(M),s[M.id]=b)}function h(M){const A=m();M.__bindingPointIndex=A;const y=i.createBuffer(),P=M.__size,b=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,P,b),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,A,y),y}function m(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return He("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(M){const A=r[M.id],y=M.uniforms,P=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let b=0,L=y.length;b<L;b++){const x=Array.isArray(y[b])?y[b]:[y[b]];for(let T=0,Y=x.length;T<Y;T++){const C=x[T];if(_(C,b,T,P)===!0){const V=C.__offset,G=Array.isArray(C.value)?C.value:[C.value];let k=0;for(let H=0;H<G.length;H++){const B=G[H],O=S(B);typeof B=="number"||typeof B=="boolean"?(C.__data[0]=B,i.bufferSubData(i.UNIFORM_BUFFER,V+k,C.__data)):B.isMatrix3?(C.__data[0]=B.elements[0],C.__data[1]=B.elements[1],C.__data[2]=B.elements[2],C.__data[3]=0,C.__data[4]=B.elements[3],C.__data[5]=B.elements[4],C.__data[6]=B.elements[5],C.__data[7]=0,C.__data[8]=B.elements[6],C.__data[9]=B.elements[7],C.__data[10]=B.elements[8],C.__data[11]=0):(B.toArray(C.__data,k),k+=O.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,V,C.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function _(M,A,y,P){const b=M.value,L=A+"_"+y;if(P[L]===void 0)return typeof b=="number"||typeof b=="boolean"?P[L]=b:P[L]=b.clone(),!0;{const x=P[L];if(typeof b=="number"||typeof b=="boolean"){if(x!==b)return P[L]=b,!0}else if(x.equals(b)===!1)return x.copy(b),!0}return!1}function g(M){const A=M.uniforms;let y=0;const P=16;for(let L=0,x=A.length;L<x;L++){const T=Array.isArray(A[L])?A[L]:[A[L]];for(let Y=0,C=T.length;Y<C;Y++){const V=T[Y],G=Array.isArray(V.value)?V.value:[V.value];for(let k=0,H=G.length;k<H;k++){const B=G[k],O=S(B),Q=y%P,$=Q%O.boundary,ce=Q+$;y+=$,ce!==0&&P-ce<O.storage&&(y+=P-ce),V.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=y,y+=O.storage}}}const b=y%P;return b>0&&(y+=P-b),M.__size=y,M.__cache={},this}function S(M){const A={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(A.boundary=4,A.storage=4):M.isVector2?(A.boundary=8,A.storage=8):M.isVector3||M.isColor?(A.boundary=16,A.storage=12):M.isVector4?(A.boundary=16,A.storage=16):M.isMatrix3?(A.boundary=48,A.storage=48):M.isMatrix4?(A.boundary=64,A.storage=64):M.isTexture?Re("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Re("WebGLRenderer: Unsupported uniform value type.",M),A}function d(M){const A=M.target;A.removeEventListener("dispose",d);const y=a.indexOf(A.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function f(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:c,update:l,dispose:f}}const Lf=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Bt=null;function Ff(){return Bt===null&&(Bt=new Ea(Lf,16,16,1030,1016),Bt.name="DFG_LUT",Bt.minFilter=1006,Bt.magFilter=1006,Bt.wrapS=1001,Bt.wrapT=1001,Bt.generateMipmaps=!1,Bt.needsUpdate=!0),Bt}class Of{constructor(e={}){const{canvas:t=ea(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:u=!1,outputBufferType:_=1009}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const S=_,d=new Set([1033,1031,1029]),f=new Set([1009,1014,1012,1020,1017,1018]),M=new Uint32Array(4),A=new Int32Array(4);let y=null,P=null;const b=[],L=[];let x=null;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.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let Y=!1;this._outputColorSpace=Rt;let C=0,V=0,G=null,k=-1,H=null;const B=new ot,O=new ot;let Q=null;const $=new We(0);let ce=0,pe=t.width,fe=t.height,Fe=1,nt=null,tt=null;const K=new ot(0,0,pe,fe),ne=new ot(0,0,pe,fe);let se=!1;const De=new Us;let Ae=!1,Ce=!1;const ht=new rt,Ge=new I,Xe=new ot,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ie=!1;function st(){return G===null?Fe:1}let R=n;function lt(v,F){return t.getContext(v,F)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r183"),t.addEventListener("webglcontextlost",ge,!1),t.addEventListener("webglcontextrestored",we,!1),t.addEventListener("webglcontextcreationerror",et,!1),R===null){const F="webgl2";if(R=lt(F,v),R===null)throw lt(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw He("WebGLRenderer: "+v.message),v}let ke,Qe,Se,E,p,D,q,Z,X,me,ie,ye,be,j,ee,_e,xe,ue,Ne,w,re,te,de;function J(){ke=new Fc(R),ke.init(),re=new yf(R,ke),Qe=new Ac(R,ke,e,re),Se=new Ef(R,ke),Qe.reversedDepthBuffer&&u&&Se.buffers.depth.setReversed(!0),E=new Nc(R),p=new lf,D=new Tf(R,ke,Se,p,Qe,re,E),q=new Lc(T),Z=new za(R),te=new Tc(R,Z),X=new Uc(R,Z,E,te),me=new Bc(R,X,Z,te,E),ue=new Oc(R,Qe,D),ee=new bc(p),ie=new of(T,q,ke,Qe,te,ee),ye=new Pf(T,p),be=new uf,j=new _f(ke),xe=new Ec(T,q,Se,me,g,c),_e=new Mf(T,me,Qe),de=new Df(R,E,Qe,Se),Ne=new yc(R,ke,E),w=new Ic(R,ke,E),E.programs=ie.programs,T.capabilities=Qe,T.extensions=ke,T.properties=p,T.renderLists=be,T.shadowMap=_e,T.state=Se,T.info=E}J(),S!==1009&&(x=new zc(S,t.width,t.height,r,s));const W=new Cf(T,R);this.xr=W,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const v=ke.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=ke.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return Fe},this.setPixelRatio=function(v){v!==void 0&&(Fe=v,this.setSize(pe,fe,!1))},this.getSize=function(v){return v.set(pe,fe)},this.setSize=function(v,F,z=!0){if(W.isPresenting){Re("WebGLRenderer: Can't change size while VR device is presenting.");return}pe=v,fe=F,t.width=Math.floor(v*Fe),t.height=Math.floor(F*Fe),z===!0&&(t.style.width=v+"px",t.style.height=F+"px"),x!==null&&x.setSize(t.width,t.height),this.setViewport(0,0,v,F)},this.getDrawingBufferSize=function(v){return v.set(pe*Fe,fe*Fe).floor()},this.setDrawingBufferSize=function(v,F,z){pe=v,fe=F,Fe=z,t.width=Math.floor(v*z),t.height=Math.floor(F*z),this.setViewport(0,0,v,F)},this.setEffects=function(v){if(S===1009){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let F=0;F<v.length;F++)if(v[F].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}x.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(B)},this.getViewport=function(v){return v.copy(K)},this.setViewport=function(v,F,z,N){v.isVector4?K.set(v.x,v.y,v.z,v.w):K.set(v,F,z,N),Se.viewport(B.copy(K).multiplyScalar(Fe).round())},this.getScissor=function(v){return v.copy(ne)},this.setScissor=function(v,F,z,N){v.isVector4?ne.set(v.x,v.y,v.z,v.w):ne.set(v,F,z,N),Se.scissor(O.copy(ne).multiplyScalar(Fe).round())},this.getScissorTest=function(){return se},this.setScissorTest=function(v){Se.setScissorTest(se=v)},this.setOpaqueSort=function(v){nt=v},this.setTransparentSort=function(v){tt=v},this.getClearColor=function(v){return v.copy(xe.getClearColor())},this.setClearColor=function(){xe.setClearColor(...arguments)},this.getClearAlpha=function(){return xe.getClearAlpha()},this.setClearAlpha=function(){xe.setClearAlpha(...arguments)},this.clear=function(v=!0,F=!0,z=!0){let N=0;if(v){let U=!1;if(G!==null){const oe=G.texture.format;U=d.has(oe)}if(U){const oe=G.texture.type,he=f.has(oe),le=xe.getClearColor(),ve=xe.getClearAlpha(),Ee=le.r,Pe=le.g,Oe=le.b;he?(M[0]=Ee,M[1]=Pe,M[2]=Oe,M[3]=ve,R.clearBufferuiv(R.COLOR,0,M)):(A[0]=Ee,A[1]=Pe,A[2]=Oe,A[3]=ve,R.clearBufferiv(R.COLOR,0,A))}else N|=R.COLOR_BUFFER_BIT}F&&(N|=R.DEPTH_BUFFER_BIT),z&&(N|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),N!==0&&R.clear(N)},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",ge,!1),t.removeEventListener("webglcontextrestored",we,!1),t.removeEventListener("webglcontextcreationerror",et,!1),xe.dispose(),be.dispose(),j.dispose(),p.dispose(),q.dispose(),me.dispose(),te.dispose(),de.dispose(),ie.dispose(),W.dispose(),W.removeEventListener("sessionstart",yr),W.removeEventListener("sessionend",Ar),cn.stop()};function ge(v){v.preventDefault(),Ur("WebGLRenderer: Context Lost."),Y=!0}function we(){Ur("WebGLRenderer: Context Restored."),Y=!1;const v=E.autoReset,F=_e.enabled,z=_e.autoUpdate,N=_e.needsUpdate,U=_e.type;J(),E.autoReset=v,_e.enabled=F,_e.autoUpdate=z,_e.needsUpdate=N,_e.type=U}function et(v){He("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function qe(v){const F=v.target;F.removeEventListener("dispose",qe),kt(F)}function kt(v){Wt(v),p.remove(v)}function Wt(v){const F=p.get(v).programs;F!==void 0&&(F.forEach(function(z){ie.releaseProgram(z)}),v.isShaderMaterial&&ie.releaseShaderCache(v))}this.renderBufferDirect=function(v,F,z,N,U,oe){F===null&&(F=je);const he=U.isMesh&&U.matrixWorld.determinant()<0,le=Ys(v,F,z,N,U);Se.setMaterial(N,he);let ve=z.index,Ee=1;if(N.wireframe===!0){if(ve=X.getWireframeAttribute(z),ve===void 0)return;Ee=2}const Pe=z.drawRange,Oe=z.attributes.position;let Te=Pe.start*Ee,Ke=(Pe.start+Pe.count)*Ee;oe!==null&&(Te=Math.max(Te,oe.start*Ee),Ke=Math.min(Ke,(oe.start+oe.count)*Ee)),ve!==null?(Te=Math.max(Te,0),Ke=Math.min(Ke,ve.count)):Oe!=null&&(Te=Math.max(Te,0),Ke=Math.min(Ke,Oe.count));const at=Ke-Te;if(at<0||at===1/0)return;te.setup(U,N,le,z,ve);let it,Ze=Ne;if(ve!==null&&(it=Z.get(ve),Ze=w,Ze.setIndex(it)),U.isMesh)N.wireframe===!0?(Se.setLineWidth(N.wireframeLinewidth*st()),Ze.setMode(R.LINES)):Ze.setMode(R.TRIANGLES);else if(U.isLine){let _t=N.linewidth;_t===void 0&&(_t=1),Se.setLineWidth(_t*st()),U.isLineSegments?Ze.setMode(R.LINES):U.isLineLoop?Ze.setMode(R.LINE_LOOP):Ze.setMode(R.LINE_STRIP)}else U.isPoints?Ze.setMode(R.POINTS):U.isSprite&&Ze.setMode(R.TRIANGLES);if(U.isBatchedMesh)if(U._multiDrawInstances!==null)Li("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ze.renderMultiDrawInstances(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount,U._multiDrawInstances);else if(ke.get("WEBGL_multi_draw"))Ze.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{const _t=U._multiDrawStarts,Me=U._multiDrawCounts,Tt=U._multiDrawCount,Ve=ve?Z.get(ve).bytesPerElement:1,Ct=p.get(N).currentProgram.getUniforms();for(let Nt=0;Nt<Tt;Nt++)Ct.setValue(R,"_gl_DrawID",Nt),Ze.render(_t[Nt]/Ve,Me[Nt])}else if(U.isInstancedMesh)Ze.renderInstances(Te,at,U.count);else if(z.isInstancedBufferGeometry){const _t=z._maxInstanceCount!==void 0?z._maxInstanceCount:1/0,Me=Math.min(z.instanceCount,_t);Ze.renderInstances(Te,at,Me)}else Ze.render(Te,at)};function Tr(v,F,z){v.transparent===!0&&v.side===2&&v.forceSinglePass===!1?(v.side=1,v.needsUpdate=!0,ni(v,F,z),v.side=0,v.needsUpdate=!0,ni(v,F,z),v.side=2):ni(v,F,z)}this.compile=function(v,F,z=null){z===null&&(z=v),P=j.get(z),P.init(F),L.push(P),z.traverseVisible(function(U){U.isLight&&U.layers.test(F.layers)&&(P.pushLight(U),U.castShadow&&P.pushShadow(U))}),v!==z&&v.traverseVisible(function(U){U.isLight&&U.layers.test(F.layers)&&(P.pushLight(U),U.castShadow&&P.pushShadow(U))}),P.setupLights();const N=new Set;return v.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;const oe=U.material;if(oe)if(Array.isArray(oe))for(let he=0;he<oe.length;he++){const le=oe[he];Tr(le,z,U),N.add(le)}else Tr(oe,z,U),N.add(oe)}),P=L.pop(),N},this.compileAsync=function(v,F,z=null){const N=this.compile(v,F,z);return new Promise(U=>{function oe(){if(N.forEach(function(he){p.get(he).currentProgram.isReady()&&N.delete(he)}),N.size===0){U(v);return}setTimeout(oe,10)}ke.get("KHR_parallel_shader_compile")!==null?oe():setTimeout(oe,10)})};let Bi=null;function qs(v){Bi&&Bi(v)}function yr(){cn.stop()}function Ar(){cn.start()}const cn=new zs;cn.setAnimationLoop(qs),typeof self<"u"&&cn.setContext(self),this.setAnimationLoop=function(v){Bi=v,W.setAnimationLoop(v),v===null?cn.stop():cn.start()},W.addEventListener("sessionstart",yr),W.addEventListener("sessionend",Ar),this.render=function(v,F){if(F!==void 0&&F.isCamera!==!0){He("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(Y===!0)return;const z=W.enabled===!0&&W.isPresenting===!0,N=x!==null&&(G===null||z)&&x.begin(T,G);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(x===null||x.isCompositing()===!1)&&(W.cameraAutoUpdate===!0&&W.updateCamera(F),F=W.getCamera()),v.isScene===!0&&v.onBeforeRender(T,v,F,G),P=j.get(v,L.length),P.init(F),L.push(P),ht.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),De.setFromProjectionMatrix(ht,2e3,F.reversedDepth),Ce=this.localClippingEnabled,Ae=ee.init(this.clippingPlanes,Ce),y=be.get(v,b.length),y.init(),b.push(y),W.enabled===!0&&W.isPresenting===!0){const he=T.xr.getDepthSensingMesh();he!==null&&Gi(he,F,-1/0,T.sortObjects)}Gi(v,F,0,T.sortObjects),y.finish(),T.sortObjects===!0&&y.sort(nt,tt),Ie=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,Ie&&xe.addToRenderList(y,v),this.info.render.frame++,Ae===!0&&ee.beginShadows();const U=P.state.shadowsArray;if(_e.render(U,v,F),Ae===!0&&ee.endShadows(),this.info.autoReset===!0&&this.info.reset(),(N&&x.hasRenderPass())===!1){const he=y.opaque,le=y.transmissive;if(P.setupLights(),F.isArrayCamera){const ve=F.cameras;if(le.length>0)for(let Ee=0,Pe=ve.length;Ee<Pe;Ee++){const Oe=ve[Ee];Rr(he,le,v,Oe)}Ie&&xe.render(v);for(let Ee=0,Pe=ve.length;Ee<Pe;Ee++){const Oe=ve[Ee];br(y,v,Oe,Oe.viewport)}}else le.length>0&&Rr(he,le,v,F),Ie&&xe.render(v),br(y,v,F)}G!==null&&V===0&&(D.updateMultisampleRenderTarget(G),D.updateRenderTargetMipmap(G)),N&&x.end(T),v.isScene===!0&&v.onAfterRender(T,v,F),te.resetDefaultState(),k=-1,H=null,L.pop(),L.length>0?(P=L[L.length-1],Ae===!0&&ee.setGlobalState(T.clippingPlanes,P.state.camera)):P=null,b.pop(),b.length>0?y=b[b.length-1]:y=null};function Gi(v,F,z,N){if(v.visible===!1)return;if(v.layers.test(F.layers)){if(v.isGroup)z=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(F);else if(v.isLight)P.pushLight(v),v.castShadow&&P.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||De.intersectsSprite(v)){N&&Xe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ht);const he=me.update(v),le=v.material;le.visible&&y.push(v,he,le,z,Xe.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||De.intersectsObject(v))){const he=me.update(v),le=v.material;if(N&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),Xe.copy(v.boundingSphere.center)):(he.boundingSphere===null&&he.computeBoundingSphere(),Xe.copy(he.boundingSphere.center)),Xe.applyMatrix4(v.matrixWorld).applyMatrix4(ht)),Array.isArray(le)){const ve=he.groups;for(let Ee=0,Pe=ve.length;Ee<Pe;Ee++){const Oe=ve[Ee],Te=le[Oe.materialIndex];Te&&Te.visible&&y.push(v,he,Te,z,Xe.z,Oe)}}else le.visible&&y.push(v,he,le,z,Xe.z,null)}}const oe=v.children;for(let he=0,le=oe.length;he<le;he++)Gi(oe[he],F,z,N)}function br(v,F,z,N){const{opaque:U,transmissive:oe,transparent:he}=v;P.setupLightsView(z),Ae===!0&&ee.setGlobalState(T.clippingPlanes,z),N&&Se.viewport(B.copy(N)),U.length>0&&ti(U,F,z),oe.length>0&&ti(oe,F,z),he.length>0&&ti(he,F,z),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function Rr(v,F,z,N){if((z.isScene===!0?z.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[N.id]===void 0){const Te=ke.has("EXT_color_buffer_half_float")||ke.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[N.id]=new zt(1,1,{generateMipmaps:!0,type:Te?1016:1009,minFilter:1008,samples:Math.max(4,Qe.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ze.workingColorSpace})}const oe=P.state.transmissionRenderTarget[N.id],he=N.viewport||B;oe.setSize(he.z*T.transmissionResolutionScale,he.w*T.transmissionResolutionScale);const le=T.getRenderTarget(),ve=T.getActiveCubeFace(),Ee=T.getActiveMipmapLevel();T.setRenderTarget(oe),T.getClearColor($),ce=T.getClearAlpha(),ce<1&&T.setClearColor(16777215,.5),T.clear(),Ie&&xe.render(z);const Pe=T.toneMapping;T.toneMapping=0;const Oe=N.viewport;if(N.viewport!==void 0&&(N.viewport=void 0),P.setupLightsView(N),Ae===!0&&ee.setGlobalState(T.clippingPlanes,N),ti(v,z,N),D.updateMultisampleRenderTarget(oe),D.updateRenderTargetMipmap(oe),ke.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let Ke=0,at=F.length;Ke<at;Ke++){const it=F[Ke],{object:Ze,geometry:_t,material:Me,group:Tt}=it;if(Me.side===2&&Ze.layers.test(N.layers)){const Ve=Me.side;Me.side=1,Me.needsUpdate=!0,Cr(Ze,z,N,_t,Me,Tt),Me.side=Ve,Me.needsUpdate=!0,Te=!0}}Te===!0&&(D.updateMultisampleRenderTarget(oe),D.updateRenderTargetMipmap(oe))}T.setRenderTarget(le,ve,Ee),T.setClearColor($,ce),Oe!==void 0&&(N.viewport=Oe),T.toneMapping=Pe}function ti(v,F,z){const N=F.isScene===!0?F.overrideMaterial:null;for(let U=0,oe=v.length;U<oe;U++){const he=v[U],{object:le,geometry:ve,group:Ee}=he;let Pe=he.material;Pe.allowOverride===!0&&N!==null&&(Pe=N),le.layers.test(z.layers)&&Cr(le,F,z,ve,Pe,Ee)}}function Cr(v,F,z,N,U,oe){v.onBeforeRender(T,F,z,N,U,oe),v.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),U.onBeforeRender(T,F,z,N,v,oe),U.transparent===!0&&U.side===2&&U.forceSinglePass===!1?(U.side=1,U.needsUpdate=!0,T.renderBufferDirect(z,F,N,U,v,oe),U.side=0,U.needsUpdate=!0,T.renderBufferDirect(z,F,N,U,v,oe),U.side=2):T.renderBufferDirect(z,F,N,U,v,oe),v.onAfterRender(T,F,z,N,U,oe)}function ni(v,F,z){F.isScene!==!0&&(F=je);const N=p.get(v),U=P.state.lights,oe=P.state.shadowsArray,he=U.state.version,le=ie.getParameters(v,U.state,oe,F,z),ve=ie.getProgramCacheKey(le);let Ee=N.programs;N.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?F.environment:null,N.fog=F.fog;const Pe=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;N.envMap=q.get(v.envMap||N.environment,Pe),N.envMapRotation=N.environment!==null&&v.envMap===null?F.environmentRotation:v.envMapRotation,Ee===void 0&&(v.addEventListener("dispose",qe),Ee=new Map,N.programs=Ee);let Oe=Ee.get(ve);if(Oe!==void 0){if(N.currentProgram===Oe&&N.lightsStateVersion===he)return Pr(v,le),Oe}else le.uniforms=ie.getUniforms(v),v.onBeforeCompile(le,T),Oe=ie.acquireProgram(le,ve),Ee.set(ve,Oe),N.uniforms=le.uniforms;const Te=N.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Te.clippingPlanes=ee.uniform),Pr(v,le),N.needsLights=Zs(v),N.lightsStateVersion=he,N.needsLights&&(Te.ambientLightColor.value=U.state.ambient,Te.lightProbe.value=U.state.probe,Te.directionalLights.value=U.state.directional,Te.directionalLightShadows.value=U.state.directionalShadow,Te.spotLights.value=U.state.spot,Te.spotLightShadows.value=U.state.spotShadow,Te.rectAreaLights.value=U.state.rectArea,Te.ltc_1.value=U.state.rectAreaLTC1,Te.ltc_2.value=U.state.rectAreaLTC2,Te.pointLights.value=U.state.point,Te.pointLightShadows.value=U.state.pointShadow,Te.hemisphereLights.value=U.state.hemi,Te.directionalShadowMatrix.value=U.state.directionalShadowMatrix,Te.spotLightMatrix.value=U.state.spotLightMatrix,Te.spotLightMap.value=U.state.spotLightMap,Te.pointShadowMatrix.value=U.state.pointShadowMatrix),N.currentProgram=Oe,N.uniformsList=null,Oe}function wr(v){if(v.uniformsList===null){const F=v.currentProgram.getUniforms();v.uniformsList=wi.seqWithValue(F.seq,v.uniforms)}return v.uniformsList}function Pr(v,F){const z=p.get(v);z.outputColorSpace=F.outputColorSpace,z.batching=F.batching,z.batchingColor=F.batchingColor,z.instancing=F.instancing,z.instancingColor=F.instancingColor,z.instancingMorph=F.instancingMorph,z.skinning=F.skinning,z.morphTargets=F.morphTargets,z.morphNormals=F.morphNormals,z.morphColors=F.morphColors,z.morphTargetsCount=F.morphTargetsCount,z.numClippingPlanes=F.numClippingPlanes,z.numIntersection=F.numClipIntersection,z.vertexAlphas=F.vertexAlphas,z.vertexTangents=F.vertexTangents,z.toneMapping=F.toneMapping}function Ys(v,F,z,N,U){F.isScene!==!0&&(F=je),D.resetTextureUnits();const oe=F.fog,he=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?F.environment:null,le=G===null?T.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:In,ve=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,Ee=q.get(N.envMap||he,ve),Pe=N.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,Oe=!!z.attributes.tangent&&(!!N.normalMap||N.anisotropy>0),Te=!!z.morphAttributes.position,Ke=!!z.morphAttributes.normal,at=!!z.morphAttributes.color;let it=0;N.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(it=T.toneMapping);const Ze=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,_t=Ze!==void 0?Ze.length:0,Me=p.get(N),Tt=P.state.lights;if(Ae===!0&&(Ce===!0||v!==H)){const dt=v===H&&N.id===k;ee.setState(N,v,dt)}let Ve=!1;N.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==Tt.state.version||Me.outputColorSpace!==le||U.isBatchedMesh&&Me.batching===!1||!U.isBatchedMesh&&Me.batching===!0||U.isBatchedMesh&&Me.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&Me.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&Me.instancing===!1||!U.isInstancedMesh&&Me.instancing===!0||U.isSkinnedMesh&&Me.skinning===!1||!U.isSkinnedMesh&&Me.skinning===!0||U.isInstancedMesh&&Me.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Me.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&Me.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&Me.instancingMorph===!1&&U.morphTexture!==null||Me.envMap!==Ee||N.fog===!0&&Me.fog!==oe||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==ee.numPlanes||Me.numIntersection!==ee.numIntersection)||Me.vertexAlphas!==Pe||Me.vertexTangents!==Oe||Me.morphTargets!==Te||Me.morphNormals!==Ke||Me.morphColors!==at||Me.toneMapping!==it||Me.morphTargetsCount!==_t)&&(Ve=!0):(Ve=!0,Me.__version=N.version);let Ct=Me.currentProgram;Ve===!0&&(Ct=ni(N,F,U));let Nt=!1,un=!1,vn=!1;const Je=Ct.getUniforms(),mt=Me.uniforms;if(Se.useProgram(Ct.program)&&(Nt=!0,un=!0,vn=!0),N.id!==k&&(k=N.id,un=!0),Nt||H!==v){Se.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),Je.setValue(R,"projectionMatrix",v.projectionMatrix),Je.setValue(R,"viewMatrix",v.matrixWorldInverse);const en=Je.map.cameraPosition;en!==void 0&&en.setValue(R,Ge.setFromMatrixPosition(v.matrixWorld)),Qe.logarithmicDepthBuffer&&Je.setValue(R,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial)&&Je.setValue(R,"isOrthographic",v.isOrthographicCamera===!0),H!==v&&(H=v,un=!0,vn=!0)}if(Me.needsLights&&(Tt.state.directionalShadowMap.length>0&&Je.setValue(R,"directionalShadowMap",Tt.state.directionalShadowMap,D),Tt.state.spotShadowMap.length>0&&Je.setValue(R,"spotShadowMap",Tt.state.spotShadowMap,D),Tt.state.pointShadowMap.length>0&&Je.setValue(R,"pointShadowMap",Tt.state.pointShadowMap,D)),U.isSkinnedMesh){Je.setOptional(R,U,"bindMatrix"),Je.setOptional(R,U,"bindMatrixInverse");const dt=U.skeleton;dt&&(dt.boneTexture===null&&dt.computeBoneTexture(),Je.setValue(R,"boneTexture",dt.boneTexture,D))}U.isBatchedMesh&&(Je.setOptional(R,U,"batchingTexture"),Je.setValue(R,"batchingTexture",U._matricesTexture,D),Je.setOptional(R,U,"batchingIdTexture"),Je.setValue(R,"batchingIdTexture",U._indirectTexture,D),Je.setOptional(R,U,"batchingColorTexture"),U._colorsTexture!==null&&Je.setValue(R,"batchingColorTexture",U._colorsTexture,D));const Qt=z.morphAttributes;if((Qt.position!==void 0||Qt.normal!==void 0||Qt.color!==void 0)&&ue.update(U,z,Ct),(un||Me.receiveShadow!==U.receiveShadow)&&(Me.receiveShadow=U.receiveShadow,Je.setValue(R,"receiveShadow",U.receiveShadow)),(N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial)&&N.envMap===null&&F.environment!==null&&(mt.envMapIntensity.value=F.environmentIntensity),mt.dfgLUT!==void 0&&(mt.dfgLUT.value=Ff()),un&&(Je.setValue(R,"toneMappingExposure",T.toneMappingExposure),Me.needsLights&&Ks(mt,vn),oe&&N.fog===!0&&ye.refreshFogUniforms(mt,oe),ye.refreshMaterialUniforms(mt,N,Fe,fe,P.state.transmissionRenderTarget[v.id]),wi.upload(R,wr(Me),mt,D)),N.isShaderMaterial&&N.uniformsNeedUpdate===!0&&(wi.upload(R,wr(Me),mt,D),N.uniformsNeedUpdate=!1),N.isSpriteMaterial&&Je.setValue(R,"center",U.center),Je.setValue(R,"modelViewMatrix",U.modelViewMatrix),Je.setValue(R,"normalMatrix",U.normalMatrix),Je.setValue(R,"modelMatrix",U.matrixWorld),N.isShaderMaterial||N.isRawShaderMaterial){const dt=N.uniformsGroups;for(let en=0,Sn=dt.length;en<Sn;en++){const Dr=dt[en];de.update(Dr,Ct),de.bind(Dr,Ct)}}return Ct}function Ks(v,F){v.ambientLightColor.needsUpdate=F,v.lightProbe.needsUpdate=F,v.directionalLights.needsUpdate=F,v.directionalLightShadows.needsUpdate=F,v.pointLights.needsUpdate=F,v.pointLightShadows.needsUpdate=F,v.spotLights.needsUpdate=F,v.spotLightShadows.needsUpdate=F,v.rectAreaLights.needsUpdate=F,v.hemisphereLights.needsUpdate=F}function Zs(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(v,F,z){const N=p.get(v);N.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,N.__autoAllocateDepthBuffer===!1&&(N.__useRenderToTexture=!1),p.get(v.texture).__webglTexture=F,p.get(v.depthTexture).__webglTexture=N.__autoAllocateDepthBuffer?void 0:z,N.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,F){const z=p.get(v);z.__webglFramebuffer=F,z.__useDefaultFramebuffer=F===void 0};const $s=R.createFramebuffer();this.setRenderTarget=function(v,F=0,z=0){G=v,C=F,V=z;let N=null,U=!1,oe=!1;if(v){const le=p.get(v);if(le.__useDefaultFramebuffer!==void 0){Se.bindFramebuffer(R.FRAMEBUFFER,le.__webglFramebuffer),B.copy(v.viewport),O.copy(v.scissor),Q=v.scissorTest,Se.viewport(B),Se.scissor(O),Se.setScissorTest(Q),k=-1;return}else if(le.__webglFramebuffer===void 0)D.setupRenderTarget(v);else if(le.__hasExternalTextures)D.rebindTextures(v,p.get(v.texture).__webglTexture,p.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Pe=v.depthTexture;if(le.__boundDepthTexture!==Pe){if(Pe!==null&&p.has(Pe)&&(v.width!==Pe.image.width||v.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");D.setupDepthRenderbuffer(v)}}const ve=v.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(oe=!0);const Ee=p.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Ee[F])?N=Ee[F][z]:N=Ee[F],U=!0):v.samples>0&&D.useMultisampledRTT(v)===!1?N=p.get(v).__webglMultisampledFramebuffer:Array.isArray(Ee)?N=Ee[z]:N=Ee,B.copy(v.viewport),O.copy(v.scissor),Q=v.scissorTest}else B.copy(K).multiplyScalar(Fe).floor(),O.copy(ne).multiplyScalar(Fe).floor(),Q=se;if(z!==0&&(N=$s),Se.bindFramebuffer(R.FRAMEBUFFER,N)&&Se.drawBuffers(v,N),Se.viewport(B),Se.scissor(O),Se.setScissorTest(Q),U){const le=p.get(v.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+F,le.__webglTexture,z)}else if(oe){const le=F;for(let ve=0;ve<v.textures.length;ve++){const Ee=p.get(v.textures[ve]);R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0+ve,Ee.__webglTexture,z,le)}}else if(v!==null&&z!==0){const le=p.get(v.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,le.__webglTexture,z)}k=-1},this.readRenderTargetPixels=function(v,F,z,N,U,oe,he,le=0){if(!(v&&v.isWebGLRenderTarget)){He("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=p.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&he!==void 0&&(ve=ve[he]),ve){Se.bindFramebuffer(R.FRAMEBUFFER,ve);try{const Ee=v.textures[le],Pe=Ee.format,Oe=Ee.type;if(v.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+le),!Qe.textureFormatReadable(Pe)){He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Qe.textureTypeReadable(Oe)){He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=v.width-N&&z>=0&&z<=v.height-U&&R.readPixels(F,z,N,U,re.convert(Pe),re.convert(Oe),oe)}finally{const Ee=G!==null?p.get(G).__webglFramebuffer:null;Se.bindFramebuffer(R.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(v,F,z,N,U,oe,he,le=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=p.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&he!==void 0&&(ve=ve[he]),ve)if(F>=0&&F<=v.width-N&&z>=0&&z<=v.height-U){Se.bindFramebuffer(R.FRAMEBUFFER,ve);const Ee=v.textures[le],Pe=Ee.format,Oe=Ee.type;if(v.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+le),!Qe.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Qe.textureTypeReadable(Oe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Te=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Te),R.bufferData(R.PIXEL_PACK_BUFFER,oe.byteLength,R.STREAM_READ),R.readPixels(F,z,N,U,re.convert(Pe),re.convert(Oe),0);const Ke=G!==null?p.get(G).__webglFramebuffer:null;Se.bindFramebuffer(R.FRAMEBUFFER,Ke);const at=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await ta(R,at,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Te),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,oe),R.deleteBuffer(Te),R.deleteSync(at),oe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,F=null,z=0){const N=Math.pow(2,-z),U=Math.floor(v.image.width*N),oe=Math.floor(v.image.height*N),he=F!==null?F.x:0,le=F!==null?F.y:0;D.setTexture2D(v,0),R.copyTexSubImage2D(R.TEXTURE_2D,z,0,0,he,le,U,oe),Se.unbindTexture()};const js=R.createFramebuffer(),Js=R.createFramebuffer();this.copyTextureToTexture=function(v,F,z=null,N=null,U=0,oe=0){let he,le,ve,Ee,Pe,Oe,Te,Ke,at;const it=v.isCompressedTexture?v.mipmaps[oe]:v.image;if(z!==null)he=z.max.x-z.min.x,le=z.max.y-z.min.y,ve=z.isBox3?z.max.z-z.min.z:1,Ee=z.min.x,Pe=z.min.y,Oe=z.isBox3?z.min.z:0;else{const mt=Math.pow(2,-U);he=Math.floor(it.width*mt),le=Math.floor(it.height*mt),v.isDataArrayTexture?ve=it.depth:v.isData3DTexture?ve=Math.floor(it.depth*mt):ve=1,Ee=0,Pe=0,Oe=0}N!==null?(Te=N.x,Ke=N.y,at=N.z):(Te=0,Ke=0,at=0);const Ze=re.convert(F.format),_t=re.convert(F.type);let Me;F.isData3DTexture?(D.setTexture3D(F,0),Me=R.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(D.setTexture2DArray(F,0),Me=R.TEXTURE_2D_ARRAY):(D.setTexture2D(F,0),Me=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,F.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,F.unpackAlignment);const Tt=R.getParameter(R.UNPACK_ROW_LENGTH),Ve=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Ct=R.getParameter(R.UNPACK_SKIP_PIXELS),Nt=R.getParameter(R.UNPACK_SKIP_ROWS),un=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,it.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,it.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ee),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pe),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Oe);const vn=v.isDataArrayTexture||v.isData3DTexture,Je=F.isDataArrayTexture||F.isData3DTexture;if(v.isDepthTexture){const mt=p.get(v),Qt=p.get(F),dt=p.get(mt.__renderTarget),en=p.get(Qt.__renderTarget);Se.bindFramebuffer(R.READ_FRAMEBUFFER,dt.__webglFramebuffer),Se.bindFramebuffer(R.DRAW_FRAMEBUFFER,en.__webglFramebuffer);for(let Sn=0;Sn<ve;Sn++)vn&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,p.get(v).__webglTexture,U,Oe+Sn),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,p.get(F).__webglTexture,oe,at+Sn)),R.blitFramebuffer(Ee,Pe,he,le,Te,Ke,he,le,R.DEPTH_BUFFER_BIT,R.NEAREST);Se.bindFramebuffer(R.READ_FRAMEBUFFER,null),Se.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(U!==0||v.isRenderTargetTexture||p.has(v)){const mt=p.get(v),Qt=p.get(F);Se.bindFramebuffer(R.READ_FRAMEBUFFER,js),Se.bindFramebuffer(R.DRAW_FRAMEBUFFER,Js);for(let dt=0;dt<ve;dt++)vn?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,mt.__webglTexture,U,Oe+dt):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,mt.__webglTexture,U),Je?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Qt.__webglTexture,oe,at+dt):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Qt.__webglTexture,oe),U!==0?R.blitFramebuffer(Ee,Pe,he,le,Te,Ke,he,le,R.COLOR_BUFFER_BIT,R.NEAREST):Je?R.copyTexSubImage3D(Me,oe,Te,Ke,at+dt,Ee,Pe,he,le):R.copyTexSubImage2D(Me,oe,Te,Ke,Ee,Pe,he,le);Se.bindFramebuffer(R.READ_FRAMEBUFFER,null),Se.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else Je?v.isDataTexture||v.isData3DTexture?R.texSubImage3D(Me,oe,Te,Ke,at,he,le,ve,Ze,_t,it.data):F.isCompressedArrayTexture?R.compressedTexSubImage3D(Me,oe,Te,Ke,at,he,le,ve,Ze,it.data):R.texSubImage3D(Me,oe,Te,Ke,at,he,le,ve,Ze,_t,it):v.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,oe,Te,Ke,he,le,Ze,_t,it.data):v.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,oe,Te,Ke,it.width,it.height,Ze,it.data):R.texSubImage2D(R.TEXTURE_2D,oe,Te,Ke,he,le,Ze,_t,it);R.pixelStorei(R.UNPACK_ROW_LENGTH,Tt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ve),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ct),R.pixelStorei(R.UNPACK_SKIP_ROWS,Nt),R.pixelStorei(R.UNPACK_SKIP_IMAGES,un),oe===0&&F.generateMipmaps&&R.generateMipmap(Me),Se.unbindTexture()},this.initRenderTarget=function(v){p.get(v).__webglFramebuffer===void 0&&D.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?D.setTextureCube(v,0):v.isData3DTexture?D.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?D.setTexture2DArray(v,0):D.setTexture2D(v,0),Se.unbindTexture()},this.resetState=function(){C=0,V=0,G=null,Se.reset(),te.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=ze._getDrawingBufferColorSpace(e),t.unpackColorSpace=ze._getUnpackColorSpace()}}export{It as B,We as C,ba as L,Gs as O,Ca as P,Uf as S,I as V,Of as W,Vt as a,Nf as b,If as c};
|