mg696 commited on
Commit
bc5f648
·
verified ·
1 Parent(s): f6d7169

v44: app-extra.js - dome input + light editor logic

Browse files
Files changed (1) hide show
  1. app-extra.js +38 -0
app-extra.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // app-extra.js v44: ドーム分離 + ライト編集ロジック
2
+ (function(){
3
+ function waitReady(cb){const ck=()=>{if(window.__appReady)cb();else setTimeout(ck,200)};ck()}
4
+ waitReady(()=>{
5
+ // ===== 7: ドーム分離 =====
6
+ const domeInput=document.getElementById('dome-input');
7
+ if(domeInput){domeInput.addEventListener('change',async e=>{
8
+ if(!e.target.files.length)return;
9
+ window.__showLoading(true,"ドーム展開中...");
10
+ await window.__processFiles(e.target.files,'stage');
11
+ let pmx=window.__findFileInMap('.pmx','stage')||window.__findFileInMap('.pmd','stage');
12
+ if(pmx){document.getElementById('dome-label').classList.add('ready');window.__loadPmx(pmx,'stage');window.__dbg('[Dome]読込','info')}
13
+ else{window.__showLoading(false);window.__updateStatus("ドームPMXがありません♡")}
14
+ })}
15
+
16
+ // ===== 1: ライト編集 =====
17
+ ['x','y','z'].forEach(axis=>{
18
+ const sl=document.getElementById('main-light-'+axis);
19
+ const vl=document.getElementById('main-light-'+axis+'-val');
20
+ if(!sl||!vl)return;
21
+ sl.addEventListener('input',()=>{const v=parseFloat(sl.value);vl.textContent=v;if(window.__mainLight)window.__mainLight.position[axis]=v})
22
+ });
23
+ ['x','y','z'].forEach(axis=>{
24
+ const sl=document.getElementById('sub-light-'+axis);
25
+ const vl=document.getElementById('sub-light-'+axis+'-val');
26
+ if(!sl||!vl)return;
27
+ sl.addEventListener('input',()=>{const v=parseFloat(sl.value);vl.textContent=v;if(window.__subLight)window.__subLight.position[axis]=v})
28
+ });
29
+ const mc=document.getElementById('main-light-color');
30
+ if(mc)mc.addEventListener('input',()=>{if(window.__mainLight)window.__mainLight.color.set(mc.value)});
31
+ const sc=document.getElementById('sub-light-color');
32
+ if(sc)sc.addEventListener('input',()=>{if(window.__subLight)window.__subLight.color.set(sc.value)});
33
+ const ac=document.getElementById('amb-light-color');
34
+ if(ac)ac.addEventListener('input',()=>{if(window.__ambLight)window.__ambLight.color.set(ac.value)});
35
+
36
+ window.__dbg('[v44]ライト編集+ドーム分離 初期化完了','info');
37
+ });
38
+ })();