Visecall commited on
Commit
155fbcd
·
verified ·
1 Parent(s): 76f3432

Transition assets: scripts (part 31)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiManager.lua +554 -0
  2. scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiObjectExtension.lua +436 -0
  3. scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiParamsSetter.lua +388 -0
  4. scripts/7681159605375880466/config.json +16 -0
  5. scripts/7681159605375880466/extra.json +6 -0
  6. scripts/7681165424754429202/AmazingFeature/content.json +7 -0
  7. scripts/7681165424754429202/AmazingFeature/js/JSSys.js +89 -0
  8. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/EffectComposer.js +1 -0
  9. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/RenderPass.js +1 -0
  10. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/ShaderPass.js +1 -0
  11. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/customEasings.js +1 -0
  12. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/scriptScene.js +117 -0
  13. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/three-amg-wrapper.js +1 -0
  14. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/tween.js +1 -0
  15. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Box2.js +1 -0
  16. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Box3.js +1 -0
  17. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BoxGeometry.js +1 -0
  18. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BufferAttribute.js +1 -0
  19. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BufferGeometry.js +1 -0
  20. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CapsuleGeometry.js +1 -0
  21. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Color.js +1 -0
  22. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Constants.js +1 -0
  23. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CurvePath.js +1 -0
  24. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CylinderGeometry.js +1 -0
  25. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Earcut.js +1 -0
  26. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Euler.js +1 -0
  27. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ExtrudeGeometry.js +1 -0
  28. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Group.js +1 -0
  29. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Material.js +1 -0
  30. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/MathUtils.js +1 -0
  31. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Matrix4.js +1 -0
  32. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Mesh.js +1 -0
  33. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/MeshBasicMaterial.js +1 -0
  34. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Object3D.js +1 -0
  35. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/PerspectiveCamera.js +1 -0
  36. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/PlaneGeometry.js +1 -0
  37. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Quaternion.js +1 -0
  38. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ShaderMaterial.js +1 -0
  39. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Shape.js +1 -0
  40. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ShapeGeometry.js +1 -0
  41. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/SphereGeometry.js +1 -0
  42. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Texture.js +1 -0
  43. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector2.js +1 -0
  44. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector3.js +1 -0
  45. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector4.js +1 -0
  46. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/WebGLRenderer.js +1 -0
  47. scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/runtime.js +1 -0
  48. scripts/7681165424754429202/AmazingFeature/xshader/Unlit.frag +25 -0
  49. scripts/7681165424754429202/AmazingFeature/xshader/Unlit.vert +35 -0
  50. scripts/7681165424754429202/AmazingFeature/xshader/noface.frag +7 -0
scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiManager.lua ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ local isEditor = (Amaz.Macros and Amaz.Macros.EditorSDK) and true or false
2
+ local exports = exports or {}
3
+ local LumiManager = LumiManager or {}
4
+ LumiManager.__index = LumiManager
5
+ ---@class LumiManager : ScriptComponent
6
+ ---@field debugTime number [UI(Range={0, 6}, Drag)]
7
+ ---@field autoPlay boolean
8
+ ---@field lumiEffectRoot Transform
9
+ ---@field start_render_layer int
10
+ ---@field start_render_order int
11
+
12
+ local AE_EFFECT_TAG = 'AE_EFFECT_TAG LumiTag'
13
+
14
+ local EffectType = {
15
+ Effect = 'effect',
16
+ Transition = 'transition',
17
+ VideoAnimation = 'videoAnimation',
18
+ EffectXT = 'xtEffect',
19
+ FilterXT = 'xtFilter',
20
+ }
21
+
22
+ local AnimationMode = {
23
+ Once = 0,
24
+ Loop = 1,
25
+ StretchOnce = 2,
26
+ StretchLoop = 3,
27
+ }
28
+
29
+ local function clamp(val, min, max)
30
+ return math.min(math.max(val, min), max)
31
+ end
32
+
33
+ local function remap(value, srcMin, srcMax, dstMin, dstMax)
34
+ return dstMin + (value - srcMin) * (dstMax - dstMin) / (srcMax - srcMin)
35
+ end
36
+
37
+ local function handleAllEntityBySingleParent(_trans, func, ...)
38
+ if _trans.children:size() > 0 then
39
+ for i = 1, _trans.children:size() do
40
+ local child = _trans.children:get(i - 1)
41
+ handleAllEntityBySingleParent(child, func, ...)
42
+ end
43
+ end
44
+ func(_trans, ...)
45
+ end
46
+
47
+ local function intervalIntersection(intervals1, intervals2)
48
+ local result = {}
49
+ local i = 1
50
+ local j = 1
51
+
52
+ while i <= #intervals1 and j <= #intervals2 do
53
+ local start1 = intervals1[i][1]
54
+ local end1 = intervals1[i][2]
55
+ local start2 = intervals2[j][1]
56
+ local end2 = intervals2[j][2]
57
+
58
+ local start = math.max(start1, start2)
59
+ local end_ = math.min(end1, end2)
60
+
61
+ if start <= end_ then
62
+ table.insert(result, {start, end_})
63
+ end
64
+ if end1 < end2 then
65
+ i = i + 1
66
+ else
67
+ j = j + 1
68
+ end
69
+ end
70
+ return result
71
+ end
72
+
73
+ function LumiManager.new(construct, ...)
74
+ local self = setmetatable({}, LumiManager)
75
+
76
+ self.lumiEffectRoot = nil
77
+ self.start_render_layer = 1
78
+ self.start_render_order = 1
79
+
80
+ self.InputTex = nil
81
+ self.OutputTex = nil
82
+ self.PingPongTex = nil
83
+
84
+ self.startTime = 0.0
85
+ self.endTime = 6.0
86
+ self.curTime = 0.0
87
+
88
+ self.speed = 1.0
89
+ self.animationMode = AnimationMode.Once
90
+ self.autoPlay = true
91
+ self.debugTime = 0.0
92
+
93
+ -- for XT
94
+ self.cameraStartTime = 0
95
+ self.lastCycle = -1
96
+
97
+ return self
98
+ end
99
+
100
+ function LumiManager:getKeyframeAeTime(aeTime)
101
+ if self.isReverseKeyframes ~= true then
102
+ return aeTime
103
+ end
104
+ return self.compDurations[1] + self.compDurations[2] - aeTime
105
+ end
106
+
107
+ function LumiManager:onStart(comp)
108
+ self.entity = comp.entity
109
+
110
+ self.lumi_obj_extension = includeRelativePath("LumiObjectExtension")
111
+ self.lumi_obj = nil
112
+
113
+ self.keyframes = nil
114
+ self.durations = nil
115
+ self.params = nil
116
+ self.compDurations = {0, 6}
117
+ self.animationInfos = 0
118
+ self.sliderInfos = {}
119
+ self.fadeinInfos = {}
120
+ self.fadeoutInfos = {}
121
+ self.effectType = "effect"
122
+ self.transitionInputIndex = {}
123
+
124
+ self.LumiParamsSetter = includeRelativePath("LumiParamsSetter")
125
+ local ae_export_data = includeRelativePath("LumiExportData")
126
+ if ae_export_data then
127
+ if ae_export_data.ae_keyframes then
128
+ local ae_tools = includeRelativePath("AETools")
129
+ if ae_tools then
130
+ self.keyframes = ae_tools.new(ae_export_data.ae_keyframes)
131
+ end
132
+ end
133
+ if ae_export_data.ae_reverseKeyframes ~= nil then
134
+ self.isReverseKeyframes = ae_export_data.ae_reverseKeyframes
135
+ end
136
+ if ae_export_data.ae_durations ~= nil then
137
+ self.durations = ae_export_data.ae_durations
138
+ end
139
+ if ae_export_data.ae_attribute ~= nil then
140
+ self.params = ae_export_data.ae_attribute
141
+ end
142
+ if ae_export_data.ae_compDurations ~= nil then
143
+ self.compDurations = ae_export_data.ae_compDurations
144
+ self.compDurations[2] = self.compDurations[2]
145
+ end
146
+ if ae_export_data.ae_animationInfos ~= nil then
147
+ self.animationInfos = ae_export_data.ae_animationInfos
148
+ self.animationMode = self.animationInfos.animationMode
149
+ self.loopStart = self.animationInfos.loopStart
150
+ self.speed = self.animationInfos.speedInfo[1]
151
+ end
152
+ if ae_export_data.ae_sliderInfos ~= nil then
153
+ self.sliderInfos = ae_export_data.ae_sliderInfos
154
+ end
155
+ if ae_export_data.ae_fadeinInfos ~= nil then
156
+ self.fadeinInfos = ae_export_data.ae_fadeinInfos
157
+ end
158
+ if ae_export_data.ae_fadeoutInfos ~= nil then
159
+ self.fadeoutInfos = ae_export_data.ae_fadeoutInfos
160
+ end
161
+ if ae_export_data.ae_effectType ~= nil then
162
+ self.effectType = ae_export_data.ae_effectType
163
+ end
164
+ if ae_export_data.ae_cameraMode ~= nil then
165
+ self.cameraMode = ae_export_data.ae_cameraMode
166
+ end
167
+ if ae_export_data.ae_transitionInputIndex ~= nil then
168
+ self.transitionInputIndex = ae_export_data.ae_transitionInputIndex
169
+ end
170
+ end
171
+ if self.LumiParamsSetter then
172
+ self.lumi_params_setter = self.LumiParamsSetter.new(
173
+ self,
174
+ self.params,
175
+ self.keyframes,
176
+ self.effectType,
177
+ self.sliderInfos,
178
+ self.fadeinInfos,
179
+ self.fadeoutInfos
180
+ )
181
+ end
182
+
183
+ if self.effectType == EffectType.VideoAnimation then
184
+ local baseEntity = self.entity:searchEntity('base')
185
+ local videoCamera = baseEntity:searchEntity('videoCamera'):getComponent('Camera')
186
+ local videoRenderer = baseEntity:searchEntity('video'):getComponent('MeshRenderer')
187
+ local modelCamera = baseEntity:searchEntity('modelCamera'):getComponent('Camera')
188
+ local modelRenderer = baseEntity:searchEntity('model'):searchEntity('quad'):getComponent('MeshRenderer')
189
+ local fxaaCamera = baseEntity:searchEntity('fxaaCamera'):getComponent('Camera')
190
+ local fxaaRenderer = baseEntity:searchEntity('fxaa'):getComponent('MeshRenderer')
191
+ local bgCamera = baseEntity:searchEntity('bgCamera'):getComponent('Camera')
192
+ local bgRenderer = baseEntity:searchEntity('bg'):getComponent('MeshRenderer')
193
+ local blendCamera = baseEntity:searchEntity('blendCamera'):getComponent('Camera')
194
+ local blendRenderer = baseEntity:searchEntity('blend'):getComponent('MeshRenderer')
195
+ self.videoAnimationCameraAndRenderer = {
196
+ { camera = videoCamera, renderer = videoRenderer },
197
+ { camera = modelCamera, renderer = modelRenderer },
198
+ { camera = fxaaCamera, renderer = fxaaRenderer },
199
+ { camera = bgCamera, renderer = bgRenderer },
200
+ { camera = blendCamera, renderer = blendRenderer },
201
+ }
202
+ end
203
+ end
204
+
205
+ function LumiManager:onDestroy(comp)
206
+ if self.lumiEffectRoot and self.lumi_obj_extension then
207
+ self.lumi_obj_extension.deregister(self.lumiEffectRoot.entity)
208
+ end
209
+ self.lumi_obj = nil
210
+ self.LumiParamsSetter = nil
211
+ end
212
+
213
+ function LumiManager:getCameraCount()
214
+ if self.lumiEffectRoot == nil then
215
+ Amaz.LOGE(AE_EFFECT_TAG, 'Lumi Effect Root is nil, please check')
216
+ return 0
217
+ end
218
+
219
+ self.lumi_obj = nil
220
+ self:ReRender()
221
+
222
+ local cam_count = 0
223
+ if self.lumi_obj then
224
+ cam_count = self.lumi_obj:getCameraCount()
225
+ Amaz.LOGI(AE_EFFECT_TAG, self.lumi_obj.entity.name .. " camera_count: " .. tostring(cam_count))
226
+ end
227
+ return cam_count
228
+ end
229
+
230
+ function LumiManager:ReRender()
231
+ if self.lumiEffectRoot == nil then
232
+ Amaz.LOGE(AE_EFFECT_TAG, 'Lumi Effect Root is nil, please check')
233
+ return
234
+ end
235
+
236
+ -- re register
237
+ self.lumi_obj = nil
238
+ self:registerLumiObj(self.lumiEffectRoot, 1)
239
+
240
+ if self.lumi_obj == nil then
241
+ Amaz.LOGE(AE_EFFECT_TAG, 'No lumi_obj register')
242
+ return
243
+ end
244
+
245
+ -- change layer & order
246
+ self:updateCameraLayerAndOrder()
247
+
248
+ -- change rt pingpong
249
+ self:updateRtPingpong()
250
+ end
251
+
252
+ function LumiManager:registerLumiObj(_trans, _idx)
253
+ if _trans == nil then return end
254
+ local script_comp = _trans.entity:getComponent("ScriptComponent")
255
+ if script_comp then
256
+ local lua_obj = Amaz.ScriptUtils.getLuaObj(script_comp:getScript())
257
+ if lua_obj then
258
+ self.lumi_obj_extension.deregister(_trans.entity)
259
+ self.lumi_obj = self.lumi_obj_extension.register(_trans.entity)
260
+ end
261
+ end
262
+ end
263
+
264
+ local function _setLayer(_cam, _layer)
265
+ local str = "1"
266
+ for i = 1, _layer do
267
+ str = str .. "0"
268
+ end
269
+ local dynamic_bitset = Amaz.DynamicBitset.new(str)
270
+
271
+ _cam.layerVisibleMask = dynamic_bitset
272
+ end
273
+
274
+ function LumiManager:updateCameraLayerAndOrder()
275
+ if self.lumi_obj then
276
+ local cur_start_layer, cur_start_order = self.lumi_obj:updateCameraLayerAndOrder(self.start_render_layer, self.start_render_order)
277
+
278
+ if self.effectType == EffectType.VideoAnimation then
279
+ cur_start_layer = cur_start_layer + 10
280
+ cur_start_order = cur_start_order + 10
281
+
282
+ for i = 1, #self.videoAnimationCameraAndRenderer do
283
+ local cameraAndRenderer = self.videoAnimationCameraAndRenderer[i]
284
+ local camera = cameraAndRenderer.camera
285
+ local renderer = cameraAndRenderer.renderer
286
+ camera.renderOrder = cur_start_order
287
+ _setLayer(camera, cur_start_layer)
288
+ renderer.entity.layer = cur_start_layer
289
+ cur_start_order = cur_start_order + 1
290
+ cur_start_layer = cur_start_layer + 1
291
+ end
292
+ end
293
+ end
294
+ end
295
+
296
+ function LumiManager:updateRtPingpong()
297
+ if self.lumi_obj then
298
+ self.lumi_obj:updateRt(self.InputTex, self.OutputTex, self.PingPongTex)
299
+ end
300
+ end
301
+
302
+ function LumiManager:updateOutputRtSize()
303
+ if self.lumi_obj then
304
+ self.lumi_obj:updateOutputRtSize(self.width, self.height)
305
+ end
306
+ end
307
+
308
+ function LumiManager:initVideoAnimationLua(comp)
309
+ local modelEntity = comp.entity:searchEntity("model")
310
+ if modelEntity then
311
+ local scriptComp = modelEntity:getComponent("ScriptComponent")
312
+ if scriptComp then
313
+ self.videoAnimationLua = Amaz.ScriptUtils.getLuaObj(scriptComp:getScript())
314
+ end
315
+ end
316
+ end
317
+
318
+ function LumiManager:onUpdate(comp, deltaTime)
319
+ if self.lumiEffectRoot == nil then
320
+ Amaz.LOGE(AE_EFFECT_TAG, 'Lumi Effect Root is nil, please check')
321
+ return
322
+ end
323
+
324
+ if self.lumi_obj == nil then
325
+ self:registerLumiObj(self.lumiEffectRoot, 1)
326
+ self:updateCameraLayerAndOrder()
327
+ end
328
+
329
+ if self.durations and not self.isSetDuration then
330
+ for entityName, durationMap in pairs(self.durations) do
331
+ local isLumiLayer = string.sub(entityName, 1, string.len('LumiLayer')) == 'LumiLayer'
332
+ if isLumiLayer then
333
+ local texDuration = durationMap['texDuration']
334
+ local srcDuration = texDuration['InputTex']
335
+ local baseDuration = texDuration['baseTex']
336
+ local maskDuration = texDuration['maskTex']
337
+ if srcDuration then
338
+ self.lumi_obj:setSubEffectAttr(entityName, 'srcDuration', srcDuration)
339
+ end
340
+ if baseDuration then
341
+ self.lumi_obj:setSubEffectAttr(entityName, 'baseDuration', baseDuration)
342
+ end
343
+ if maskDuration then
344
+ local matteDuration = intervalIntersection(maskDuration, srcDuration)
345
+ self.lumi_obj:setSubEffectAttr(entityName, 'matteDuration', matteDuration)
346
+ end
347
+ end
348
+ end
349
+ self.isSetDuration = true
350
+ end
351
+
352
+ local w = Amaz.BuiltinObject.getInputTextureWidth()
353
+ local h = Amaz.BuiltinObject.getInputTextureHeight()
354
+ if self.InputTex then
355
+ w = self.InputTex.width
356
+ h = self.InputTex.height
357
+ end
358
+ if self.OutputTex and (self.OutputTex.width ~= w or self.OutputTex.height ~= h) then
359
+ Amaz.LOGE(AE_EFFECT_TAG, 'Invalid rt size, input: ' .. w .. 'x' .. h .. ', output: ' .. self.OutputTex.width .. 'x' .. self.OutputTex.height)
360
+ end
361
+ if self.width == nil or self.width ~= w or self.height == nil or self.height ~= h then
362
+ self.width = w
363
+ self.height = h
364
+ self:updateOutputRtSize()
365
+ end
366
+
367
+ self.curTime = self.curTime + deltaTime
368
+ if isEditor then
369
+ self.curTime = self.curTime % self.endTime
370
+ end
371
+ local curTime = (self.curTime - self.startTime) * self.speed + self.startTime
372
+ local startTime = self.startTime
373
+ local endTime = (self.endTime - self.startTime) * self.speed + self.startTime
374
+
375
+ if self.cameraMode then
376
+ if self.animationMode ~= AnimationMode.Loop then
377
+ Amaz.LOGE(AE_EFFECT_TAG, 'Camera mode is not support animationMode: ' .. tostring(self.animationMode))
378
+ return
379
+ end
380
+ curTime = self.curTime - self.cameraStartTime
381
+ endTime = math.huge
382
+ elseif self.effectType == EffectType.EffectXT or self.effectType == EffectType.FilterXT then -- deprecated after 1810 in XT
383
+ startTime = 0
384
+ if self.isVideo == 1 then
385
+ endTime = self.videoTime
386
+ else
387
+ curTime = 0
388
+ endTime = 3
389
+ end
390
+ end
391
+
392
+ local aeTime = curTime;
393
+ local aeDuration = math.max(0.001, self.compDurations[2] - self.compDurations[1])
394
+ if endTime < curTime then
395
+ aeTime = math.max(self.compDurations[1], self.compDurations[2] - (self.endTime - self.curTime))
396
+ else
397
+ local lvDuration = math.max(0.001, endTime - startTime)
398
+ if self.animationMode == AnimationMode.Once then
399
+ aeTime = self.compDurations[1] + curTime - startTime
400
+ aeTime = math.min(aeTime, self.compDurations[2])
401
+ elseif self.animationMode == AnimationMode.Loop then
402
+ if self.cameraMode then
403
+ local cycle = math.floor((curTime - startTime) / aeDuration)
404
+ if self.lastCycle ~= cycle then
405
+ self.lastCycle = cycle
406
+ comp.entity.scene:sendMessage(4999, 1, 0, '')
407
+ end
408
+ end
409
+ if math.floor((curTime - startTime) / aeDuration) < 1 then
410
+ aeTime = self.compDurations[1] + (curTime - startTime) % aeDuration
411
+ else
412
+ local curLoopStart = (self.loopStart - self.compDurations[1]) * self.speed + self.compDurations[1]
413
+ aeTime = self.loopStart + (curTime - startTime - curLoopStart) % (aeDuration - self.loopStart)
414
+ end
415
+ elseif self.animationMode == AnimationMode.StretchOnce then
416
+ aeTime = remap(curTime, startTime, self.endTime, self.compDurations[1], self.compDurations[2])
417
+ aeTime = clamp(aeTime, self.compDurations[1], self.compDurations[2])
418
+ elseif self.animationMode == AnimationMode.StretchLoop then
419
+ local newCurTime = startTime + (curTime - startTime) * self.speed % lvDuration
420
+ aeTime = remap(newCurTime, startTime, endTime, self.compDurations[1], self.compDurations[2])
421
+
422
+ if math.floor((curTime - startTime) * self.speed / lvDuration) >= 1 then
423
+ aeTime = self.compDurations[1] + (aeTime - self.compDurations[1]) % (self.compDurations[2] - self.loopStart) + self.loopStart
424
+ end
425
+ end
426
+ end
427
+
428
+ if self.effectType == EffectType.Transition then
429
+ local input1 = Amaz.BuiltinObject.getUserTexture("#TransitionInput0")
430
+ local input2 = Amaz.BuiltinObject.getUserTexture("#TransitionInput1")
431
+ if input1 and input2 then
432
+ for index, transitionInputInfo in ipairs(self.transitionInputIndex) do
433
+ local entityName = transitionInputInfo[1]
434
+ local texName = transitionInputInfo[2]
435
+ local inputIndex = transitionInputInfo[3]
436
+ if inputIndex == 0 then
437
+ self.lumi_obj:setSubEffectAttr(entityName, texName, input1)
438
+ self.lumi_obj:setSubEffectAttr(entityName, 'algoSlot', 0)
439
+ else
440
+ self.lumi_obj:setSubEffectAttr(entityName, texName, input2)
441
+ self.lumi_obj:setSubEffectAttr(entityName, 'algoSlot', 1)
442
+ end
443
+ end
444
+ aeTime = Amaz.Input.frameTimestamp * (self.compDurations[2] - self.compDurations[1]) + self.compDurations[1]
445
+ end
446
+ elseif self.effectType == EffectType.VideoAnimation then
447
+ if self.videoAnimationLua == nil then
448
+ self:initVideoAnimationLua(comp)
449
+ end
450
+ if self.videoAnimationLua ~= nil then
451
+ aeTime = remap(self.videoAnimationLua.curTime, 0, self.videoAnimationLua.duration, self.compDurations[1], self.compDurations[2])
452
+ end
453
+ end
454
+
455
+ if isEditor then
456
+ if self.autoPlay then
457
+ self.debugTime = curTime % (self.compDurations[2] - self.compDurations[1]) + self.compDurations[1]
458
+ aeTime = self.debugTime
459
+ else
460
+ aeTime = self.debugTime
461
+ end
462
+ elseif self.effectType == EffectType.VideoAnimation or self.effectType == EffectType.Transition then
463
+ self.curTime = aeTime
464
+ end
465
+
466
+ if self.lumi_obj then
467
+ self.lumi_obj:setEffectAttrRecursively("startTime", self.startTime)
468
+ self.lumi_obj:setEffectAttrRecursively("endTime", self.endTime)
469
+ self.lumi_obj:setEffectAttrRecursively("curTime", self.curTime)
470
+ self.lumi_obj:setEffectAttrRecursively("aeTime", aeTime)
471
+ self.lumi_obj:setEffectAttrRecursively("aeDuration", aeDuration)
472
+ end
473
+
474
+ if self.lumi_params_setter and self.lumi_params_setter.initParams then
475
+ self.lumi_params_setter:initParams(self.lumi_obj)
476
+ end
477
+ if self.lumi_params_setter and self.lumi_params_setter.updateKeyFrameData then
478
+ self.lumi_params_setter:updateKeyFrameData(self.lumi_obj, aeTime)
479
+ end
480
+ if self.lumi_params_setter and self.lumi_params_setter.updateSlider then
481
+ self.lumi_params_setter:updateSlider(self.lumi_obj, aeTime)
482
+ end
483
+ if self.lumi_params_setter and self.lumi_params_setter.updateFade then
484
+ if self.effectType == EffectType.Effect then
485
+ self.lumi_params_setter:updateFade(self.lumi_obj, self.startTime, self.endTime, self.curTime, self.compDurations, aeTime)
486
+ end
487
+ end
488
+
489
+ if self.lumi_obj and self.durations ~= nil then
490
+ aeTime = math.min(math.max(aeTime, self.compDurations[1]), self.compDurations[2])
491
+ for entityName, durationMap in pairs(self.durations) do
492
+ local nodeDuration = durationMap['nodeDuration']
493
+ local visible = false
494
+ for j = 1, #nodeDuration do
495
+ if nodeDuration[j][1] <= aeTime and aeTime < nodeDuration[j][2] then
496
+ visible = true
497
+ break
498
+ end
499
+ end
500
+ self.lumi_obj:setVisible(entityName, visible)
501
+ end
502
+ end
503
+ if self.lumi_obj and self.lumi_obj.updateMaterials then
504
+ self.lumi_obj:updateMaterials(deltaTime)
505
+ end
506
+ end
507
+
508
+ -- function LumiManager:onLateUpdate(comp, deltaTime)
509
+ -- collectgarbage("collect")
510
+ -- end
511
+
512
+ function LumiManager:onEvent(comp, event)
513
+ if self.lumiEffectRoot == nil then
514
+ Amaz.LOGE(AE_EFFECT_TAG, 'Lumi Effect Root is nil, please check')
515
+ return
516
+ end
517
+
518
+ if self.lumi_obj == nil then
519
+ self:registerLumiObj(self.lumiEffectRoot, 1)
520
+ self:updateCameraLayerAndOrder()
521
+ end
522
+
523
+ if self.lumi_obj == nil then
524
+ Amaz.LOGE(AE_EFFECT_TAG, 'Failed to find lumi_obj')
525
+ return
526
+ end
527
+
528
+ if self.effectType == EffectType.Effect then
529
+ if event.args:get(0) == 'effects_adjust_speed' then
530
+ local value = event.args:get(1)
531
+ if self.animationInfos then
532
+ if value < 0 or value > 1 then
533
+ Amaz.LOGE(AE_EFFECT_TAG, 'Invalid effects_adjust_speed value: ' .. value)
534
+ end
535
+ self.speed = remap(clamp(value, 0, 1), 0, 1, self.animationInfos.speedInfo[2], self.animationInfos.speedInfo[3])
536
+ else
537
+ self.speed = value
538
+ end
539
+ end
540
+ elseif event.args:get(0) == 'start_time' and self.cameraMode then
541
+ self.cameraStartTime = event.args:get(2)
542
+ elseif event.args:get(0) == 'is_video' and (self.effectType == EffectType.EffectXT or self.effectType == EffectType.FilterXT) then -- deprecated after 1810 in XT
543
+ self.isVideo = event.args:get(2)
544
+ elseif event.args:get(0) == 'video_time' and (self.effectType == EffectType.EffectXT or self.effectType == EffectType.FilterXT) then -- deprecated after 1810 in XT
545
+ self.videoTime = event.args:get(2)
546
+ end
547
+
548
+ if self.lumi_params_setter and self.lumi_params_setter.onEvent then
549
+ self.lumi_params_setter:onEvent(self.lumi_obj, event)
550
+ end
551
+ end
552
+
553
+ exports.LumiManager = LumiManager
554
+ return exports
scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiObjectExtension.lua ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ local LumiObjectExtension = {}
3
+ LumiObjectExtension.__index = LumiObjectExtension
4
+
5
+ local AE_EFFECT_TAG = 'AE_EFFECT_TAG LumiTag-LumiObjectExtension'
6
+
7
+ local function handleAllEntityBySingleParent(_trans, func, func2, ...)
8
+ if _trans.children:size() > 0 and func2(_trans, ...) then
9
+ for i = 1, _trans.children:size() do
10
+ local child = _trans.children:get(i-1)
11
+ handleAllEntityBySingleParent(child, func, func2, ...)
12
+ end
13
+ end
14
+ func(_trans, ...)
15
+ end
16
+
17
+ local function CreateRenderTexture(width, height)
18
+ local rt = Amaz.RenderTexture()
19
+ rt.width = width
20
+ rt.height = height
21
+ rt.depth = 1
22
+ rt.filterMag = Amaz.FilterMode.LINEAR
23
+ rt.filterMin = Amaz.FilterMode.LINEAR
24
+ rt.filterMipmap = Amaz.FilterMipmapMode.NONE
25
+ rt.attachment = Amaz.RenderTextureAttachment.NONE
26
+ return rt
27
+ end
28
+
29
+ function LumiObjectExtension.register(_ent)
30
+ if _ent == nil then return nil end
31
+ local scriptComp = _ent:getComponent("ScriptComponent")
32
+ if scriptComp == nil then return nil end
33
+ local effect_lua = Amaz.ScriptUtils.getLuaObj(scriptComp:getScript())
34
+ if effect_lua == nil then return nil end
35
+
36
+ local self = setmetatable({}, LumiObjectExtension)
37
+ self.entity = _ent
38
+ self.scriptComp = scriptComp
39
+ self.trans = _ent:getComponent("Transform")
40
+ self.effect_lua = effect_lua
41
+ if effect_lua.__lumi_type~= nil then
42
+ self.__lumi_type = effect_lua.__lumi_type
43
+ else
44
+ self.__lumi_type = "lumi_obj"
45
+ end
46
+ if effect_lua.__lumi_rt_pingpong_type~= nil then
47
+ self.__lumi_rt_pingpong_type = effect_lua.__lumi_rt_pingpong_type
48
+ else
49
+ self.__lumi_rt_pingpong_type = "custom"
50
+ end
51
+
52
+ if self.entity:getComponents("Camera"):size() > 0 then
53
+ Amaz.LOGE(AE_EFFECT_TAG, "Error: root entity has camera attached")
54
+ return nil
55
+ end
56
+ self.subLumiObjExt = {}
57
+ if self.__lumi_type == "lumi_effect" then
58
+ for i = 1, self.trans.children:size() do
59
+ local child = self.trans.children:get(i-1)
60
+ local objExt = LumiObjectExtension.register(child.entity)
61
+ if objExt and child.entity.name ~= '' then
62
+ self.subLumiObjExt[child.entity.name] = objExt
63
+ end
64
+ end
65
+ end
66
+ effect_lua.__lumi_obj_ext = self
67
+ return self
68
+ end
69
+
70
+ function LumiObjectExtension.deregister(_ent)
71
+ if _ent == nil then return nil end
72
+ local scriptComp = _ent:getComponent("ScriptComponent")
73
+ if scriptComp == nil then return nil end
74
+ local effect_lua = Amaz.ScriptUtils.getLuaObj(scriptComp:getScript())
75
+ if effect_lua == nil then return nil end
76
+ local lumi_obj = effect_lua.__lumi_obj_ext
77
+ if lumi_obj == nil then return nil end
78
+
79
+ if lumi_obj.__lumi_type == "lumi_effect" then
80
+ for i = 1, lumi_obj.trans.children:size() do
81
+ local child = lumi_obj.trans.children:get(i-1)
82
+ LumiObjectExtension.deregister(child.entity)
83
+ end
84
+ end
85
+ lumi_obj.entity = nil
86
+ lumi_obj.trans = nil
87
+ lumi_obj.effect_lua = nil
88
+ lumi_obj.scriptComp = nil
89
+ lumi_obj.subLumiObjExt = nil
90
+ lumi_obj.__lumi_type = nil
91
+ lumi_obj.__lumi_rt_pingpong_type = nil
92
+ effect_lua.__lumi_obj_ext = nil
93
+ end
94
+
95
+ function LumiObjectExtension.getLumiObjExt(_ent)
96
+ if _ent == nil then return nil end
97
+ local scriptComp = _ent:getComponent("ScriptComponent")
98
+ if scriptComp == nil then return nil end
99
+ local effect_lua = Amaz.ScriptUtils.getLuaObj(scriptComp:getScript())
100
+ if effect_lua == nil then return nil end
101
+ return effect_lua.__lumi_obj_ext
102
+ end
103
+
104
+ function LumiObjectExtension:searchSubLumiObjExt(name)
105
+ if self.trans.entity.name == name then
106
+ return self
107
+ end
108
+ if name and self.subLumiObjExt[name] then
109
+ return self.subLumiObjExt[name]
110
+ end
111
+ for _, subObj in pairs(self.subLumiObjExt) do
112
+ local obj = subObj:searchSubLumiObjExt(name)
113
+ if obj then
114
+ return obj
115
+ end
116
+ end
117
+ return nil
118
+ end
119
+
120
+ function LumiObjectExtension:setInputTex(_tex)
121
+ if self.effect_lua then
122
+ self.effect_lua.InputTex = _tex
123
+ if self.scriptComp and self.scriptComp.properties then
124
+ self.scriptComp.properties:set('InputTex', _tex)
125
+ end
126
+ end
127
+ end
128
+
129
+ function LumiObjectExtension:setOutputTex(_tex)
130
+ if self.effect_lua then
131
+ self.effect_lua.OutputTex = _tex
132
+ if self.scriptComp and self.scriptComp.properties then
133
+ self.scriptComp.properties:set('OutputTex', _tex)
134
+ end
135
+ end
136
+ end
137
+
138
+ function LumiObjectExtension:getInputTex()
139
+ if self.effect_lua then
140
+ return self.effect_lua.InputTex
141
+ end
142
+ return nil
143
+ end
144
+
145
+ function LumiObjectExtension:getOutputTex()
146
+ if self.effect_lua then
147
+ return self.effect_lua.OutputTex
148
+ end
149
+ return nil
150
+ end
151
+
152
+ function LumiObjectExtension:setInputTexSizes(inputSize, originalSize)
153
+ assert(type(inputSize)=="table", "inputSize should be table")
154
+ if self.effect_lua and self.effect_lua.setInputTexSize then
155
+ self.effect_lua:setInputTexSize(inputSize)
156
+ end
157
+ if self.effect_lua and self.effect_lua.setInputOriginalTexSize then
158
+ self.effect_lua:setInputOriginalTexSize(originalSize)
159
+ end
160
+ self._inputTexSize, self._originalTexSize = inputSize, originalSize
161
+ end
162
+
163
+ function LumiObjectExtension:getOutputTexSizes()
164
+ local inputSize = (self.effect_lua and self.effect_lua.getOutputTexSize) and self.effect_lua:getOutputTexSize() or self._inputTexSize
165
+ local originalSize = (self.effect_lua and self.effect_lua.getOutputOriginalTexSize) and self.effect_lua:getOutputOriginalTexSize() or self._originalTexSize
166
+ return inputSize, originalSize
167
+ end
168
+
169
+ function LumiObjectExtension:needChangeOutputTexSize()
170
+ if self.effect_lua and self.effect_lua.__lumi_will_change_out_size then
171
+ return self.effect_lua.__lumi_will_change_out_size
172
+ end
173
+ if self._inputTexSize~=nil and self.effect_lua and self.effect_lua.getOutputTexSize then
174
+ local outSize = self.effect_lua:getOutputTexSize()
175
+ return (outSize[1] ~= self._inputTexSize[1] or outSize[2] ~= self._inputTexSize[2])
176
+ end
177
+ return false
178
+ end
179
+
180
+ function LumiObjectExtension:updateRt(_input_tex, _output_tex, _pingpong_tex)
181
+ self:setInputTex(_input_tex)
182
+ self:setOutputTex(_output_tex)
183
+ if self.effect_lua and self.effect_lua.updateRenderTexture ~= nil then
184
+ self.effect_lua:updateRenderTexture()
185
+ end
186
+ if self.__lumi_type == "lumi_effect" and self.__lumi_rt_pingpong_type == "auto" then
187
+ local lumi_obj_list = {}
188
+ local function collect_lumi_obj(_trans)
189
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(_trans.entity)
190
+ if lumi_obj_ext and (lumi_obj_ext.__lumi_type == "lumi_obj" or lumi_obj_ext.__lumi_rt_pingpong_type == "custom") then
191
+ table.insert(lumi_obj_list, lumi_obj_ext)
192
+ end
193
+ end
194
+ local function collect_lumi_obj_flag(_trans)
195
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(_trans.entity)
196
+ if lumi_obj_ext and lumi_obj_ext.__lumi_type == "lumi_effect" and lumi_obj_ext.__lumi_rt_pingpong_type == "auto" then
197
+ return true
198
+ end
199
+ return false
200
+ end
201
+ handleAllEntityBySingleParent(self.trans, collect_lumi_obj, collect_lumi_obj_flag)
202
+
203
+ if _pingpong_tex then
204
+ self._pingpong_tex = _pingpong_tex
205
+ elseif #lumi_obj_list > 1 then
206
+ self._pingpong_tex = CreateRenderTexture(_output_tex.width, _output_tex.height)
207
+ end
208
+ local pingpong = { _output_tex, self._pingpong_tex }
209
+ if #lumi_obj_list%2 == 0 then
210
+ pingpong = { self._pingpong_tex, _output_tex }
211
+ end
212
+ for i = 1, #lumi_obj_list do
213
+ local lumi_obj = lumi_obj_list[i]
214
+ if lumi_obj then
215
+ local idx1 = (i-1)%2+1
216
+ local idx2 = (i)%2+1
217
+ if i == 1 then
218
+ lumi_obj:setInputTex(_input_tex)
219
+ lumi_obj:setOutputTex(pingpong[idx1])
220
+ else
221
+ lumi_obj:setInputTex(pingpong[idx2])
222
+ lumi_obj:setOutputTex(pingpong[idx1])
223
+ end
224
+ if lumi_obj.effect_lua and lumi_obj.effect_lua.updateRenderTexture ~= nil then
225
+ lumi_obj.effect_lua:updateRenderTexture()
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
231
+
232
+ function LumiObjectExtension:updateOutputRtSize(width, height)
233
+ if self.__lumi_type == "lumi_effect" then
234
+ for i = 1, self.trans.children:size() do
235
+ local child = self.trans.children:get(i - 1)
236
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(child.entity)
237
+ if lumi_obj_ext then
238
+ lumi_obj_ext:updateOutputRtSize(width, height)
239
+ end
240
+ end
241
+ end
242
+ local tex = self:getOutputTex()
243
+ if tex then
244
+ tex.width = width
245
+ tex.height = height
246
+ end
247
+ end
248
+
249
+ function LumiObjectExtension:getCameraCount()
250
+ local cam_count = 0
251
+
252
+ if self.__lumi_type == "lumi_effect" then
253
+ for i = 1, self.trans.children:size() do
254
+ local child = self.trans.children:get(i-1)
255
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(child.entity)
256
+ if lumi_obj_ext then
257
+ cam_count = cam_count + lumi_obj_ext:getCameraCount()
258
+ else
259
+ local cam = child.entity:getComponent("Camera")
260
+ if cam then
261
+ cam_count = cam_count + 1
262
+ end
263
+ end
264
+ end
265
+ elseif self.__lumi_type == "lumi_obj" then
266
+ for i = 1, self.trans.children:size() do
267
+ local child = self.trans.children:get(i-1)
268
+ local cam = child.entity:getComponent("Camera")
269
+ if cam then
270
+ cam_count = cam_count + 1
271
+ end
272
+ end
273
+ end
274
+
275
+ return cam_count
276
+ end
277
+
278
+ local function _setLayer(_cam, _layer)
279
+ local str = "1"
280
+ for i = 1, _layer do
281
+ str = str.."0"
282
+ end
283
+ local dynamic_bitset = Amaz.DynamicBitset.new(str)
284
+
285
+ _cam.layerVisibleMask = dynamic_bitset
286
+ end
287
+
288
+ function LumiObjectExtension:updateCameraLayerAndOrder(_start_layer, _start_order)
289
+ function updateRendererEntityLayer(trans, layer)
290
+ local renderers = trans.entity:getComponentsRecursive("Renderer")
291
+ for i = 0, renderers:size() - 1 do
292
+ local renderer = renderers:get(i)
293
+ if renderer then
294
+ renderer.entity.layer = layer
295
+ end
296
+ end
297
+ end
298
+
299
+ local lastCamera = nil
300
+
301
+ local cur_start_layer = _start_layer
302
+ local cur_start_order = _start_order
303
+
304
+ if self.__lumi_type == "lumi_obj" then
305
+ for i = 1, self.trans.children:size() do
306
+ local curTrans = self.trans.children:get(i-1)
307
+ local cam = curTrans.entity:getComponent("Camera")
308
+ if cam then
309
+ if lastCamera then
310
+ cur_start_order = cur_start_order + 1
311
+ cur_start_layer = cur_start_layer + 1
312
+ end
313
+ lastCamera = cam
314
+ cam.renderOrder = cur_start_order
315
+ _setLayer(cam, cur_start_layer)
316
+ for j = 1, curTrans.children:size() do
317
+ local rendererTrans = curTrans.children:get(j-1)
318
+ updateRendererEntityLayer(rendererTrans, cur_start_layer)
319
+ end
320
+ elseif lastCamera then
321
+ updateRendererEntityLayer(curTrans, cur_start_layer)
322
+ end
323
+ end
324
+
325
+ elseif self.__lumi_type == "lumi_effect" then
326
+ for i = 1, self.trans.children:size() do
327
+ local child = self.trans.children:get(i-1)
328
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(child.entity)
329
+ if lumi_obj_ext then
330
+ lumi_obj_ext:updateCameraLayerAndOrder(cur_start_layer, cur_start_order)
331
+ local cam_count = lumi_obj_ext:getCameraCount()
332
+ cur_start_layer = cur_start_layer + cam_count
333
+ cur_start_order = cur_start_order + cam_count
334
+ else
335
+ local cam = child.entity:getComponent("Camera")
336
+ if cam then
337
+ cam.renderOrder = cur_start_order
338
+ _setLayer(cam, cur_start_layer)
339
+ for j = 1, child.children:size() do
340
+ local rendererTrans = child.children:get(j-1)
341
+ updateRendererEntityLayer(rendererTrans, cur_start_layer)
342
+ end
343
+ cur_start_order = cur_start_order + 1
344
+ cur_start_layer = cur_start_layer + 1
345
+ end
346
+ end
347
+ end
348
+ end
349
+
350
+ return cur_start_layer, cur_start_order
351
+ end
352
+
353
+ function LumiObjectExtension:setEffectAttr(key, value)
354
+ if self.effect_lua and self.effect_lua.setEffectAttr ~= nil then
355
+ self.effect_lua:setEffectAttr(key, value, self.scriptComp)
356
+ else
357
+ if self.effect_lua and self.effect_lua[key] ~= nil then
358
+ self.effect_lua[key] = value
359
+ if self.scriptComp and self.scriptComp.properties ~= nil then
360
+ self.scriptComp.properties:set(key, value)
361
+ end
362
+ end
363
+ end
364
+ end
365
+
366
+ function LumiObjectExtension:getEffectAttr(key)
367
+ if self.effect_lua and self.effect_lua.getEffectAttr ~= nil then
368
+ return self.effect_lua:getEffectAttr(key, self.scriptComp)
369
+ else
370
+ if self.effect_lua and self.effect_lua[key] ~= nil then
371
+ return self.effect_lua[key]
372
+ end
373
+ end
374
+ return nil
375
+ end
376
+
377
+ function LumiObjectExtension:setSubEffectAttr(subName, key, value)
378
+ local subObj = self:searchSubLumiObjExt(subName)
379
+ if subObj then
380
+ subObj:setEffectAttr(key, value)
381
+ end
382
+ end
383
+
384
+ function LumiObjectExtension:getSubEffectAttr(subName, key)
385
+ local subObj = self:searchSubLumiObjExt(subName)
386
+ if subObj then
387
+ return subObj:getEffectAttr(key)
388
+ end
389
+ return nil
390
+ end
391
+
392
+ function LumiObjectExtension:setEffectAttrRecursively(key, value)
393
+ if self.__lumi_type == "lumi_effect" then
394
+ for i = 1, self.trans.children:size() do
395
+ local child = self.trans.children:get(i-1)
396
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(child.entity)
397
+ if lumi_obj_ext then
398
+ lumi_obj_ext:setEffectAttrRecursively(key, value)
399
+ end
400
+ end
401
+ self:setEffectAttr(key, value)
402
+ elseif self.__lumi_type == "lumi_obj" then
403
+ self:setEffectAttr(key, value)
404
+ end
405
+ end
406
+
407
+ function LumiObjectExtension:updateMaterials(time)
408
+ if self.effect_lua and self.scriptComp and self.entity and self.entity.visible then
409
+ if self.effect_lua.updateMaterial ~= nil then
410
+ self.effect_lua:updateMaterial(self.scriptComp, time)
411
+ elseif self.effect_lua.onUpdate ~= nil then
412
+ self.effect_lua:onUpdate(self.scriptComp, time)
413
+ end
414
+
415
+ for i = 1, self.trans.children:size() do
416
+ local child = self.trans.children:get(i-1)
417
+ local lumi_obj_ext = LumiObjectExtension.getLumiObjExt(child.entity)
418
+ if lumi_obj_ext then
419
+ lumi_obj_ext:updateMaterials(time)
420
+ end
421
+ end
422
+ end
423
+ end
424
+
425
+ function LumiObjectExtension:setVisible(subName, visible)
426
+ local subObj = self:searchSubLumiObjExt(subName)
427
+ if subObj and subObj.effect_lua then
428
+ if subObj.effect_lua.setVisible then
429
+ subObj.effect_lua:setVisible(visible)
430
+ else
431
+ subObj.entity.visible = visible
432
+ end
433
+ end
434
+ end
435
+
436
+ return LumiObjectExtension
scripts/7681159605375880466/AmazingFeature/lua/LumiFamily/LumiParamsSetter.lua ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ local LumiParamsSetter = {}
2
+ LumiParamsSetter.__index = LumiParamsSetter
3
+
4
+ local AE_EFFECT_TAG = 'AE_EFFECT_TAG LumiTag'
5
+
6
+ function LumiParamsSetter.new(lumiManager, params, keyframes, effectType, sliderInfos, fadeinInfos, fadeoutInfos)
7
+ local self = setmetatable({}, LumiParamsSetter)
8
+ self.lumiManager = lumiManager
9
+ self.params = params
10
+ self.keyframes = keyframes
11
+ self.sliderInfos = sliderInfos
12
+ self.sliderParams = {}
13
+ self.XTEvent = (effectType == 'xtFilter' or effectType == 'xtEffect')
14
+ self.fadeinInfos = fadeinInfos
15
+ self.fadeoutInfos = fadeoutInfos
16
+ self.afterSliderParams = {}
17
+
18
+ return self
19
+ end
20
+
21
+ local function clamp(val, min, max)
22
+ return math.max(math.min(val, max), min)
23
+ end
24
+
25
+ local function mix(a, b, t)
26
+ return a * (1 - t) + b * t
27
+ end
28
+
29
+ local function cvtTable2Amaz(attrType, v)
30
+ local value = nil
31
+ if attrType == "number" then
32
+ if #v == 1 then
33
+ value = v[1]
34
+ else
35
+ Amaz.LOGE(AE_EFFECT_TAG, "Invalid keyframe: " .. key .. " size: " .. #v)
36
+ end
37
+ elseif attrType == "vector" then
38
+ if #v == 2 then
39
+ value = Amaz.Vector2f(v[1], v[2])
40
+ elseif #v == 3 then
41
+ value = Amaz.Vector3f(v[1], v[2], v[3])
42
+ elseif #v == 4 then
43
+ value = Amaz.Vector4f(v[1], v[2], v[3], v[4])
44
+ else
45
+ Amaz.LOGE(AE_EFFECT_TAG, "Invalid keyframe: " .. key .. " size: " .. #v)
46
+ end
47
+ elseif attrType == "color" then
48
+ if #v == 3 then
49
+ value = Amaz.Color(v[1], v[2], v[3], 1.0)
50
+ elseif #v == 4 then
51
+ value = Amaz.Color(v[1], v[2], v[3], v[4])
52
+ else
53
+ Amaz.LOGE(AE_EFFECT_TAG, "Invalid keyframe: " .. key .. " size: " .. #v)
54
+ end
55
+ else
56
+ Amaz.LOGE(AE_EFFECT_TAG, "Invalid keyframe: " .. key .. "unsupported type: " .. attrType)
57
+ end
58
+ return value
59
+ end
60
+
61
+ local function getValueType(value)
62
+ local valueType = type(value)
63
+ if valueType == 'userdata' then
64
+ local str = tostring(value)
65
+ if string.sub(str, 1, 6) == 'Vector' then
66
+ valueType = 'vector'
67
+ elseif string.sub(str, 1, 5) == 'Color' then
68
+ valueType = 'color'
69
+ end
70
+ end
71
+
72
+ return valueType
73
+ end
74
+
75
+ local function add(value, number)
76
+ local type = getValueType(value)
77
+ if type == 'number' then
78
+ return value + number
79
+ elseif type == 'vector' then
80
+ local ret = value:copy()
81
+ ret.x = ret.x + number
82
+ ret.y = ret.y + number
83
+ if ret.z then ret.z = ret.z + number end
84
+ if ret.w then ret.w = ret.w + number end
85
+ return ret
86
+ elseif type == 'color' then
87
+ return Amaz.Color(
88
+ value.r + number,
89
+ value.g + number,
90
+ value.b + number,
91
+ value.a + number
92
+ )
93
+ end
94
+ return nil
95
+ end
96
+
97
+ local function mul(value, number)
98
+ local type = getValueType(value)
99
+ if type == 'color' then
100
+ return Amaz.Color(
101
+ value.r * number,
102
+ value.g * number,
103
+ value.b * number,
104
+ value.a * number
105
+ )
106
+ end
107
+ return value * number
108
+ end
109
+
110
+ function LumiParamsSetter:getCurrentDefaultParam(entityName, key, aeTime)
111
+ local keyframeName = nil
112
+ local keyframeType = 'number'
113
+ if self.keyframes ~= nil then
114
+ keyframeName = entityName .. '#' .. key .. '#' .. 'number'
115
+ if self.keyframes.attrs[keyframeName] == nil then
116
+ keyframeName = entityName .. '#' .. key .. '#' .. 'vector'
117
+ keyframeType = 'vector'
118
+ if self.keyframes.attrs[keyframeName] == nil then
119
+ keyframeName = entityName .. '#' .. key .. '#' .. 'color'
120
+ keyframeType = 'color'
121
+ if self.keyframes.attrs[keyframeName] == nil then
122
+ keyframeName = nil
123
+ end
124
+ end
125
+ end
126
+
127
+ if keyframeName == nil then
128
+ if entityName:sub(1, #'LumiLayer') == 'LumiLayer' and key:sub(-#'position') == 'position' then
129
+ local entity = self.params[entityName]
130
+ if entity ~= nil then
131
+ local position = entity[key]
132
+ if position ~= nil then
133
+ local hasSeparated = false
134
+ local newPosition = position:copy()
135
+
136
+ local newKey = string.gsub(key, 'position', 'xPosition')
137
+ local newKeyframeName = entityName .. '#' .. newKey .. '#' .. 'number'
138
+ if self.keyframes.attrs[newKeyframeName] ~= nil then
139
+ newPosition.x = cvtTable2Amaz('number', self.keyframes:GetVal(newKeyframeName, self.lumiManager:getKeyframeAeTime(aeTime)))
140
+ hasSeparated = true
141
+ end
142
+
143
+ newKey = string.gsub(key, 'position', 'yPosition')
144
+ newKeyframeName = entityName .. '#' .. newKey .. '#' .. 'number'
145
+ if self.keyframes.attrs[newKeyframeName] ~= nil then
146
+ newPosition.y = cvtTable2Amaz('number', self.keyframes:GetVal(newKeyframeName, self.lumiManager:getKeyframeAeTime(aeTime)))
147
+ hasSeparated = true
148
+ end
149
+
150
+ newKey = string.gsub(key, 'position', 'zPosition')
151
+ newKeyframeName = entityName .. '#' .. newKey .. '#' .. 'number'
152
+ if self.keyframes.attrs[newKeyframeName] ~= nil then
153
+ newPosition.z = cvtTable2Amaz('number', self.keyframes:GetVal(newKeyframeName, self.lumiManager:getKeyframeAeTime(aeTime)))
154
+ hasSeparated = true
155
+ end
156
+
157
+ if hasSeparated then
158
+ return newPosition
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
165
+
166
+ local value = nil
167
+ if keyframeName ~= nil then
168
+ value = cvtTable2Amaz(keyframeType, self.keyframes:GetVal(keyframeName, self.lumiManager:getKeyframeAeTime(aeTime)))
169
+ else
170
+ local entity = self.params[entityName]
171
+ if entity ~= nil then
172
+ value = entity[key]
173
+ end
174
+ end
175
+ return value
176
+ end
177
+
178
+ function LumiParamsSetter:updateSlider(lumi_obj, aeTime)
179
+ -- local sliderIntensity = self.sliderParams['effects_adjust_blur']
180
+ -- local gaussianIntensity = self:getCurrentDefaultParam("Gaussian_Blur_Root_353-effect2", 'intensity', aeTime)
181
+ -- if sliderIntensity and gaussianIntensity then
182
+ -- lumi_obj:setSubEffectAttr("Gaussian_Blur_Root_353-effect2", 'intensity', gaussianIntensity*sliderIntensity)
183
+ -- end
184
+
185
+ local function fsub(value, slider, valueA, valueB)
186
+ -- (param - sliderValue) * valueA + valueB
187
+ return (value - slider) * valueA + valueB
188
+ end
189
+
190
+ local function fmul(value, slider, valueA, valueB)
191
+ -- (param - valueA) * sliderValue + valueB
192
+ return (value - valueA) * slider + valueB
193
+ end
194
+
195
+ local function fadd(value, slider, valueA, valueB)
196
+ -- (param - valueA) * valueB + sliderValue
197
+ return (value - valueA) * valueB + slider
198
+ end
199
+
200
+ self.afterSliderParams = {}
201
+ for sliderKey, paramsInfos in pairs(self.sliderInfos) do
202
+ if self.sliderParams[sliderKey] ~= nil then
203
+ for index, value in ipairs(paramsInfos) do
204
+ local sliderIntensity = self.sliderParams[sliderKey]
205
+ local entityName = value[1]
206
+ local paramKey = value[2]
207
+ local paramType = value[3]
208
+ local paramDimensionFlag = value[4]
209
+ local calcType = value[5]
210
+ local maxValue = value[6]
211
+ local minValue = value[7]
212
+ local defaultValue = value[8]
213
+ local valueA = value[9]
214
+ local valueB = value[10]
215
+ sliderIntensity = sliderIntensity * (maxValue - minValue) + minValue
216
+ local oriValue = self:getCurrentDefaultParam(entityName, paramKey, aeTime)
217
+ if self.afterSliderParams[entityName .. '#' .. paramKey] ~= nil then
218
+ oriValue = self.afterSliderParams[entityName .. '#' .. paramKey]
219
+ end
220
+ local newValue = oriValue
221
+ local calcFunc = nil
222
+ if calcType == 0 then
223
+ calcFunc = fsub
224
+ elseif calcType == 1 then
225
+ calcFunc = fmul
226
+ elseif calcType == 2 then
227
+ calcFunc = fadd
228
+ else
229
+ Amaz.LOGE(AE_EFFECT_TAG, 'Unknown calcType: ' .. calcType)
230
+ return
231
+ end
232
+ if paramType == 'number' then
233
+ if paramDimensionFlag[1] then newValue = calcFunc(oriValue, sliderIntensity, valueA[1], valueB[1]) end
234
+ elseif paramType == 'color' then
235
+ newValue = oriValue:copy()
236
+ if paramDimensionFlag[1] then newValue.r = calcFunc(oriValue.r, sliderIntensity, valueA[1], valueB[1]) end
237
+ if paramDimensionFlag[2] then newValue.g = calcFunc(oriValue.g, sliderIntensity, valueA[2], valueB[2]) end
238
+ if paramDimensionFlag[3] then newValue.b = calcFunc(oriValue.b, sliderIntensity, valueA[3], valueB[3]) end
239
+ if paramDimensionFlag[4] then newValue.a = calcFunc(oriValue.a, sliderIntensity, valueA[4], valueB[4]) end
240
+ elseif paramType == 'vector' then
241
+ newValue = oriValue:copy()
242
+ if paramDimensionFlag[1] then newValue.x = calcFunc(oriValue.x, sliderIntensity, valueA[1], valueB[1]) end
243
+ if paramDimensionFlag[2] then newValue.y = calcFunc(oriValue.y, sliderIntensity, valueA[2], valueB[2]) end
244
+ if paramDimensionFlag[3] then newValue.z = calcFunc(oriValue.z, sliderIntensity, valueA[3], valueB[3]) end
245
+ if paramDimensionFlag[4] then newValue.w = calcFunc(oriValue.w, sliderIntensity, valueA[4], valueB[4]) end
246
+ end
247
+ lumi_obj:setSubEffectAttr(entityName, paramKey, newValue)
248
+ self.afterSliderParams[entityName .. '#' .. paramKey] = newValue
249
+ end
250
+ end
251
+ end
252
+ end
253
+
254
+ function LumiParamsSetter:updateFadeParams(lumi_obj, fadeInfos, factor, aeTime)
255
+ for i = 1, #fadeInfos.infos do
256
+ local entityName = fadeInfos.infos[i][1]
257
+ local paramKey = fadeInfos.infos[i][2]
258
+ local valueType = fadeInfos.infos[i][3]
259
+ local value = fadeInfos.infos[i][4]
260
+
261
+ local curValue = nil
262
+ if self.afterSliderParams[entityName .. '#' .. paramKey] ~= nil then
263
+ curValue = self.afterSliderParams[entityName .. '#' .. paramKey]
264
+ else
265
+ curValue = self:getCurrentDefaultParam(entityName, paramKey, aeTime)
266
+ end
267
+
268
+ if curValue ~= nil then
269
+ local needRenew = true
270
+ if valueType == 'number' then
271
+ curValue = mix(value[1], curValue, factor)
272
+ elseif valueType == 'color' then
273
+ curValue.r = mix(value[1], curValue.r, factor)
274
+ curValue.g = mix(value[2], curValue.g, factor)
275
+ curValue.b = mix(value[3], curValue.b, factor)
276
+ curValue.a = mix(value[4], curValue.a, factor)
277
+ elseif valueType == 'vector' then
278
+ if #value <= 1 or #value >= 5 then
279
+ needRenew = false
280
+ Amaz.LOGE(AE_EFFECT_TAG, 'Invalid value size: ' .. #value)
281
+ else
282
+ if #value >= 2 then
283
+ curValue.x = mix(value[1], curValue.x, factor)
284
+ curValue.y = mix(value[2], curValue.y, factor)
285
+ end
286
+ if #value >= 3 then
287
+ curValue.z = mix(value[3], curValue.z, factor)
288
+ end
289
+ if #value >= 4 then
290
+ curValue.w = mix(value[4], curValue.w, factor)
291
+ end
292
+ end
293
+ else
294
+ needRenew = false
295
+ Amaz.LOGE(AE_EFFECT_TAG, 'Invalid valye type: ' .. valueType)
296
+ end
297
+ if needRenew then
298
+ lumi_obj:setSubEffectAttr(entityName, paramKey, curValue)
299
+ end
300
+ end
301
+ end
302
+ end
303
+
304
+ function LumiParamsSetter:updateFade(lumi_obj, startTime, endTime, curTime, compDurations, aeTime)
305
+ local scale = (endTime - startTime) / (compDurations[2] - compDurations[1])
306
+ scale = clamp(scale, 0, 1)
307
+ local runningTime = curTime - startTime
308
+ local remainingTime = endTime - curTime
309
+
310
+ local isInFadein = false
311
+ if self.fadeinInfos
312
+ and self.fadeinInfos.time and self.fadeinInfos.time > 0
313
+ and self.fadeinInfos.infos and #self.fadeinInfos.infos > 0
314
+ then
315
+ local fadeinTime = self.fadeinInfos.time * scale
316
+ if runningTime <= fadeinTime then
317
+ isInFadein = true
318
+ local factor = runningTime / fadeinTime
319
+ factor = clamp(factor, 0, 1)
320
+ self:updateFadeParams(lumi_obj, self.fadeinInfos, factor, aeTime)
321
+ end
322
+ end
323
+
324
+ if self.fadeoutInfos
325
+ and self.fadeoutInfos.time and self.fadeoutInfos.time > 0
326
+ and self.fadeoutInfos.infos and #self.fadeoutInfos.infos > 0
327
+ then
328
+ local fadeoutTime = self.fadeoutInfos.time * scale
329
+ if remainingTime <= fadeoutTime or not isInFadein then
330
+ local factor = remainingTime / fadeoutTime
331
+ factor = clamp(factor, 0, 1)
332
+ self:updateFadeParams(lumi_obj, self.fadeoutInfos, factor, aeTime)
333
+ end
334
+ end
335
+ end
336
+
337
+ function LumiParamsSetter:onEvent(lumi_obj, event)
338
+ if lumi_obj == nil or event == nil then return end
339
+ local key = event.args:get(0)
340
+ if self.sliderInfos[key] ~= nil then
341
+ if self.XTEvent then
342
+ self.sliderParams[key] = event.args:get(2);
343
+ else
344
+ self.sliderParams[key] = event.args:get(1);
345
+ end
346
+ end
347
+ end
348
+
349
+ function LumiParamsSetter:initParams(lumi_obj)
350
+ if lumi_obj == nil then return end
351
+ if self.params == nil then return end
352
+ if self.init then return end
353
+
354
+ for entityName, params in pairs(self.params) do
355
+ for key, value in pairs(params) do
356
+ lumi_obj:setSubEffectAttr(entityName, key, value)
357
+ end
358
+ end
359
+
360
+ self.init = true
361
+ end
362
+
363
+ function LumiParamsSetter:updateKeyFrameData(lumi_obj, aeTime)
364
+ if lumi_obj == nil then return end
365
+ if self.keyframes == nil then return end
366
+
367
+ local p = aeTime
368
+ for key, _ in pairs(self.keyframes.attrs) do
369
+ local keys = {}
370
+ for substr in string.gmatch(key, "[^#]+") do
371
+ table.insert(keys, substr)
372
+ end
373
+ if #keys == 3 then
374
+ local entityName = keys[1]
375
+ local attrName = keys[2]
376
+ local attrType = keys[3]
377
+ local v = self.keyframes:GetVal(key, self.lumiManager:getKeyframeAeTime(p))
378
+ local value = cvtTable2Amaz(attrType, v)
379
+ if value then
380
+ lumi_obj:setSubEffectAttr(entityName, attrName, value)
381
+ end
382
+ else
383
+ Amaz.LOGE(AE_EFFECT_TAG, "Invalid keyframe: " .. key)
384
+ end
385
+ end
386
+ end
387
+
388
+ return LumiParamsSetter
scripts/7681159605375880466/config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "ae_tool": "AEExporter:1.5.5",
3
+ "bALG_BACH_CONFIG": false,
4
+ "effect": {
5
+ "Link": [
6
+ {
7
+ "path": "AmazingFeature/",
8
+ "type": "AmazingFeature",
9
+ "zorder": 8029
10
+ }
11
+ ]
12
+ },
13
+ "name": "AE2Effect_20260903134318663",
14
+ "version": "14.8.0",
15
+ "item_source": "user_post_pc_le"
16
+ }
scripts/7681159605375880466/extra.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "transition": {
3
+ "defaultDura": 2.000001,
4
+ "isOverlap": true
5
+ }
6
+ }
scripts/7681165424754429202/AmazingFeature/content.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "ae_tool" : "AmazingEditor",
3
+ "content" : {},
4
+ "needblend" : false,
5
+ "tag" : "AMG_1515088281693380358513659446614427937212",
6
+ "version" : "1.0"
7
+ }
scripts/7681165424754429202/AmazingFeature/js/JSSys.js ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const effect_api = "undefined" != typeof effect ? effect : "undefined" != typeof tt ? tt : "undefined" != typeof lynx ? lynx : {};
2
+ const Amaz = effect_api.getAmaz();
3
+
4
+ const { ScriptScene } = require('./ThreeJS/scriptScene');
5
+ const THREE = require('./ThreeJS/three-amg-wrapper').THREE;
6
+
7
+ class JSSys {
8
+ constructor() {
9
+ this.name = "JSSys";
10
+ this.comps = {}
11
+ this.compsdirty = true
12
+ }
13
+
14
+ onComponentAdded(comp) {
15
+ // console.log("running:JSSys:onComponentAdded");
16
+ }
17
+ onComponentRemoved(comp) {
18
+ // console.log("running:JSSys:onComponentRemoved");
19
+ }
20
+
21
+ onStart() {
22
+ console.log("running:JSSys:onStart");
23
+
24
+ this.renderTexture = this.scene.assetMgr.SyncLoad('rt/outputTex.rt');
25
+
26
+ // 添加光源到场景
27
+ console.log('JSSys: 创建ScriptScene实例');
28
+ this.scriptScene = new ScriptScene(this.scene);
29
+
30
+ this.input = Amaz.AmazingManager.getSingleton("Input");
31
+ const builtinObject = Amaz.AmazingManager.getSingleton("BuiltinObject");
32
+
33
+ if (builtinObject.getUserTexture("#TransitionInput0") && builtinObject.getUserTexture("#TransitionInput1")) {
34
+ this.scriptScene.texture1 = new THREE.Texture();
35
+ this.scriptScene.texture1.setImage(builtinObject.getUserTexture("#TransitionInput0"));
36
+ this.scriptScene.texture2 = new THREE.Texture();
37
+ this.scriptScene.texture2.setImage(builtinObject.getUserTexture("#TransitionInput1"));
38
+ console.log("JSSys: 获取到纹理");
39
+ }
40
+ else
41
+ {
42
+ this.scriptScene.texture1 = new THREE.Texture();
43
+ this.scriptScene.texture1.setImage(this.scene.assetMgr.SyncLoad('image/Sample1.jpg'));
44
+ this.scriptScene.texture2 = new THREE.Texture();
45
+ this.scriptScene.texture2.setImage(this.scene.assetMgr.SyncLoad('image/Sample2.jpg'));
46
+ console.log("JSSys: 未获取到纹理,使用默认纹理");
47
+ }
48
+
49
+ this.scriptScene.setupScene();
50
+ // 初始化后处理效果
51
+ if (this.scriptScene.initPostProcessing != null) {
52
+ this.scriptScene.initPostProcessing();
53
+ }
54
+ }
55
+
56
+ onUpdate(deltaTime) {
57
+ this.time = this.input.getFrameTimestamp();
58
+ // this.time = this.time % 2;
59
+ // this.time = this.time / 2.0;
60
+ this.scriptScene.seekToTime(this.time * this.scriptScene.Duration);
61
+ // this.scriptScene.updateScene();
62
+ }
63
+ onLateUpdate(deltaTime) {
64
+ // console.log("running:JSSys:onLateUpdate");
65
+ this.scriptScene.scene.seekToTime(this.time * this.scriptScene.Duration);
66
+ }
67
+
68
+ onEvent(event) {
69
+ console.log("running:JSSys:onEvent");
70
+ if (event.type == Amaz.EventType.VIEWER) {
71
+ // console.log("JSSys: 窗口大小改变");
72
+ console.log("renderTexture.width",this.renderTexture.width);
73
+ console.log("renderTexture.height",this.renderTexture.height);
74
+
75
+ window.innerWidth = this.renderTexture.width;
76
+ window.innerHeight = this.renderTexture.height;
77
+ // console.log("JSSys: 窗口大小改变");
78
+ this.scriptScene.handleResize();
79
+ }
80
+ }
81
+
82
+ onDestroy() {
83
+ // console.log("running:JSSys:onDestroy");
84
+ this.scriptScene.destroy();
85
+ }
86
+ }
87
+
88
+ exports.JSSys = JSSys;
89
+
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/EffectComposer.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{ShaderPass}=require("./ShaderPass.js");const getCurrentScene=require("./three-amg-wrapper.js").getCurrentScene;const RenderPass=require("./RenderPass.js").RenderPass;const Texture=require("./wrapper/Texture").Texture;const effect_api="undefined"!=typeof effect?effect:"undefined"!=typeof tt?tt:"undefined"!=typeof lynx?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;class EffectComposer{constructor(renderer){this.renderer=renderer;this.passes=[];this.scene=getCurrentScene();this.rt_0=this.scene._amgScene.assetMgr.SyncLoad("rt/RT_0.rt");this.rt_prev_Texture=null;this.rt_next_Texture=null;this.sourceEntity=this.scene._amgScene.findEntityBy("PerspectiveCamera_w");this.sourceCamera=this.sourceEntity?this.sourceEntity.getComponent("Camera"):null;this.outputEntity=this.scene._amgScene.findEntityBy("Camera")||this.sourceEntity;this.outputCamera=this.outputEntity?this.outputEntity.getComponent("Camera"):null;this._outputIsPerspective=!!(this.outputEntity&&this.outputEntity.name==="PerspectiveCamera_w");this._initialInputTexture=this.rt_0;this._currentInputTexture=this._initialInputTexture;this._ppPassCount=0;this.finalPlaceHolder=this.scene._amgScene.findEntityBy("PlaceHolder");this.outputRT=this.scene._amgScene.assetMgr.SyncLoad("rt/outputTex.rt");if(this.sourceEntity){this.sourceEntity.layer=0;if(this.sourceCamera){this.sourceCamera.renderOrder=0;this.sourceCamera.renderTexture=this.rt_0}}}_getStartOrder(){let startOrder=0;for(let i=0;i<this.passes.length;i++){const p=this.passes[i];if(!p)continue;startOrder+=p.isMultiPass?p.getPassCount():1}return startOrder}_allocNextRT(){const idx=this._ppPassCount%10+1|0;return this.scene._amgScene.assetMgr.SyncLoad("rt/RT_"+idx+".rt")}_makeTextureWrapper(rt){const t=new Texture;t.setImage(rt);return t}_wireFinalOutput(rt,totalOrder){const videoEntity=this.scene&&this.scene._amgScene?this.scene._amgScene.findEntityBy("video"):null;if(videoEntity){const mr=videoEntity.getComponent("MeshRenderer");const mat=mr?mr.material:null;if(mat&&typeof mat.setTex==="function"){mat.setTex("u_videoTex",rt)}}if(this.outputCamera){this.outputCamera.inputTexture=rt;if(!this._outputIsPerspective){this.outputCamera.renderOrder=totalOrder+1;this.outputCamera.layerVisibleMask=new Amaz.DynamicBitset(totalOrder+2,Math.pow(2,totalOrder+1))}}if(this.finalPlaceHolder){this.finalPlaceHolder.layer=totalOrder+1}if(this.outputRT){this.outputRT.inputTexture=rt}}_wirePassIO(pass,prevRT,nextRT,startOrder){const rt_prev_Texture=this._makeTextureWrapper(prevRT);const rt_next_Texture=this._makeTextureWrapper(nextRT);pass.prevTexture=rt_prev_Texture;pass.nextTexture=rt_next_Texture;if(pass.isMultiPass){if(pass.setInputTexture)pass.setInputTexture(prevRT);if(pass.setOutputTexture)pass.setOutputTexture(nextRT);if(pass.setRenderOrder)pass.setRenderOrder(startOrder+1)}else if(pass&&pass._amgMaterialObject){if(typeof pass._amgMaterialObject.setTex==="function"){pass._amgMaterialObject.setTex("tDiffuse",prevRT)}const camEntity=pass.cameraWarpEntity||pass.cameraEntity;const meshEntity=pass.passWarpEntity||pass.meshEntity;if(camEntity&&typeof camEntity.getComponent==="function"){const cam=camEntity.getComponent("Camera");if(cam){cam.renderTexture=nextRT;cam.renderOrder=startOrder+1;cam.layerVisibleMask=new Amaz.DynamicBitset(startOrder+2,Math.pow(2,startOrder+1))}}if(camEntity){camEntity.layer=startOrder+1}if(meshEntity){meshEntity.layer=startOrder+1}}this.rt_prev_Texture=rt_prev_Texture;this.rt_next_Texture=rt_next_Texture}getOutputTexture(){if(this.outputRT&&this.outputRT.inputTexture)return this.outputRT.inputTexture;if(this._currentInputTexture)return this._currentInputTexture;if(this._initialInputTexture)return this._initialInputTexture;return this.rt_0}addPass(pass){if(pass&&pass.isMultiPass){const startOrder=this._getStartOrder();this.passes.push(pass);const prevRT=this._currentInputTexture||this._initialInputTexture||this.rt_0;const nextRT=this._allocNextRT();this._wirePassIO(pass,prevRT,nextRT,startOrder);const totalOrder=startOrder+pass.getPassCount();this._wireFinalOutput(nextRT,totalOrder);this._currentInputTexture=nextRT;this._ppPassCount+=1;return}if(pass&&typeof pass.render==="function"&&!pass.cameraEntity&&!pass.cameraWarpEntity){this.passes.push(pass);return}if(!(pass instanceof ShaderPass)){console.log("pass is not a ShaderPass",pass);return}const camEntity=pass.cameraWarpEntity||pass.cameraEntity;if(!camEntity){console.log("pass camera entity is null",pass.name);return}this.scene.add(pass);const startOrder=this._getStartOrder();this.passes.push(pass);const prevRT=this._currentInputTexture||this._initialInputTexture||this.rt_0;const nextRT=this._allocNextRT();this._wirePassIO(pass,prevRT,nextRT,startOrder);const totalOrder=startOrder+(pass.isMultiPass?pass.getPassCount():1);this._wireFinalOutput(nextRT,totalOrder);this._currentInputTexture=nextRT;this._ppPassCount+=1}setSize(width,height){const w=Math.max(1,Math.floor(width));const h=Math.max(1,Math.floor(height));for(let i=0;i<this.passes.length;i++){const pass=this.passes[i];if(pass&&typeof pass.setSize==="function"){pass.setSize(w,h)}}}dispose(){for(let i=0;i<this.passes.length;i++){const pass=this.passes[i];if(pass&&typeof pass.dispose==="function"){pass.dispose()}}if(this.rt_prev_Texture){this.rt_prev_Texture.dispose()}if(this.rt_next_Texture){this.rt_next_Texture.dispose()}this.rt_prev_Texture=null;this.rt_next_Texture=null;this.passes.length=0;this._currentInputTexture=this._initialInputTexture;this._ppPassCount=0;this.sourceCamera=null;this.outputCamera=null;this.finalPlaceHolder=null;this.sourceEntity=null;this.outputEntity=null}render(deltaTime){const dt=typeof deltaTime==="number"?deltaTime:0;for(let i=0;i<this.passes.length;i++){const pass=this.passes[i];if(!pass||typeof pass.render!=="function")continue;const prev=pass.prevTexture;const next=pass.nextTexture;const hasBuffers=prev&&next&&prev.image&&next.image&&prev.image.width&&next.image.width;if(!hasBuffers){pass.render(this.renderer,null,null,dt,true);continue}const readbuffer={width:prev.image.width,height:prev.image.height,texture:prev};const writebuffer={width:next.image.width,height:next.image.height,texture:next};pass.render(this.renderer,writebuffer,readbuffer,dt,true)}}}exports.EffectComposer=EffectComposer;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/RenderPass.js ADDED
@@ -0,0 +1 @@
 
 
1
+ class RenderPass{constructor(scene,camera){this.scene=scene;this.camera=camera;this.enabled=true;this.needsSwap=false;this.clear=false;this.renderToScreen=false}setSize(width,height){}render(renderer,writeBuffer,readBuffer,deltaTime,maskActive){if(!this.enabled||!renderer||!this.scene||!this.camera)return;const target=this.renderToScreen||!writeBuffer?null:writeBuffer;if(typeof renderer.setRenderTarget==="function"){renderer.setRenderTarget(target)}if(this.clear&&typeof renderer.clear==="function"){renderer.clear()}renderer.render(this.scene,this.camera)}dispose(){}}exports.RenderPass=RenderPass;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/ShaderPass.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api="undefined"!=typeof effect?effect:"undefined"!=typeof tt?tt:"undefined"!=typeof lynx?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const THREE=require("./three-amg-wrapper.js").THREE;const getCurrentScene=require("./three-amg-wrapper.js").getCurrentScene;const ShaderMaterial=require("./wrapper/ShaderMaterial").ShaderMaterial;const VideoTexture=require("./wrapper/Texture").VideoTexture;class ShaderPass{constructor(parameters={}){this.progress=0;this.prevTexture=null;this.nextTexture=null;console.log("getCurrentScene():");this.scene=getCurrentScene();console.log("getCurrentScene():",this.scene);if(parameters.name&&!parameters.isDynamic){this.postProcessPrefab=this.scene._amgScene.assetMgr.SyncLoad("prefabs/postProcess.prefab");this._amgEntity=new Amaz.Entity;this._amgEntity.name=parameters.name;this._amgEntity.scene=this.scene._amgScene;this._transform=this._amgEntity.addComponent("Transform");this.postProcessPrefab.instantiateToEntity(this.scene._amgScene,this._amgEntity);this.meshEntity=this._amgEntity.searchEntity("PassWarp");this.cameraEntity=this._amgEntity.searchEntity("CameraWarp")}else{const baseName=parameters.name||"DynamicShaderPass_"+Math.random().toString(36).substr(2,9);this._amgEntity=new Amaz.Entity;this._amgEntity.name=baseName+"Entity";this._amgEntity.scene=this.scene._amgScene;this._transform=this._amgEntity.addComponent("Transform");this.meshEntity=new Amaz.Entity;this.meshEntity.name="Mesh"+baseName+"Pass";this.meshEntity.scene=this.scene._amgScene;this.meshEntity.selfvisible=true;this.meshEntity.visible=true;const meshTransform=this.meshEntity.addComponent("Transform");const mr=this.meshEntity.addComponent("MeshRenderer");if(!ShaderPass.quadMesh){ShaderPass.quadMesh=this.scene._amgScene.assetMgr.SyncLoad("prefabs/Quad.mesh")}mr.mesh=ShaderPass.quadMesh;this.cameraEntity=new Amaz.Entity;this.cameraEntity.name="Camera"+baseName+"Pass";this.cameraEntity.scene=this.scene._amgScene;this.cameraEntity.selfvisible=true;this.cameraEntity.visible=true;const cameraTransform=this.cameraEntity.addComponent("Transform");this._transform.addTransform(cameraTransform);cameraTransform.localPosition=new Amaz.Vector3f(0,0,20);cameraTransform.addTransform(meshTransform);meshTransform.localPosition=new Amaz.Vector3f(0,0,-10);const cam=this.cameraEntity.addComponent("Camera");cam.type=Amaz&&Amaz.CameraType?Amaz.CameraType.ORTHO:1;cam.clearType=Amaz&&Amaz.CameraClearType?Amaz.CameraClearType.COLOR_DEPTH:cam.clearType;cam.clearColor=Amaz&&Amaz.Color?new Amaz.Color(0,0,0,0):cam.clearColor;cam.alwaysClear=false;cam.isRootCamera=true;cam.renderOrder=1;cam.layerVisibleMask=Amaz&&Amaz.DynamicBitset?new Amaz.DynamicBitset(3,4):cam.layerVisibleMask;cam.orthoScale=1;if(this.scene&&this.scene._amgScene){this.scene._amgScene.addEntity(this.meshEntity);this.scene._amgScene.addEntity(this.cameraEntity)}}this.material=new ShaderMaterial(parameters);this._amgMaterialObject=this.material._amgObject;const meshRenderer=this.meshEntity?this.meshEntity.getComponent("MeshRenderer"):null;if(meshRenderer){meshRenderer.sharedMaterial=this._amgMaterialObject}}setParentTransform(parentTransform){if(!parentTransform||!this._transform)return;if(this._transform.parent&&typeof this._transform.parent.removeTransform==="function"){this._transform.parent.removeTransform(this._transform)}if(typeof parentTransform.addTransform==="function"){parentTransform.addTransform(this._transform)}}seekToTime(time){if(!this.material||!this.material.uniforms)return;for(const[key,uniform]of Object.entries(this.material.uniforms)){if(!uniform)continue;const value=Object.prototype.hasOwnProperty.call(uniform,"value")?uniform.value:uniform;if(!(value instanceof VideoTexture))continue;const renderer=value._amgSprite2DRenderer;if(!renderer||renderer.materials.size()!==1)continue;const texture=renderer.materials.get(0).getTex("_MainTex");value.setImage(texture);if(typeof this.material._syncUniformToAMG==="function"){this.material._syncUniformToAMG(key,uniform)}if(value._amgVideoAnimSeq){value._amgVideoAnimSeq.seekToTime(time/1e3)}}}get uniforms(){return this.material?this.material.uniforms:undefined}render(renderer,writeBuffer,readBuffer,delta,maskActive){return}dispose(){if(this.scene&&this.scene._amgScene){if(this.meshEntity){this.scene._amgScene.removeEntity(this.meshEntity)}if(this.cameraEntity){this.scene._amgScene.removeEntity(this.cameraEntity)}}if(this.material&&typeof this.material.dispose==="function"){this.material.dispose()}this.postProcessPrefab=null;this.material=null;this._amgMaterialObject=null;if(this.prevTexture){this.prevTexture.dispose()}if(this.nextTexture){this.nextTexture.dispose()}this.prevTexture=null;this.nextTexture=null;this.scene=null;this.meshEntity=null;this.cameraEntity=null}}ShaderPass.quadMesh=null;ShaderPass.camType=undefined;ShaderPass.camOrthoScale=undefined;exports.ShaderPass=ShaderPass;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/customEasings.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const TWEEN=require("./tween");function makeOutIn(easingOut,easingIn){return function outIn(k){if(k<.5)return.5*easingOut(k*2);return.5*easingIn(k*2-1)+.5}}const E=TWEEN.Easing;const OutIn=Object.freeze({Sinusoidal:makeOutIn(E.Sinusoidal.Out,E.Sinusoidal.In),Exponential:makeOutIn(E.Exponential.Out,E.Exponential.In),Circular:makeOutIn(E.Circular.Out,E.Circular.In),Elastic:makeOutIn(E.Elastic.Out,E.Elastic.In),Back:makeOutIn(E.Back.Out,E.Back.In),Bounce:makeOutIn(E.Bounce.Out,E.Bounce.In),Quadratic:makeOutIn(E.Quadratic.Out,E.Quadratic.In),Cubic:makeOutIn(E.Cubic.Out,E.Cubic.In),Quartic:makeOutIn(E.Quartic.Out,E.Quartic.In),Quintic:makeOutIn(E.Quintic.Out,E.Quintic.In)});const springSoft=k=>{if(k<=0)return 0;if(k>=1)return 1;return 1-Math.exp(-6*k)*Math.cos(12*k)};const springStiff=k=>{if(k<=0)return 0;if(k>=1)return 1;return 1-Math.exp(-5*k)*Math.cos(18*k)};const dampedOscillation=k=>{if(k<=0)return 0;if(k>=1)return 1;return 1-Math.exp(-5*k)*Math.cos(10*k)};const Physics=Object.freeze({SpringSoft:springSoft,SpringStiff:springStiff,DampedOscillation:dampedOscillation});const anticipate=k=>{if(k<=0)return 0;if(k>=1)return 1;const pullback=.1;if(k<.3){const p=k/.3;return-pullback*p*(2-p)}const p=(k-.3)/.7;return-pullback+(1+pullback)*p*p*(3-2*p)};const overshootFactory=peak=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.6){const p=k/.6;return peak*p*(2-p)}const p=(k-.6)/.4;return peak+(1-peak)*(1-Math.pow(1-p,3))};const overshoot110=overshootFactory(1.1);const overshoot125=overshootFactory(1.25);const snapBack=k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.6){const p=k/.6;return 1.05*(1-Math.pow(1-p,3))}const p=(k-.6)/.4;return 1.05-.05*p*p*(3-2*p)};const swing=k=>{if(k<=0)return 0;if(k>=1)return 1;return 1-Math.cos(1.5*Math.PI*k)*Math.exp(-2.5*k)};const Motion=Object.freeze({Anticipate:anticipate,Overshoot110:overshoot110,Overshoot125:overshoot125,SnapBack:snapBack,Swing:swing});const makeStep=(n,jumpTerm="end")=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(jumpTerm==="start")return Math.ceil(k*n)/n;return Math.floor(k*n)/n};const Step=Object.freeze({Steps4End:makeStep(4,"end"),Steps8End:makeStep(8,"end"),Steps12End:makeStep(12,"end")});function buildCubicBezier(x1,y1,x2,y2){const cx=3*x1,bx=3*(x2-x1)-cx,ax=1-cx-bx;const cy=3*y1,by=3*(y2-y1)-cy,ay=1-cy-by;const sampleX=s=>((ax*s+bx)*s+cx)*s;const sampleY=s=>((ay*s+by)*s+cy)*s;const sampleDX=s=>(3*ax*s+2*bx)*s+cx;const solveS=x=>{let s=x;for(let i=0;i<8;i++){const cur=sampleX(s)-x;if(Math.abs(cur)<1e-6)return s;const d=sampleDX(s);if(Math.abs(d)<1e-6)break;s-=cur/d;if(s<0)s=0;if(s>1)s=1}let lo=0,hi=1;for(let i=0;i<32&&hi-lo>1e-6;i++){const mid=(lo+hi)/2;if(sampleX(mid)<x)lo=mid;else hi=mid}return(lo+hi)/2};return k=>{if(k<=0)return 0;if(k>=1)return 1;return sampleY(solveS(k))}}const BEZIER_PRESETS=Object.freeze({"Material.Standard":[.4,0,.2,1],"Material.Accelerate":[.4,0,1,1],"Material.Decelerate":[0,0,.2,1],"CSS.Ease":[.25,.1,.25,1]});const _bezierCache=new Map;function _cachedBezier(x1,y1,x2,y2){const key=x1+","+y1+","+x2+","+y2;let fn=_bezierCache.get(key);if(!fn){fn=buildCubicBezier(x1,y1,x2,y2);_bezierCache.set(key,fn)}return fn}function cubicBezier(a,b,c,d){if(typeof a==="string"){let preset=BEZIER_PRESETS[a];if(!preset){console.warn("[customEasings.cubicBezier] unknown preset, falling back to Material.Standard:",a);preset=BEZIER_PRESETS["Material.Standard"]}return _cachedBezier(preset[0],preset[1],preset[2],preset[3])}const clamp=(v,lo,hi)=>Math.max(lo,Math.min(hi,v));const x1=clamp(a,0,1);const y1=clamp(b,-.5,1.5);const x2=clamp(c,0,1);const y2=clamp(d,-.5,1.5);return _cachedBezier(x1,y1,x2,y2)}const libSpring=({stiffness=180,damping=12,mass=1}={})=>{const DT=1/240;const T=1.5;let x=0,v=0;const samples=[];for(let t=0;t<=T;t+=DT){const force=-stiffness*(x-1)-damping*v;v+=force/mass*DT;x+=v*DT;samples.push({t:t,x:x})}let T_end=T;for(let i=samples.length-1;i>=0;i--){if(Math.abs(samples[i].x-1)>.01){T_end=samples[i].t;break}}return k=>{if(k<=0)return 0;if(k>=1)return 1;const t=k*T_end;const idx=Math.min(samples.length-1,Math.floor(t/DT));return samples[idx].x}};const libHeartBeat=(peak=.3)=>k=>{if(k<=0||k>=1)return 0;const bell=(t,c)=>Math.exp(-((t-c)**2)/(2*.07*.07));return peak*(bell(k,.2)+bell(k,.5))};const libSteps=(n=6)=>k=>{if(k<=0)return 0;if(k>=1)return 1;return Math.floor(k*n)/n};const attentionPing=(peak=.35,decay=2)=>k=>{if(k<=0||k>=1)return 0;return peak*Math.sin(Math.PI*k)*Math.exp(-decay*k)};const attentionWiggle=(count=4,amplitude=.25)=>k=>{if(k<=0||k>=1)return 0;const env=1-k;return amplitude*env*Math.sin(k*Math.PI*2*count)};const attentionStrum=(notes=4,peak=.4)=>{const centers=[];for(let i=0;i<notes;i++){centers.push({c:.15+i*(.7/Math.max(1,notes-1)),a:Math.pow(.72,i)})}return k=>{if(k<=0||k>=1)return 0;let sum=0;for(const{c,a}of centers){sum+=a*Math.exp(-((k-c)**2)/(2*.05*.05))}return peak*sum}};const Attention=Object.freeze({Ping:attentionPing(),Wiggle:attentionWiggle(),Strum:attentionStrum()});const breathNormal=(cycles=2,peak=.15)=>k=>{if(k<=0||k>=1)return 0;return peak*Math.sin(k*Math.PI*2*cycles)*Math.sin(k*Math.PI)};const breathDeep=(peak=.3,riseRatio=.35,holdRatio=.15)=>{const holdEnd=riseRatio+holdRatio;return k=>{if(k<=0||k>=1)return 0;if(k<riseRatio){const t=k/riseRatio;return peak*Math.sin(t*Math.PI/2)}if(k<holdEnd){return peak}const t=(k-holdEnd)/(1-holdEnd);return peak*Math.cos(t*Math.PI/2)}};const breathPanting=(cycles=6,peak=.08)=>k=>{if(k<=0||k>=1)return 0;const envelope=Math.sin(k*Math.PI);const wave=.5+.5*Math.sin(k*Math.PI*2*cycles-Math.PI/2);return peak*envelope*wave};const breathSigh=(peak=.25,riseRatio=.2)=>k=>{if(k<=0||k>=1)return 0;if(k<riseRatio){const t=k/riseRatio;return peak*Math.sin(t*Math.PI/2)}const t=(k-riseRatio)/(1-riseRatio);return peak*(1-t)*(1-t)};const Breath=Object.freeze({Normal:breathNormal(),Deep:breathDeep(),Panting:breathPanting(),Sigh:breathSigh()});const heartCalm=(peak=.25,center=.35,width=.1)=>k=>{if(k<=0||k>=1)return 0;return peak*Math.exp(-((k-center)**2)/(2*width*width))};const heartExcited=(beats=4,peak=.3,width=.04)=>{const centers=[];const span=.7;for(let i=0;i<beats;i++){centers.push(.15+i*(span/Math.max(1,beats-1)))}return k=>{if(k<=0||k>=1)return 0;let sum=0;for(const c of centers){sum+=Math.exp(-((k-c)**2)/(2*width*width))}return peak*sum}};const heartLubDub=(peak=.3)=>k=>{if(k<=0||k>=1)return 0;const bell=(t,c,w)=>Math.exp(-((t-c)**2)/(2*w*w));return peak*(bell(k,.25,.045)+.6*bell(k,.42,.03))};const Heart=Object.freeze({Calm:heartCalm(),Excited:heartExcited(),LubDub:heartLubDub()});const mathJumpArc=()=>k=>{if(k<=0||k>=1)return 0;return 4*k*(1-k)};const mathPendulum=(damping=3,freq=2.5)=>k=>{if(k<=0||k>=1)return 0;return Math.sin(k*Math.PI)*Math.exp(-damping*k)*Math.cos(freq*Math.PI*k)};const mathTremor=(amplitude=.04,freq=22)=>k=>{if(k<=0)return 0;if(k>=1)return 1;return k+amplitude*Math.sin(k*Math.PI*2*freq)};const mathBoomerang=fn=>k=>{if(k<=0||k>=1)return 0;return k<.5?fn(k*2):fn(2-k*2)};const MathExt=Object.freeze({JumpArc:mathJumpArc(),Pendulum:mathPendulum(),Tremor:mathTremor()});const explosionImpulse=(sharpness=6)=>{const tail=sharpness*Math.exp(1-sharpness);return k=>{if(k<=0||k>=1)return 0;const h=sharpness*k;return h*Math.exp(1-h)-tail*k}};const explosionFlash=(rise=.05,decay=5)=>k=>{if(k<=0||k>=1)return 0;if(k<rise)return k/rise;return Math.exp(-decay*(k-rise))};const explosionRecoil=(decay=4,freq=3)=>k=>{if(k<=0||k>=1)return 0;return-Math.exp(-decay*k)*Math.cos(freq*Math.PI*k)};const explosionImplosion=(charge=.3,depth=.4,burstPeak=1.2)=>{const sharp=5;const tail=sharp*Math.exp(1-sharp);return k=>{if(k<=0||k>=1)return 0;if(k<charge){const t=k/charge;return-depth*Math.sin(t*Math.PI/2)}const t=(k-charge)/(1-charge);const h=sharp*t;const wave=h*Math.exp(1-h)-tail*t;const settle=-depth*Math.pow(1-t,3);return settle+burstPeak*wave}};const Explosion=Object.freeze({Impulse:explosionImpulse(),Flash:explosionFlash(),Recoil:explosionRecoil(),Implosion:explosionImplosion()});const natureWave=(cycles=3,amplitude=.25)=>k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const w=Math.sin(k*Math.PI*2*cycles)+.5*Math.sin(k*Math.PI*2*cycles*1.5+1.2)+.25*Math.sin(k*Math.PI*2*cycles*3+2.4);return amplitude*env*w*.6};const natureFlicker=(rate=15,intensity=.2,seed=7)=>{let s=seed;const rand=()=>{s=(s*9301+49297)%233280;return s/233280};const samples=[];for(let i=0;i<=rate+1;i++)samples.push(rand());return k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const pos=k*rate;const idx=Math.floor(pos);const t=pos-idx;const a=samples[idx];const b=samples[idx+1];const interp=a+(b-a)*t;return intensity*env*(interp-.5)*2}};const natureGust=(gusts=3,peak=.25)=>{const centers=[];const span=.7;for(let i=0;i<gusts;i++){centers.push(.15+i*(span/Math.max(1,gusts-1)))}return k=>{if(k<=0||k>=1)return 0;let sum=0;for(const c of centers){sum+=Math.exp(-((k-c)**2)/(2*.08*.08))}return peak*sum/gusts*1.8}};const Nature=Object.freeze({Wave:natureWave(),Flicker:natureFlicker(),Gust:natureGust()});const impactRain=(impactAt=.7,rippleAmp=.08)=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<impactAt){const t=k/impactAt;return t*t}const t=(k-impactAt)/(1-impactAt);return 1+rippleAmp*Math.exp(-4*t)*Math.sin(t*Math.PI*6)};const impactHammer=(liftDepth=.25)=>{const liftEnd=.35,strikeEnd=.6;return k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<liftEnd){const t=k/liftEnd;return-liftDepth*Math.sin(t*Math.PI)}if(k<strikeEnd){const t=(k-liftEnd)/(strikeEnd-liftEnd);return t*t}const t=(k-strikeEnd)/(1-strikeEnd);return 1-.06*Math.exp(-5*t)*Math.sin(t*Math.PI*4)}};const impactBounceDrop=(bounces=3,rebound=.25)=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.4){const t=k/.4;return t*t}const t=(k-.4)/.6;const env=Math.exp(-2.5*t);const wave=Math.abs(Math.sin(t*Math.PI*bounces));return 1-env*wave*rebound};const impactSlap=(contactAt=.3,holdRatio=.1)=>k=>{if(k<=0||k>=1)return 0;if(k<contactAt){const t=k/contactAt;return t*t}if(k<contactAt+holdRatio)return 1;const t=(k-contactAt-holdRatio)/(1-contactAt-holdRatio);return(1-t)*(1-t)};const impactArrowHit=(impactAt=.5)=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<impactAt){const t=k/impactAt;return t*(.7+.3*t)}const t=(k-impactAt)/(1-impactAt);const env=Math.exp(-5*t);const wave=Math.sin(t*Math.PI*10);return 1+.1*env*wave};const impactShatter=(impactAt=.55,burstAmp=.35)=>{const sharp=5;const tail=sharp*Math.exp(1-sharp);return k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<impactAt){const t=k/impactAt;return t*t}const t=(k-impactAt)/(1-impactAt);const h=sharp*t;const impulseVal=h*Math.exp(1-h)-tail*t;return 1+burstAmp*impulseVal}};const Impact=Object.freeze({Rain:impactRain(),Hammer:impactHammer(),BounceDrop:impactBounceDrop(),Slap:impactSlap(),ArrowHit:impactArrowHit(),Shatter:impactShatter()});const rhythmBassDrop=()=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.4){const t=k/.4;return.4*Math.pow(t,2.5)}if(k<.48){const t=(k-.4)/.08;return.4-.2*t}if(k<.52){const t=(k-.48)/.04;return.2+.8*t}const t=(k-.52)/.48;return 1-.04*Math.sin(t*Math.PI*8)*(1-t)};const rhythmPunchCombo=(peak=.4)=>{const pattern=[{c:.15,w:.04,a:.75},{c:.35,w:.04,a:.75},{c:.7,w:.055,a:1}];return k=>{if(k<=0||k>=1)return 0;let sum=0;for(const{c,w,a}of pattern){sum+=a*Math.exp(-((k-c)**2)/(2*w*w))}return peak*sum}};const rhythmStaccato=(beats=4,duty=.3)=>k=>{if(k<=0||k>=1)return 0;const beatLen=1/beats;const phase=k/beatLen-Math.floor(k/beatLen);if(phase>duty)return 0;const t=phase/duty;return Math.sin(t*Math.PI)};const rhythmKick=(peak=1.2)=>k=>{if(k<=0||k>=1)return 0;if(k<.05)return peak*k/.05;const t=(k-.05)/.95;return peak*Math.exp(-4*t)};const rhythmCrescendo=(beats=4)=>{const centers=[];for(let i=0;i<beats;i++){const t=Math.pow((i+1)/beats,1.4);centers.push({c:Math.max(.05,t-.08),w:.03,a:(i+1)/beats})}return k=>{if(k<=0||k>=1)return 0;let sum=0;for(const{c,w,a}of centers){sum+=a*Math.exp(-((k-c)**2)/(2*w*w))}return sum}};const rhythmDunDunDun=()=>{const bell=(t,c,w)=>Math.exp(-((t-c)**2)/(2*w*w));return k=>{if(k<=0||k>=1)return 0;return.3*bell(k,.15,.025)+.6*bell(k,.35,.03)+1*bell(k,.68,.09)}};const rhythmBellToll=(decay=3,freq=8)=>{const strike=.05;return k=>{if(k<=0||k>=1)return 0;if(k<strike)return k/strike;const t=k-strike;return Math.exp(-decay*t)*Math.cos(freq*Math.PI*t)}};const Rhythm=Object.freeze({BassDrop:rhythmBassDrop(),PunchCombo:rhythmPunchCombo(),Staccato:rhythmStaccato(),Kick:rhythmKick(),Crescendo:rhythmCrescendo(),DunDunDun:rhythmDunDunDun(),BellToll:rhythmBellToll()});const uiClickSnap=(pressDepth=.3,reboundPeak=.1)=>k=>{if(k<=0||k>=1)return 0;if(k<.2){const t=k/.2;return-pressDepth*Math.sin(t*Math.PI/2)}if(k<.5){const t=(k-.2)/.3;return-pressDepth+(pressDepth+reboundPeak)*(1-Math.pow(1-t,3))}const t=(k-.5)/.5;return reboundPeak*Math.exp(-4*t)*Math.cos(t*Math.PI*3)};const uiHoverBloom=(riseRatio=.2,fallRatio=.3)=>k=>{if(k<=0||k>=1)return 0;if(k<riseRatio){const t=k/riseRatio;return 1-Math.pow(1-t,3)}if(k<1-fallRatio)return 1;const t=(k-(1-fallRatio))/fallRatio;return Math.pow(1-t,3)};const uiErrorShake=(amplitude=.15,count=5)=>k=>{if(k<=0||k>=1)return 0;const env=1-k;const raw=Math.sin(k*Math.PI*2*count);const clipped=Math.sign(raw)*Math.min(1,Math.abs(raw)*1.8);return amplitude*env*clipped};const uiSuccessPop=(overshoot=.2)=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.4){const t=k/.4;return(1+overshoot)*(1-Math.pow(1-t,2))}const t=(k-.4)/.6;return 1+overshoot*Math.exp(-5*t)*Math.cos(t*Math.PI*3)};const uiRippleOut=()=>k=>{if(k<=0||k>=1)return 0;return 6.75*k*Math.pow(1-k,2)};const UI=Object.freeze({ClickSnap:uiClickSnap(),HoverBloom:uiHoverBloom(),ErrorShake:uiErrorShake(),SuccessPop:uiSuccessPop(),RippleOut:uiRippleOut()});const magicManaCharge=()=>k=>{if(k<=0)return 0;if(k>=1)return 1;const base=(Math.exp(3*k)-1)/(Math.exp(3)-1);const pulse=.04*Math.sin(k*Math.PI*8)*k;return base+pulse};const magicSpellCast=(chargeEnd=.4)=>k=>{if(k<=0||k>=1)return 0;if(k<chargeEnd){const t=k/chargeEnd;return.3*Math.pow(t,2)*(1+.2*Math.sin(t*Math.PI*6))}if(k<chargeEnd+.1){const t=(k-chargeEnd)/.1;return.3+.7*t}const t=(k-chargeEnd-.1)/(1-chargeEnd-.1);return Math.exp(-2*t)*(1+.1*Math.cos(t*Math.PI*4))};const magicTeleport=()=>k=>{if(k<=0||k>=1)return 0;if(k<.45){const t=k/.45;return t*t*t}if(k<.55)return 1;const t=(k-.55)/.45;return Math.pow(1-t,3)};const magicShield=()=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.3){const t=k/.3;return 1.2*(1-Math.pow(1-t,2))}if(k<.6){const t=(k-.3)/.3;return 1.2-.2*t}const t=(k-.6)/.4;return 1+.03*Math.sin(t*Math.PI*3)};const magicAura=(peak=.15)=>k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const fundamental=.6*Math.sin(k*Math.PI*2);const harmonic=.3*Math.sin(k*Math.PI*4+1);const overtone=.1*Math.sin(k*Math.PI*6+2);return peak*env*(fundamental+harmonic+overtone)};const Magic=Object.freeze({ManaCharge:magicManaCharge(),SpellCast:magicSpellCast(),Teleport:magicTeleport(),Shield:magicShield(),MagicAura:magicAura()});const animalCatPounce=()=>k=>{if(k<=0)return 0;if(k>=1)return 1;if(k<.2){const t=k/.2;return-.2*Math.sin(t*Math.PI)}if(k<.3){const t=(k-.2)/.1;return.5*t*t}if(k<.8){const t=(k-.3)/.5;return.5+.5*t+.2*Math.sin(t*Math.PI)}const t=(k-.8)/.2;return 1+.05*Math.sin(t*Math.PI)};const animalBirdFlap=(flaps=4)=>k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const phase=k*Math.PI*2*flaps;const wave=Math.sin(phase)-.3*Math.sin(phase*2);return.2*env*wave};const animalSnakeSlither=(waves=3)=>k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const wave=Math.sin(k*Math.PI*2*waves);return.2*env*wave};const animalButterflyFlit=(seed=13)=>{let s=seed;const rand=()=>{s=(s*9301+49297)%233280;return s/233280};const samples=[];for(let i=0;i<=26;i++)samples.push(rand()-.5);return k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const pos=k*25;const idx=Math.floor(pos);const t=pos-idx;const smooth=t*t*(3-2*t);const interp=samples[idx]+(samples[idx+1]-samples[idx])*smooth;return.3*env*interp}};const animalHorseGallop=(cycles=3)=>k=>{if(k<=0||k>=1)return 0;const env=Math.sin(k*Math.PI);const cyclePos=k*cycles-Math.floor(k*cycles);const bell=(c,w=.04)=>Math.exp(-((cyclePos-c)**2)/(2*w*w));return.25*env*(bell(0)+bell(.18)+bell(.36)+bell(.54))};const Animal=Object.freeze({CatPounce:animalCatPounce(),BirdFlap:animalBirdFlap(),SnakeSlither:animalSnakeSlither(),ButterflyFlit:animalButterflyFlit(),HorseGallop:animalHorseGallop()});const Progress=Object.freeze({Physics:Object.freeze({...Physics,Spring:libSpring()}),Motion:Motion,Step:Object.freeze({...Step,Steps6:libSteps()}),Math:Object.freeze({Tremor:MathExt.Tremor}),Impact:Object.freeze({Rain:Impact.Rain,Hammer:Impact.Hammer,BounceDrop:Impact.BounceDrop,ArrowHit:Impact.ArrowHit,Shatter:Impact.Shatter}),Rhythm:Object.freeze({BassDrop:Rhythm.BassDrop}),UI:Object.freeze({SuccessPop:UI.SuccessPop}),Magic:Object.freeze({ManaCharge:Magic.ManaCharge,Shield:Magic.Shield}),Animal:Object.freeze({CatPounce:Animal.CatPounce})});const Pulse=Object.freeze({Attention:Object.freeze({Ping:Attention.Ping}),Breath:Object.freeze({Deep:Breath.Deep,Sigh:Breath.Sigh}),Heart:Object.freeze({Calm:Heart.Calm}),Math:Object.freeze({JumpArc:MathExt.JumpArc,BoomerangSharp:mathBoomerang(E.Cubic.In),BoomerangSoft:mathBoomerang(E.Cubic.Out)}),Explosion:Object.freeze({Impulse:Explosion.Impulse,Flash:Explosion.Flash,Recoil:Explosion.Recoil,Implosion:Explosion.Implosion}),Impact:Object.freeze({Slap:Impact.Slap}),Rhythm:Object.freeze({Kick:Rhythm.Kick}),UI:Object.freeze({ClickSnap:UI.ClickSnap,HoverBloom:UI.HoverBloom,RippleOut:UI.RippleOut}),Magic:Object.freeze({SpellCast:Magic.SpellCast,Teleport:Magic.Teleport})});const Wave=Object.freeze({Attention:Object.freeze({Wiggle:Attention.Wiggle,Strum:Attention.Strum}),Breath:Object.freeze({Normal:Breath.Normal,Panting:Breath.Panting}),Heart:Object.freeze({Excited:Heart.Excited,LubDub:Heart.LubDub,Beat:libHeartBeat()}),Math:Object.freeze({Pendulum:MathExt.Pendulum}),Nature:Nature,Rhythm:Object.freeze({PunchCombo:Rhythm.PunchCombo,Staccato:Rhythm.Staccato,Crescendo:Rhythm.Crescendo,DunDunDun:Rhythm.DunDunDun,BellToll:Rhythm.BellToll}),UI:Object.freeze({ErrorShake:UI.ErrorShake}),Magic:Object.freeze({MagicAura:Magic.MagicAura}),Animal:Object.freeze({BirdFlap:Animal.BirdFlap,SnakeSlither:Animal.SnakeSlither,ButterflyFlit:Animal.ButterflyFlit,HorseGallop:Animal.HorseGallop})});const customEasings=Object.freeze({makeOutIn:makeOutIn,OutIn:OutIn,Progress:Progress,Pulse:Pulse,Wave:Wave,cubicBezier:cubicBezier});exports.customEasings=customEasings;exports.default=customEasings;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/scriptScene.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const TWEEN=require("./tween");const customEasings=require("./customEasings").customEasings;const THREE=require("./three-amg-wrapper").THREE;const{ShaderPass}=require("./ShaderPass.js");class ScriptScene{constructor(amgScene=null,container=null){if(amgScene){this.scene=new THREE.Scene;this.scene._amgScene=amgScene}else{this.scene=new THREE.Scene}this.effect_type="transition";this.camera=null;this.renderer=null;this.scene.background=new THREE.Color(3355443);this.isAnimating=false;this.animationFrameId=null;this.sceneObjects=null;this.texture1=null;this.texture2=null;this.composer=null;this.renderPass=null;this.usePostProcessing=true;this.initCoreObjects();if(container){this.init(container)}}destroy(){this.isAnimating=false;if(this.animationFrameId!==null&&typeof cancelAnimationFrame!=="undefined"){cancelAnimationFrame(this.animationFrameId);this.animationFrameId=null}if(this.renderer){this.renderer.setAnimationLoop(null);this.renderer.dispose();if(this.renderer.domElement&&this.renderer.domElement.parentNode){this.renderer.domElement.parentNode.removeChild(this.renderer.domElement)}}if(this.texture1){if(typeof this.texture1.dispose==="function")this.texture1.dispose();this.texture1=null}if(this.texture2){if(typeof this.texture2.dispose==="function")this.texture2.dispose();this.texture2=null}if(this.scene){this.scene.dispose()}if(typeof window!=="undefined"){window.removeEventListener("resize",this.handleResize)}if(this.sceneObjects&&this.sceneObjects.tweens){this.sceneObjects.tweens.forEach(tween=>{if(tween&&typeof tween.stop==="function"){tween.stop()}});this.sceneObjects.tweens=[]}if(this.shaderPasses&&this.shaderPasses.length){this.shaderPasses.forEach(pass=>{if(pass&&typeof pass.dispose==="function"){try{pass.dispose()}catch(e){}}});this.shaderPasses=[]}if(this.shaderPass&&typeof this.shaderPass.dispose==="function"){try{this.shaderPass.dispose()}catch(e){}}this.shaderPass=null;if(this.composer){this.composer.dispose();this.composer=null}this.renderPass=null;this.scene=null;this.camera=null;this.renderer=null;this.sceneObjects=null}initCoreObjects(){if(typeof window!=="undefined"){if(!window.innerWidth||!window.innerHeight){window.innerWidth=600;window.innerHeight=600}window.devicePixelRatio=window.devicePixelRatio||1;if(this.scene&&this.scene._amgScene&&this.scene._amgScene.assetMgr){const inputTexture=this.scene._amgScene.assetMgr.SyncLoad("share://input.texture");if(inputTexture&&inputTexture.width>0&&inputTexture.height>0){window.innerWidth=inputTexture.width;window.innerHeight=inputTexture.height}}}this.camera=new THREE.PerspectiveCamera(53.1,window.innerWidth/window.innerHeight,.1,1e4);this.camera.position.z=10;this.scene.add(this.camera);if(this.scene._amgScene==null){this.renderer=new THREE.WebGLRenderer({antialias:true});this.renderer.outputColorSpace=THREE.LinearSRGBColorSpace}if(this.renderer){this.renderer.setSize(window.innerWidth,window.innerHeight);this.renderer.setPixelRatio(window.devicePixelRatio)}this.sliders={};this.TWEEN=TWEEN;this.customEasings=customEasings;this.Duration=2e3}addShaderPass(shaderPassConfigs){if(!Array.isArray(shaderPassConfigs)){shaderPassConfigs=[shaderPassConfigs]}shaderPassConfigs.forEach(config=>{const atomicName=config.name;const className=atomicName.startsWith("Lumi")?atomicName.substring(4):atomicName;const shaderPassModule=require("../pp/Lumi"+className+"/"+className+"ShaderPass.js");const ShaderPassClass=shaderPassModule[className+"ShaderPass"];const initConfig=config&&(config.initConfig||config.config||config.params)||{};const shaderPass=new ShaderPassClass(initConfig);this.composer.addPass(shaderPass);this.shaderPasses.push(shaderPass)})}setupPostProcessing(shaderPassConfigs){const{EffectComposer}=require("./EffectComposer.js");const{RenderPass}=require("./RenderPass.js");this.composer=new EffectComposer(this.renderer);this.renderPass=new RenderPass(this.scene,this.camera);this.composer.addPass(this.renderPass);this.shaderPasses=[];this.addShaderPass(shaderPassConfigs)}initPostProcessing(){}init(container){if(this.renderer){if(container){container.appendChild(this.renderer.domElement)}else if(typeof document!=="undefined"){document.body.appendChild(this.renderer.domElement)}}if(typeof window!=="undefined"){window.addEventListener("resize",()=>this.handleResize())}}start(updateCallback){if(this.isAnimating)return;this.isAnimating=true;if(updateCallback){const animateFrame=()=>{if(!this.isAnimating)return;updateCallback();this.animationFrameId=requestAnimationFrame(animateFrame)};animateFrame()}else{this.renderer.setAnimationLoop(()=>{this.update()})}}updateScene(timestamp){if(!this.isAnimating){this.isAnimating=true}this.defaultUpdate(timestamp)}update(){if(this.usePostProcessing&&this.composer){if(this.renderPass){this.renderPass.camera=this.camera}this.composer.render()}else if(this.renderer){this.renderer.render(this.scene,this.camera)}}handleResize(){this.camera.aspect=window.innerWidth/window.innerHeight;this.camera.updateProjectionMatrix();if(this.renderer){this.renderer.setSize(window.innerWidth,window.innerHeight)}if(!this.isAnimating){this.update()}}loadTextures(){const textureLoader=new THREE.TextureLoader;return Promise.all([new Promise(resolve=>{this.texture1=textureLoader.load("image/Sample1.jpg",resolve);this.texture1.colorSpace=THREE.LinearSRGBColorSpace;this.texture1.wrapS=THREE.RepeatWrapping;this.texture1.wrapT=THREE.RepeatWrapping}),new Promise(resolve=>{this.texture2=textureLoader.load("image/Sample2.jpg",resolve);this.texture2.colorSpace=THREE.LinearSRGBColorSpace;this.texture2.wrapS=THREE.RepeatWrapping;this.texture2.wrapT=THREE.RepeatWrapping})])}_applyTweenInitialState(tween){if(!tween._propertiesAreSetUp){tween.start(0)}if(!tween._valuesStart||!tween._valuesEnd){return}tween._updateProperties(tween._object,tween._valuesStart,tween._valuesEnd,0);if(typeof tween._onUpdateCallback==="function"){tween._onUpdateCallback(tween._object,0)}}_applyTweenFinalState(tween){if(!tween._propertiesAreSetUp){tween.start(0)}if(!tween._valuesStart||!tween._valuesEnd){return}tween._updateProperties(tween._object,tween._valuesStart,tween._valuesEnd,1);if(typeof tween._onUpdateCallback==="function"){tween._onUpdateCallback(tween._object,1)}}seekToTime(time){if(!this.isAnimating){this.isAnimating=true}const clampedTime=Math.max(0,Math.min(time,this.Duration));if(this._predef_seekShaderPass){this._predef_seekShaderPass(clampedTime)}if(!this.sceneObjects.tweens||this.sceneObjects.tweens.length===0){return}let notStartTweens=[];let runningTweens=[];let finishedTweens=[];for(let i=0;i<=this.sceneObjects.tweens.length-1;i++){const tween=this.sceneObjects.tweens[i];let TweenStartTime=tween._delayTime+10;let TweenEndTime=tween._delayTime+tween._duration;if(clampedTime<=TweenStartTime){notStartTweens.push({time:TweenStartTime,tween:tween})}else if(clampedTime>=TweenEndTime){finishedTweens.push({time:TweenEndTime,tween:tween})}else{runningTweens.push(tween)}}notStartTweens.sort((a,b)=>b.time-a.time);finishedTweens.sort((a,b)=>a.time-b.time);notStartTweens.forEach(item=>{this._applyTweenInitialState(item.tween)});finishedTweens.forEach(item=>{this._applyTweenFinalState(item.tween)});runningTweens.forEach(tween=>{tween.stop();tween.start(0);tween.update(clampedTime)});this.update()}setupScene(){this.initSceneObjects();this.scene.background=null;this.createMainPlane();this.setupAnimations();return this.sceneObjects}initSceneObjects(){this.Duration=2e3;this.camera.position.set(0,0,10);this.camera.lookAt(new THREE.Vector3(0,0,0));this.sceneObjects={tweens:[],meshes:{},materials:{},uniforms:{}}}createMainPlane(){if(!this.texture1||!this.texture2){return}const geometry=new THREE.PlaneGeometry(10,10,200,200);const material=new THREE.ShaderMaterial({name:"LiquidWarpMaterial",uniforms:{texture1:{value:this.texture1},texture2:{value:this.texture2},u_turbulenceStrength:{value:0},u_displaceSweep:{value:0},u_directionBlurIntensity:{value:0},u_mixFactor:{value:0},u_revealRadius:{value:0},u_sharpness:{value:0},u_ratio:{value:1}},vertexShader:`
2
+ uniform float u_turbulenceStrength;
3
+ uniform float u_displaceSweep;
4
+ varying vec2 vUv;
5
+ varying float vSweepMask;
6
+
7
+ float hash(vec2 p) {
8
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
9
+ }
10
+
11
+ float noise(vec2 p) {
12
+ vec2 i = floor(p);
13
+ vec2 f = fract(p);
14
+ float a = hash(i);
15
+ float b = hash(i + vec2(1.0, 0.0));
16
+ float c = hash(i + vec2(0.0, 1.0));
17
+ float d = hash(i + vec2(1.0, 1.0));
18
+ vec2 u = f * f * (3.0 - 2.0 * f);
19
+ return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
20
+ }
21
+
22
+ void main() {
23
+ vUv = uv;
24
+ float sweep = smoothstep(u_displaceSweep - 0.25, u_displaceSweep + 0.05, uv.x);
25
+ vSweepMask = sweep;
26
+ vec2 noiseCoord = uv * (6.0 + u_turbulenceStrength * 8.0) + vec2(u_displaceSweep * 2.0, 0.0);
27
+ float n1 = noise(noiseCoord);
28
+ float n2 = noise(noiseCoord + 3.14);
29
+ float displaceAmount = (n1 - 0.5) * u_turbulenceStrength * 1.5 * sweep;
30
+ vec3 displacedPosition = position;
31
+ displacedPosition += normal * displaceAmount;
32
+ displacedPosition.x += (n1 - 0.5) * 0.6 * u_turbulenceStrength * sweep;
33
+ displacedPosition.y += (n2 - 0.5) * 0.4 * u_turbulenceStrength * sweep;
34
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(displacedPosition, 1.0);
35
+ }
36
+ `,fragmentShader:`
37
+ uniform sampler2D texture1;
38
+ uniform sampler2D texture2;
39
+ uniform float u_turbulenceStrength;
40
+ uniform float u_displaceSweep;
41
+ uniform float u_directionBlurIntensity;
42
+ uniform float u_mixFactor;
43
+ uniform float u_revealRadius;
44
+ uniform float u_sharpness;
45
+ uniform float u_ratio;
46
+
47
+ varying vec2 vUv;
48
+ varying float vSweepMask;
49
+
50
+ float hash(vec2 p) {
51
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
52
+ }
53
+
54
+ float noise(vec2 p) {
55
+ vec2 i = floor(p);
56
+ vec2 f = fract(p);
57
+ float a = hash(i);
58
+ float b = hash(i + vec2(1.0, 0.0));
59
+ float c = hash(i + vec2(0.0, 1.0));
60
+ float d = hash(i + vec2(1.0, 1.0));
61
+ vec2 u = f * f * (3.0 - 2.0 * f);
62
+ return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
63
+ }
64
+
65
+ vec2 getAspectCorrectUV(vec2 uv) {
66
+ vec2 aspectUV = uv;
67
+ if (u_ratio > 1.0) {
68
+ aspectUV.y /= u_ratio;
69
+ aspectUV.y += (1.0 - 1.0 / u_ratio) * 0.5;
70
+ } else {
71
+ aspectUV.x *= u_ratio;
72
+ aspectUV.x += (1.0 - u_ratio) * 0.5;
73
+ }
74
+ return aspectUV;
75
+ }
76
+
77
+ vec4 sampleDirectionalBlur(sampler2D tex, vec2 uv, float intensity) {
78
+ vec4 color = texture2D(tex, clamp(uv, 0.0, 1.0));
79
+ float total = 1.0;
80
+ if (intensity > 0.001) {
81
+ vec2 dir = vec2(1.0, 0.0);
82
+ float stepScale = intensity * 0.06;
83
+ for (int i = 1; i <= 3; i++) {
84
+ vec2 offset = dir * (float(i) * stepScale);
85
+ vec2 uvPos = clamp(uv + offset, 0.0, 1.0);
86
+ vec2 uvNeg = clamp(uv - offset, 0.0, 1.0);
87
+ color += texture2D(tex, uvPos);
88
+ color += texture2D(tex, uvNeg);
89
+ total += 2.0;
90
+ }
91
+ }
92
+ return color / total;
93
+ }
94
+
95
+ void main() {
96
+ float sweep = vSweepMask;
97
+ vec2 noiseCoord = vUv * (6.0 + u_turbulenceStrength * 8.0) + vec2(u_displaceSweep * 2.0, 0.0);
98
+ float n1 = noise(noiseCoord);
99
+ float n2 = noise(noiseCoord + 2.31);
100
+ vec2 warp = (vec2(n1 - 0.5, n2 - 0.5)) * 0.12 * u_turbulenceStrength * sweep;
101
+ vec2 warpedUv = clamp(vUv + warp, 0.0, 1.0);
102
+
103
+ vec4 colorA = sampleDirectionalBlur(texture1, warpedUv, u_directionBlurIntensity);
104
+ vec4 blurredB = sampleDirectionalBlur(texture2, warpedUv, u_directionBlurIntensity * (1.0 - u_sharpness));
105
+ vec4 sharpB = texture2D(texture2, warpedUv);
106
+ vec4 colorB = mix(blurredB, sharpB, u_sharpness);
107
+
108
+ vec2 aspectUV = getAspectCorrectUV(vUv);
109
+ float radius = length(aspectUV - vec2(0.5));
110
+ float softness = mix(0.35, 0.02, clamp(u_sharpness, 0.0, 1.0));
111
+ float reveal = smoothstep(u_revealRadius + softness, u_revealRadius - softness, radius);
112
+ float combinedMix = clamp(u_mixFactor + reveal * (1.0 - u_mixFactor), 0.0, 1.0);
113
+
114
+ vec4 finalColor = mix(colorA, colorB, combinedMix);
115
+ gl_FragColor = finalColor;
116
+ }
117
+ `,transparent:false,side:THREE.DoubleSide});const mesh=new THREE.Mesh(geometry,material);mesh.name="MainTransitionPlane";mesh.position.set(0,0,0);mesh.frustumCulled=false;this.scene.add(mesh);this.sceneObjects.meshes.mainPlane=mesh;this.sceneObjects.materials.mainMaterial=material;this.sceneObjects.uniforms=material.uniforms}setupAnimations(){if(!this.sceneObjects||!this.sceneObjects.uniforms){return}const uniforms=this.sceneObjects.uniforms;const tweens=this.sceneObjects.tweens;const easing=TWEEN.Easing.Sinusoidal.InOut;const ratioState={progress:0};const ratioTween=new TWEEN.Tween(ratioState).to({progress:this.Duration},this.Duration).easing(TWEEN.Easing.Linear.None).delay(0).onUpdate(()=>{if(!this.texture1||!this.texture1.image||!this.texture1.image.width||!this.texture1.image.height){uniforms.u_ratio.value=1}else{uniforms.u_ratio.value=this.texture1.image.width/this.texture1.image.height}}).start();tweens.push(ratioTween);const turbulenceRiseState={value:0};const turbulenceRise=new TWEEN.Tween(turbulenceRiseState).to({value:.85},650).delay(50).easing(easing).onUpdate(obj=>{uniforms.u_turbulenceStrength.value=obj.value}).start();tweens.push(turbulenceRise);const turbulenceFallState={value:.85};const turbulenceFall=new TWEEN.Tween(turbulenceFallState).to({value:0},800).delay(1e3).easing(easing).onUpdate(obj=>{uniforms.u_turbulenceStrength.value=obj.value}).start();tweens.push(turbulenceFall);const sweepRiseState={value:0};const sweepRise=new TWEEN.Tween(sweepRiseState).to({value:.9},650).delay(50).easing(easing).onUpdate(obj=>{uniforms.u_displaceSweep.value=obj.value}).start();tweens.push(sweepRise);const sweepExitState={value:.9};const sweepExit=new TWEEN.Tween(sweepExitState).to({value:1},800).delay(1e3).easing(easing).onUpdate(obj=>{uniforms.u_displaceSweep.value=obj.value}).start();tweens.push(sweepExit);const blurPrepState={value:0};const blurPrep=new TWEEN.Tween(blurPrepState).to({value:.1},500).delay(50).easing(easing).onUpdate(obj=>{uniforms.u_directionBlurIntensity.value=obj.value}).start();tweens.push(blurPrep);const blurRiseState={value:.1};const blurRise=new TWEEN.Tween(blurRiseState).to({value:1},200).delay(550).easing(easing).onUpdate(obj=>{uniforms.u_directionBlurIntensity.value=obj.value}).start();tweens.push(blurRise);const blurFallState={value:1};const blurFall=new TWEEN.Tween(blurFallState).to({value:0},800).delay(1e3).easing(easing).onUpdate(obj=>{uniforms.u_directionBlurIntensity.value=obj.value}).start();tweens.push(blurFall);const revealState={value:0};const revealTween=new TWEEN.Tween(revealState).to({value:1},700).delay(500).easing(easing).onUpdate(obj=>{uniforms.u_revealRadius.value=obj.value}).start();tweens.push(revealTween);const mixIntroState={value:0};const mixIntro=new TWEEN.Tween(mixIntroState).to({value:.8},700).delay(500).easing(easing).onUpdate(obj=>{uniforms.u_mixFactor.value=obj.value}).start();tweens.push(mixIntro);const mixFinalizeState={value:.8};const mixFinalize=new TWEEN.Tween(mixFinalizeState).to({value:1},500).delay(900).easing(easing).onUpdate(obj=>{uniforms.u_mixFactor.value=obj.value}).start();tweens.push(mixFinalize);const sharpnessState={value:0};const sharpnessTween=new TWEEN.Tween(sharpnessState).to({value:1},500).delay(900).easing(easing).onUpdate(obj=>{uniforms.u_sharpness.value=obj.value}).start();tweens.push(sharpnessTween)}defaultUpdate(timestamp){if(this.sceneObjects.tweens&&this.sceneObjects.tweens.length>0){this.sceneObjects.tweens.forEach(tween=>{if(tween&&typeof tween.update==="function"){tween.update(timestamp)}})}this.update()}_predef_addTopCenterBottomStyleBorder(parent,offset,texture,cutoutAreaPosition,cutoutAreaSize){const aspectRatio=this.texture1.image.width/this.texture1.image.height;const parentInitScale=parent.scale.y;const parentPosition=parent.position;const textureWidth=texture.image.width;const textureHeight=texture.image.height;const geometry=new THREE.PlaneGeometry(10,10);const textureCenter=texture.clone();textureCenter.repeat.set(1,cutoutAreaSize.y/textureHeight);textureCenter.offset.set(0,(textureHeight-cutoutAreaPosition.y-cutoutAreaSize.y)/textureHeight);const materialCenter=new THREE.MeshBasicMaterial({map:textureCenter,transparent:true,opacity:1,premultipliedAlpha:true,side:THREE.DoubleSide});materialCenter.name="PlaneCenterMaterial";const planeCenter=new THREE.Mesh(geometry,materialCenter);planeCenter.name="PlaneCenter";planeCenter.position.set(parentPosition.x+offset.x,parentPosition.y+offset.y,parentPosition.z+offset.z);planeCenter.scale.set(parentInitScale*aspectRatio/(cutoutAreaSize.x/textureWidth),parentInitScale,1);this.scene.add(planeCenter);parent.attach(planeCenter);const textureTop=texture.clone();textureTop.repeat.set(1,cutoutAreaPosition.y/textureHeight);textureTop.offset.set(0,1-cutoutAreaPosition.y/textureHeight);const materialTop=new THREE.MeshBasicMaterial({map:textureTop,transparent:true,opacity:1,premultipliedAlpha:true,side:THREE.DoubleSide});materialTop.name="PlaneTopMaterial";const scaleXTop=parentInitScale*aspectRatio/(cutoutAreaSize.x/textureWidth);const scaleYTop=scaleXTop*cutoutAreaPosition.y/textureWidth;const planeTop=new THREE.Mesh(geometry,materialTop);planeTop.name="PlaneTop";planeTop.position.set(parentPosition.x+offset.x,parentPosition.y+offset.y+parentInitScale*10*.5+scaleYTop*10*.5,parentPosition.z+offset.z);planeTop.scale.set(scaleXTop,scaleYTop,1);this.scene.add(planeTop);parent.attach(planeTop);const textureBottom=texture.clone();textureBottom.repeat.set(1,(textureHeight-cutoutAreaPosition.y-cutoutAreaSize.y)/textureHeight);textureBottom.offset.set(0,0);const materialBottom=new THREE.MeshBasicMaterial({map:textureBottom,transparent:true,opacity:1,premultipliedAlpha:true,side:THREE.DoubleSide});materialBottom.name="PlaneBottomMaterial";const scaleXBottom=parentInitScale*aspectRatio/(cutoutAreaSize.x/textureWidth);const scaleYBottom=scaleXBottom*(textureHeight-cutoutAreaPosition.y-cutoutAreaSize.y)/textureWidth;const planeBottom=new THREE.Mesh(geometry,materialBottom);planeBottom.name="PlaneBottom";planeBottom.position.set(parentPosition.x+offset.x,parentPosition.y+offset.y-parentInitScale*10*.5-scaleYBottom*10*.5,parentPosition.z+offset.z);planeBottom.scale.set(scaleXBottom,scaleYBottom,1);this.scene.add(planeBottom);parent.attach(planeBottom)}_predef_loadVideoTexture(path,loop,playbackRate){if(this.scene._amgScene==null){const video=document.createElement("video");video.src=path;video.muted=true;video.loop=loop;video.load();const videoTexture=new THREE.VideoTexture(video);videoTexture.currentTime=0;videoTexture.playbackRate=playbackRate;this.videoTexture=videoTexture;return videoTexture}else if(typeof this.scene._amgScene==="string"){return new THREE.Texture}else{const texture=new THREE.VideoTexture(path,loop,playbackRate);texture.load();return texture}}_predef_seekVideoTexture(time){if(this.videoTexture!=null){const videoTexture=this.videoTexture;const video=videoTexture.image;if(video.readyState>=2){const textureProperties=this.renderer.properties.get(videoTexture);var newTime=time/1e3*videoTexture.playbackRate;if(newTime<0){newTime=0}else if(newTime>video.duration){if(video.loop){newTime=newTime%video.duration}else{newTime=video.duration}}if(textureProperties.__version==videoTexture.version){videoTexture.currentTime=newTime;video.currentTime=videoTexture.currentTime}}}}_predef_seekShaderPass(time){if(!("shaderPasses"in this)||this.shaderPasses==null){return}this.shaderPasses.forEach(shaderPass=>{if(shaderPass.constructor.name==="AnimSeqLoadAndCropBlendShaderPass"){if(this.texture1&&this.texture1.image){const ratio=this.texture1.image.width/this.texture1.image.height;if(typeof shaderPass.setAspectRatio==="function"){shaderPass.setAspectRatio(ratio)}}}})}}exports.ScriptScene=ScriptScene;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/three-amg-wrapper.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api="undefined"!=typeof effect?effect:"undefined"!=typeof tt?tt:"undefined"!=typeof lynx?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const{getCurrentScene,setCurrentScene,clearCurrentScene}=require("./wrapper/runtime");if(typeof window==="undefined"){const mockWindow={innerWidth:720,innerHeight:1280,devicePixelRatio:1,addEventListener:function(event,callback){},requestAnimationFrame:function(callback){},cancelAnimationFrame:function(id){},removeEventListener:function(event,callback){}};const mockDocument={createElement:function(tagName){return{style:{},setAttribute:function(){},appendChild:function(){}}},body:{appendChild:function(){}}};const getGlobalObject=function(){if(typeof global!=="undefined")return global;if(typeof self!=="undefined")return self;if(typeof window!=="undefined")return window;if(typeof this!=="undefined")return this;return{}};const globalObj=getGlobalObject();globalObj.window=mockWindow;globalObj.document=mockDocument;globalObj.cancelAnimationFrame=mockWindow.cancelAnimationFrame}const THREE={};const __THREE_CONSTS=require("./wrapper/Constants");THREE.FrontSide=__THREE_CONSTS.FrontSide;THREE.BackSide=__THREE_CONSTS.BackSide;THREE.DoubleSide=__THREE_CONSTS.DoubleSide;THREE.NoBlending=__THREE_CONSTS.NoBlending;THREE.NormalBlending=__THREE_CONSTS.NormalBlending;THREE.AdditiveBlending=__THREE_CONSTS.AdditiveBlending;THREE.SubtractiveBlending=__THREE_CONSTS.SubtractiveBlending;THREE.MultiplyBlending=__THREE_CONSTS.MultiplyBlending;THREE.CustomBlending=__THREE_CONSTS.CustomBlending;THREE.RepeatWrapping=__THREE_CONSTS.RepeatWrapping;THREE.ClampToEdgeWrapping=__THREE_CONSTS.ClampToEdgeWrapping;THREE.MirroredRepeatWrapping=__THREE_CONSTS.MirroredRepeatWrapping;const Vector2Wrapper=require("./wrapper/Vector2").Vector2;const Vector3Wrapper=require("./wrapper/Vector3").Vector3;const Vector4Wrapper=require("./wrapper/Vector4").Vector4;const EulerWrapper=require("./wrapper/Euler").Euler;const ColorWrapper=require("./wrapper/Color").Color;const Matrix4Wrapper=require("./wrapper/Matrix4").Matrix4;const QuaternionWrapper=require("./wrapper/Quaternion").Quaternion;const MathUtilsWrapper=require("./wrapper/MathUtils").MathUtils;const Box3Wrapper=require("./wrapper/Box3").Box3;const Box2Wrapper=require("./wrapper/Box2").Box2;const WebGLRendererWrapper=require("./wrapper/WebGLRenderer").WebGLRenderer;const Vector2=Vector2Wrapper;const Vector3=Vector3Wrapper;const Vector4=Vector4Wrapper;const Euler=EulerWrapper;const Color=ColorWrapper;const Matrix4=Matrix4Wrapper;const Quaternion=QuaternionWrapper;const MathUtils=MathUtilsWrapper;const Box3=Box3Wrapper;const Box2=Box2Wrapper;const WebGLRenderer=WebGLRendererWrapper;const BufferGeometryWrapper=require("./wrapper/BufferGeometry").BufferGeometry;const BufferAttributeWrapper=require("./wrapper/BufferAttribute").BufferAttribute;const BoxGeometryWrapper=require("./wrapper/BoxGeometry").BoxGeometry;const PlaneGeometryWrapper=require("./wrapper/PlaneGeometry").PlaneGeometry;const SphereGeometryWrapper=require("./wrapper/SphereGeometry").SphereGeometry;const CylinderGeometryWrapper=require("./wrapper/CylinderGeometry").CylinderGeometry;const CapsuleGeometryWrapper=require("./wrapper/CapsuleGeometry").CapsuleGeometry;const ShapeWrapper=require("./wrapper/Shape").Shape;const ShapeGeometryWrapper=require("./wrapper/ShapeGeometry").ShapeGeometry;const ExtrudeGeometryWrapper=require("./wrapper/ExtrudeGeometry").ExtrudeGeometry;const CurvePathWrapper=require("./wrapper/CurvePath").CurvePath;const LineCurveWrapper=require("./wrapper/CurvePath").LineCurve;const BufferGeometry=BufferGeometryWrapper;const BufferAttribute=BufferAttributeWrapper;const BoxGeometry=BoxGeometryWrapper;const PlaneGeometry=PlaneGeometryWrapper;const SphereGeometry=SphereGeometryWrapper;const CylinderGeometry=CylinderGeometryWrapper;const CapsuleGeometry=CapsuleGeometryWrapper;const Shape=ShapeWrapper;const ShapeGeometry=ShapeGeometryWrapper;const ExtrudeGeometry=ExtrudeGeometryWrapper;const CurvePath=CurvePathWrapper;const LineCurve=LineCurveWrapper;const TextureWrapper=require("./wrapper/Texture").Texture;const VideoTextureWrapper=require("./wrapper/Texture").VideoTexture;const TextureLoaderWrapper=require("./wrapper/Texture").TextureLoader;const Texture=TextureWrapper;const VideoTexture=VideoTextureWrapper;const TextureLoader=TextureLoaderWrapper;const MaterialWrapper=require("./wrapper/Material").Material;const MeshBasicMaterialWrapper=require("./wrapper/MeshBasicMaterial").MeshBasicMaterial;const ShaderMaterialWrapper=require("./wrapper/ShaderMaterial").ShaderMaterial;const Material=MaterialWrapper;const MeshBasicMaterial=MeshBasicMaterialWrapper;const ShaderMaterial=ShaderMaterialWrapper;const Object3DWrapper=require("./wrapper/Object3D").Object3D;const GroupWrapper=require("./wrapper/Group").Group;const MeshWrapper=require("./wrapper/Mesh").MeshWrapper;const PerspectiveCameraWrapper=require("./wrapper/PerspectiveCamera").PerspectiveCamera;const Object3D=Object3DWrapper;const Group=GroupWrapper;const Mesh=MeshWrapper;const PerspectiveCamera=PerspectiveCameraWrapper;class Scene{constructor(){this._objects=[];setCurrentScene(this);console.log("AMG scene created")}add(...objects){for(let i=0;i<objects.length;i++){const object=objects[i];if(!object){console.warn("Scene: 尝试添加空对象");continue}if(object._amgEntity){if(this._objects.indexOf(object)===-1){this._objects.push(object);if(this._amgScene){if(object._transform.parent){object._transform.parent.removeTransform(object._transform)}object._transform.parent=null;this._amgScene.addEntity(object._amgEntity)}console.log("Scene: added object to scene:",object._amgEntity.name)}else{console.log("Scene: object already exists:",object._amgEntity.name)}}else{console.warn("Scene: 添加到场景的对象没有_amgEntity属性")}}}remove(object){const index=this._objects.indexOf(object);if(index!==-1){this._objects.splice(index,1);console.log("Scene: removed object from scene, not delete AMG entity.")}}delete(object){const index=this._objects.indexOf(object);if(index!==-1){this._objects.splice(index,1);if(object._amgEntity){this._amgScene.removeEntity(object._amgEntity)}console.log("Scene: delete object from scene, delete AMG entity.")}}update(){this._objects.forEach(obj=>obj.update&&obj.update())}seekToTime(time){this._objects.forEach(obj=>obj.seekToTime&&obj.seekToTime(time))}dispose(){console.log("Scene: 开始清理场景资源");while(this._objects.length>0){const object=this._objects[0];this.delete(object);if(object.dispose&&typeof object.dispose==="function"){object.dispose()}if(object.geometry&&object.geometry.dispose){object.geometry.dispose()}if(object.material){if(Array.isArray(object.material)){object.material.forEach(material=>{if(material.dispose)material.dispose()})}else if(object.material.dispose){object.material.dispose()}}}if(this._amgScene){this._amgScene=null}this._objects=[];if(getCurrentScene()===this){clearCurrentScene()}console.log("Scene: 场景资源清理完成")}}class QuadraticBezierCurve3{constructor(p0,p1,p2){this.p0=p0;this.p1=p1;this.p2=p2}getPoint(t){const u=1-t;const tt=t*t;const uu=u*u;const ut2=2*u*t;return new Vector3(uu*this.p0.x+ut2*this.p1.x+tt*this.p2.x,uu*this.p0.y+ut2*this.p1.y+tt*this.p2.y,uu*this.p0.z+ut2*this.p1.z+tt*this.p2.z)}getPoints(divisions){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}}THREE.Vector2=Vector2;THREE.Vector3=Vector3;THREE.Vector4=Vector4;THREE.Euler=Euler;THREE.Color=Color;THREE.Matrix4=Matrix4;THREE.Quaternion=Quaternion;THREE.QuadraticBezierCurve3=QuadraticBezierCurve3;THREE.Box3=Box3;THREE.Box2=Box2;THREE.MathUtils=MathUtils;THREE.Scene=Scene;THREE.WebGLRenderer=WebGLRenderer;THREE.BufferGeometry=BufferGeometry;THREE.BufferAttribute=BufferAttribute;THREE.Float32BufferAttribute=BufferAttribute;THREE.BoxGeometry=BoxGeometry;THREE.PlaneGeometry=PlaneGeometry;THREE.SphereGeometry=SphereGeometry;THREE.CylinderGeometry=CylinderGeometry;THREE.CapsuleGeometry=CapsuleGeometry;THREE.Shape=Shape;THREE.ShapeGeometry=ShapeGeometry;THREE.ExtrudeGeometry=ExtrudeGeometry;THREE.CurvePath=CurvePath;THREE.LineCurve=LineCurve;THREE.Material=Material;THREE.MeshBasicMaterial=MeshBasicMaterial;THREE.ShaderMaterial=ShaderMaterial;THREE.Texture=Texture;THREE.VideoTexture=VideoTexture;THREE.TextureLoader=TextureLoader;THREE.Object3D=Group;THREE.Group=Group;THREE.Mesh=Mesh;THREE.PerspectiveCamera=PerspectiveCamera;exports.THREE=THREE;exports.getCurrentScene=getCurrentScene;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/tween.js ADDED
@@ -0,0 +1 @@
 
 
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var Easing=Object.freeze({Linear:Object.freeze({None:function(amount){return amount},In:function(amount){return amount},Out:function(amount){return amount},InOut:function(amount){return amount}}),Quadratic:Object.freeze({In:function(amount){return amount*amount},Out:function(amount){return amount*(2-amount)},InOut:function(amount){if((amount*=2)<1){return.5*amount*amount}return-.5*(--amount*(amount-2)-1)}}),Cubic:Object.freeze({In:function(amount){return amount*amount*amount},Out:function(amount){return--amount*amount*amount+1},InOut:function(amount){if((amount*=2)<1){return.5*amount*amount*amount}return.5*((amount-=2)*amount*amount+2)}}),Quartic:Object.freeze({In:function(amount){return amount*amount*amount*amount},Out:function(amount){return 1- --amount*amount*amount*amount},InOut:function(amount){if((amount*=2)<1){return.5*amount*amount*amount*amount}return-.5*((amount-=2)*amount*amount*amount-2)}}),Quintic:Object.freeze({In:function(amount){return amount*amount*amount*amount*amount},Out:function(amount){return--amount*amount*amount*amount*amount+1},InOut:function(amount){if((amount*=2)<1){return.5*amount*amount*amount*amount*amount}return.5*((amount-=2)*amount*amount*amount*amount+2)}}),Sinusoidal:Object.freeze({In:function(amount){return 1-Math.sin((1-amount)*Math.PI/2)},Out:function(amount){return Math.sin(amount*Math.PI/2)},InOut:function(amount){return.5*(1-Math.sin(Math.PI*(.5-amount)))}}),Exponential:Object.freeze({In:function(amount){return amount===0?0:Math.pow(1024,amount-1)},Out:function(amount){return amount===1?1:1-Math.pow(2,-10*amount)},InOut:function(amount){if(amount===0){return 0}if(amount===1){return 1}if((amount*=2)<1){return.5*Math.pow(1024,amount-1)}return.5*(-Math.pow(2,-10*(amount-1))+2)}}),Circular:Object.freeze({In:function(amount){return 1-Math.sqrt(1-amount*amount)},Out:function(amount){return Math.sqrt(1- --amount*amount)},InOut:function(amount){if((amount*=2)<1){return-.5*(Math.sqrt(1-amount*amount)-1)}return.5*(Math.sqrt(1-(amount-=2)*amount)+1)}}),Elastic:Object.freeze({In:function(amount){if(amount===0){return 0}if(amount===1){return 1}return-Math.pow(2,10*(amount-1))*Math.sin((amount-1.1)*5*Math.PI)},Out:function(amount){if(amount===0){return 0}if(amount===1){return 1}return Math.pow(2,-10*amount)*Math.sin((amount-.1)*5*Math.PI)+1},InOut:function(amount){if(amount===0){return 0}if(amount===1){return 1}amount*=2;if(amount<1){return-.5*Math.pow(2,10*(amount-1))*Math.sin((amount-1.1)*5*Math.PI)}return.5*Math.pow(2,-10*(amount-1))*Math.sin((amount-1.1)*5*Math.PI)+1}}),Back:Object.freeze({In:function(amount){var s=1.70158;return amount===1?1:amount*amount*((s+1)*amount-s)},Out:function(amount){var s=1.70158;return amount===0?0:--amount*amount*((s+1)*amount+s)+1},InOut:function(amount){var s=1.70158*1.525;if((amount*=2)<1){return.5*(amount*amount*((s+1)*amount-s))}return.5*((amount-=2)*amount*((s+1)*amount+s)+2)}}),Bounce:Object.freeze({In:function(amount){return 1-Easing.Bounce.Out(1-amount)},Out:function(amount){if(amount<1/2.75){return 7.5625*amount*amount}else if(amount<2/2.75){return 7.5625*(amount-=1.5/2.75)*amount+.75}else if(amount<2.5/2.75){return 7.5625*(amount-=2.25/2.75)*amount+.9375}else{return 7.5625*(amount-=2.625/2.75)*amount+.984375}},InOut:function(amount){if(amount<.5){return Easing.Bounce.In(amount*2)*.5}return Easing.Bounce.Out(amount*2-1)*.5+.5}}),generatePow:function(power){if(power===void 0){power=4}power=power<Number.EPSILON?Number.EPSILON:power;power=power>1e4?1e4:power;return{In:function(amount){return Math.pow(amount,power)},Out:function(amount){return 1-Math.pow(1-amount,power)},InOut:function(amount){if(amount<.5){return Math.pow(amount*2,power)/2}return(1-Math.pow(2-amount*2,power))/2+.5}}}});var now=function(){if(typeof process!=="undefined"&&process.hrtime){if(!now._nodeStartTime){now._nodeStartTime=process.hrtime()}var hrTime=process.hrtime(now._nodeStartTime);return hrTime[0]*1e3+hrTime[1]/1e6}if(typeof now._startTime==="undefined"){now._startTime=Date.now();now._lastReturned=0}var elapsed=Date.now()-now._startTime;if(elapsed<=now._lastReturned){now._lastReturned+=.001}else{now._lastReturned=elapsed}return now._lastReturned};function setNow(nowFunction){_nowFunc=nowFunction}var Group=function(){function Group(){var tweens=[];for(var _i=0;_i<arguments.length;_i++){tweens[_i]=arguments[_i]}this._tweens={};this._tweensAddedDuringUpdate={};this.add.apply(this,tweens)}Group.prototype.getAll=function(){var _this=this;return Object.keys(this._tweens).map(function(tweenId){return _this._tweens[tweenId]})};Group.prototype.removeAll=function(){this._tweens={}};Group.prototype.add=function(){var _a;var tweens=[];for(var _i=0;_i<arguments.length;_i++){tweens[_i]=arguments[_i]}for(var _b=0,tweens_1=tweens;_b<tweens_1.length;_b++){var tween=tweens_1[_b];(_a=tween._group)===null||_a===void 0?void 0:_a.remove(tween);tween._group=this;this._tweens[tween.getId()]=tween;this._tweensAddedDuringUpdate[tween.getId()]=tween}};Group.prototype.remove=function(){var tweens=[];for(var _i=0;_i<arguments.length;_i++){tweens[_i]=arguments[_i]}for(var _a=0,tweens_2=tweens;_a<tweens_2.length;_a++){var tween=tweens_2[_a];tween._group=undefined;delete this._tweens[tween.getId()];delete this._tweensAddedDuringUpdate[tween.getId()]}};Group.prototype.allStopped=function(){return this.getAll().every(function(tween){return!tween.isPlaying()})};Group.prototype.update=function(time,preserve){if(time===void 0){time=now()}if(preserve===void 0){preserve=true}var tweenIds=Object.keys(this._tweens);if(tweenIds.length===0)return;while(tweenIds.length>0){this._tweensAddedDuringUpdate={};for(var i=0;i<tweenIds.length;i++){var tween=this._tweens[tweenIds[i]];var autoStart=!preserve;if(tween&&tween.update(time,autoStart)===false&&!preserve)this.remove(tween)}tweenIds=Object.keys(this._tweensAddedDuringUpdate)}};Group.prototype.onComplete=function(callback){var group=this.getAll();group.forEach(function(tween){var prevCallback=tween.getCompleteCallback();tween.onComplete(function(){prevCallback===null||prevCallback===void 0?void 0:prevCallback(tween);var completedGroup=group.filter(function(tween){return!tween.isPlaying()});if(completedGroup.length===group.length-1)callback(group)})})};return Group}();var Interpolation={Linear:function(v,k){var m=v.length-1;var f=m*k;var i=Math.floor(f);var fn=Interpolation.Utils.Linear;if(k<0){return fn(v[0],v[1],f)}if(k>1){return fn(v[m],v[m-1],m-f)}return fn(v[i],v[i+1>m?m:i+1],f-i)},Bezier:function(v,k){var b=0;var n=v.length-1;var pw=Math.pow;var bn=Interpolation.Utils.Bernstein;for(var i=0;i<=n;i++){b+=pw(1-k,n-i)*pw(k,i)*v[i]*bn(n,i)}return b},CatmullRom:function(v,k){var m=v.length-1;var f=m*k;var i=Math.floor(f);var fn=Interpolation.Utils.CatmullRom;if(v[0]===v[m]){if(k<0){i=Math.floor(f=m*(1+k))}return fn(v[(i-1+m)%m],v[i],v[(i+1)%m],v[(i+2)%m],f-i)}else{if(k<0){return v[0]-(fn(v[0],v[0],v[1],v[1],-f)-v[0])}if(k>1){return v[m]-(fn(v[m],v[m],v[m-1],v[m-1],f-m)-v[m])}return fn(v[i?i-1:0],v[i],v[m<i+1?m:i+1],v[m<i+2?m:i+2],f-i)}},Utils:{Linear:function(p0,p1,t){return(p1-p0)*t+p0},Bernstein:function(n,i){var fc=Interpolation.Utils.Factorial;return fc(n)/fc(i)/fc(n-i)},Factorial:function(){var a=[1];return function(n){var s=1;if(a[n]){return a[n]}for(var i=n;i>1;i--){s*=i}a[n]=s;return s}}(),CatmullRom:function(p0,p1,p2,p3,t){var v0=(p2-p0)*.5;var v1=(p3-p1)*.5;var t2=t*t;var t3=t*t2;return(2*p1-2*p2+v0+v1)*t3+(-3*p1+3*p2-2*v0-v1)*t2+v0*t+p1}}};var Sequence=function(){function Sequence(){}Sequence.nextId=function(){return Sequence._nextId++};Sequence._nextId=0;return Sequence}();var mainGroup=new Group;var Tween=function(){function Tween(object,group){this._isPaused=false;this._pauseStart=0;this._valuesStart={};this._valuesEnd={};this._valuesStartRepeat={};this._duration=1e3;this._isDynamic=false;this._initialRepeat=0;this._repeat=0;this._yoyo=false;this._isPlaying=false;this._reversed=false;this._delayTime=0;this._startTime=0;this._easingFunction=Easing.Linear.None;this._interpolationFunction=Interpolation.Linear;this._chainedTweens=[];this._onStartCallbackFired=false;this._onEveryStartCallbackFired=false;this._id=Sequence.nextId();this._isChainStopped=false;this._propertiesAreSetUp=false;this._goToEnd=false;this._object=object;if(typeof group==="object"){this._group=group;group.add(this)}else if(group===true){this._group=mainGroup;mainGroup.add(this)}}Tween.prototype.getId=function(){return this._id};Tween.prototype.getCompleteCallback=function(){return this._onCompleteCallback};Tween.prototype.isPlaying=function(){return this._isPlaying};Tween.prototype.isPaused=function(){return this._isPaused};Tween.prototype.getDuration=function(){return this._duration};Tween.prototype.to=function(target,duration){if(duration===void 0){duration=1e3}if(this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");this._valuesEnd=target;this._propertiesAreSetUp=false;this._duration=duration<0?0:duration;return this};Tween.prototype.duration=function(duration){if(duration===void 0){duration=1e3}this._duration=duration<0?0:duration;return this};Tween.prototype.dynamic=function(dynamic){if(dynamic===void 0){dynamic=false}this._isDynamic=dynamic;return this};Tween.prototype.start=function(time,overrideStartingValues){if(time===void 0){time=now()}if(overrideStartingValues===void 0){overrideStartingValues=false}if(this._isPlaying){return this}this._repeat=this._initialRepeat;if(this._reversed){this._reversed=false;for(var property in this._valuesStartRepeat){this._swapEndStartRepeatValues(property);this._valuesStart[property]=this._valuesStartRepeat[property]}}this._isPlaying=true;this._isPaused=false;this._onStartCallbackFired=false;this._onEveryStartCallbackFired=false;this._isChainStopped=false;this._startTime=time;this._startTime+=this._delayTime;if(!this._propertiesAreSetUp||overrideStartingValues){this._propertiesAreSetUp=true;if(!this._isDynamic){var tmp={};for(var prop in this._valuesEnd)tmp[prop]=this._valuesEnd[prop];this._valuesEnd=tmp}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,overrideStartingValues)}return this};Tween.prototype.startFromCurrentValues=function(time){return this.start(time,true)};Tween.prototype._setupProperties=function(_object,_valuesStart,_valuesEnd,_valuesStartRepeat,overrideStartingValues){for(var property in _valuesEnd){var startValue=_object[property];var startValueIsArray=Array.isArray(startValue);var propType=startValueIsArray?"array":typeof startValue;var isInterpolationList=!startValueIsArray&&Array.isArray(_valuesEnd[property]);if(propType==="undefined"||propType==="function"){continue}if(isInterpolationList){var endValues=_valuesEnd[property];if(endValues.length===0){continue}var temp=[startValue];for(var i=0,l=endValues.length;i<l;i+=1){var value=this._handleRelativeValue(startValue,endValues[i]);if(isNaN(value)){isInterpolationList=false;console.warn("Found invalid interpolation list. Skipping.");break}temp.push(value)}if(isInterpolationList){_valuesEnd[property]=temp}}if((propType==="object"||startValueIsArray)&&startValue&&!isInterpolationList){_valuesStart[property]=startValueIsArray?[]:{};var nestedObject=startValue;for(var prop in nestedObject){_valuesStart[property][prop]=nestedObject[prop]}_valuesStartRepeat[property]=startValueIsArray?[]:{};var endValues=_valuesEnd[property];if(!this._isDynamic){var tmp={};for(var prop in endValues)tmp[prop]=endValues[prop];_valuesEnd[property]=endValues=tmp}this._setupProperties(nestedObject,_valuesStart[property],endValues,_valuesStartRepeat[property],overrideStartingValues)}else{if(typeof _valuesStart[property]==="undefined"||overrideStartingValues){_valuesStart[property]=startValue}if(!startValueIsArray){_valuesStart[property]*=1}if(isInterpolationList){_valuesStartRepeat[property]=_valuesEnd[property].slice().reverse()}else{_valuesStartRepeat[property]=_valuesStart[property]||0}}}};Tween.prototype.stop=function(){if(!this._isChainStopped){this._isChainStopped=true;this.stopChainedTweens()}if(!this._isPlaying){return this}this._isPlaying=false;this._isPaused=false;if(this._onStopCallback){this._onStopCallback(this._object)}return this};Tween.prototype.end=function(){this._goToEnd=true;this.update(this._startTime+this._duration);return this};Tween.prototype.pause=function(time){if(time===void 0){time=now()}if(this._isPaused||!this._isPlaying){return this}this._isPaused=true;this._pauseStart=time;return this};Tween.prototype.resume=function(time){if(time===void 0){time=now()}if(!this._isPaused||!this._isPlaying){return this}this._isPaused=false;this._startTime+=time-this._pauseStart;this._pauseStart=0;return this};Tween.prototype.stopChainedTweens=function(){for(var i=0,numChainedTweens=this._chainedTweens.length;i<numChainedTweens;i++){this._chainedTweens[i].stop()}return this};Tween.prototype.group=function(group){if(!group){console.warn("tween.group() without args has been removed, use group.add(tween) instead.");return this}group.add(this);return this};Tween.prototype.remove=function(){var _a;(_a=this._group)===null||_a===void 0?void 0:_a.remove(this);return this};Tween.prototype.delay=function(amount){if(amount===void 0){amount=0}this._delayTime=amount;return this};Tween.prototype.repeat=function(times){if(times===void 0){times=0}this._initialRepeat=times;this._repeat=times;return this};Tween.prototype.repeatDelay=function(amount){this._repeatDelayTime=amount;return this};Tween.prototype.yoyo=function(yoyo){if(yoyo===void 0){yoyo=false}this._yoyo=yoyo;return this};Tween.prototype.easing=function(easingFunction){if(easingFunction===void 0){easingFunction=Easing.Linear.None}this._easingFunction=easingFunction;return this};Tween.prototype.interpolation=function(interpolationFunction){if(interpolationFunction===void 0){interpolationFunction=Interpolation.Linear}this._interpolationFunction=interpolationFunction;return this};Tween.prototype.chain=function(){var tweens=[];for(var _i=0;_i<arguments.length;_i++){tweens[_i]=arguments[_i]}this._chainedTweens=tweens;return this};Tween.prototype.onStart=function(callback){this._onStartCallback=callback;return this};Tween.prototype.onEveryStart=function(callback){this._onEveryStartCallback=callback;return this};Tween.prototype.onUpdate=function(callback){this._onUpdateCallback=callback;return this};Tween.prototype.onRepeat=function(callback){this._onRepeatCallback=callback;return this};Tween.prototype.onComplete=function(callback){this._onCompleteCallback=callback;return this};Tween.prototype.onStop=function(callback){this._onStopCallback=callback;return this};Tween.prototype.update=function(time,autoStart){var _this=this;var _a;if(time===void 0){time=now()}if(autoStart===void 0){autoStart=Tween.autoStartOnUpdate}if(this._isPaused)return true;var property;if(!this._goToEnd&&!this._isPlaying){if(autoStart)this.start(time,true);else return false}this._goToEnd=false;if(time<this._startTime){return true}if(this._onStartCallbackFired===false){if(this._onStartCallback){this._onStartCallback(this._object)}this._onStartCallbackFired=true}if(this._onEveryStartCallbackFired===false){if(this._onEveryStartCallback){this._onEveryStartCallback(this._object)}this._onEveryStartCallbackFired=true}var elapsedTime=time-this._startTime;var durationAndDelay=this._duration+((_a=this._repeatDelayTime)!==null&&_a!==void 0?_a:this._delayTime);var totalTime=this._duration+this._repeat*durationAndDelay;var calculateElapsedPortion=function(){if(_this._duration===0)return 1;if(elapsedTime>totalTime){return 1}var timesRepeated=Math.trunc(elapsedTime/durationAndDelay);var timeIntoCurrentRepeat=elapsedTime-timesRepeated*durationAndDelay;var portion=Math.min(timeIntoCurrentRepeat/_this._duration,1);if(portion===0&&elapsedTime===_this._duration){return 1}return portion};var elapsed=calculateElapsedPortion();var value=this._easingFunction(elapsed);this._updateProperties(this._object,this._valuesStart,this._valuesEnd,value);if(this._onUpdateCallback){this._onUpdateCallback(this._object,elapsed)}if(this._duration===0||elapsedTime>=this._duration){if(this._repeat>0){var completeCount=Math.min(Math.trunc((elapsedTime-this._duration)/durationAndDelay)+1,this._repeat);if(isFinite(this._repeat)){this._repeat-=completeCount}for(property in this._valuesStartRepeat){if(!this._yoyo&&typeof this._valuesEnd[property]==="string"){this._valuesStartRepeat[property]=this._valuesStartRepeat[property]+parseFloat(this._valuesEnd[property])}if(this._yoyo){this._swapEndStartRepeatValues(property)}this._valuesStart[property]=this._valuesStartRepeat[property]}if(this._yoyo){this._reversed=!this._reversed}this._startTime+=durationAndDelay*completeCount;if(this._onRepeatCallback){this._onRepeatCallback(this._object)}this._onEveryStartCallbackFired=false;return true}else{if(this._onCompleteCallback){this._onCompleteCallback(this._object)}for(var i=0,numChainedTweens=this._chainedTweens.length;i<numChainedTweens;i++){this._chainedTweens[i].start(this._startTime+this._duration,false)}this._isPlaying=false;return false}}return true};Tween.prototype._updateProperties=function(_object,_valuesStart,_valuesEnd,value){for(var property in _valuesEnd){if(_valuesStart[property]===undefined){continue}var start=_valuesStart[property]||0;var end=_valuesEnd[property];var startIsArray=Array.isArray(_object[property]);var endIsArray=Array.isArray(end);var isInterpolationList=!startIsArray&&endIsArray;if(isInterpolationList){_object[property]=this._interpolationFunction(end,value)}else if(typeof end==="object"&&end){this._updateProperties(_object[property],start,end,value)}else{end=this._handleRelativeValue(start,end);if(typeof end==="number"){_object[property]=start+(end-start)*value}}}};Tween.prototype._handleRelativeValue=function(start,end){if(typeof end!=="string"){return end}if(end.charAt(0)==="+"||end.charAt(0)==="-"){return start+parseFloat(end)}return parseFloat(end)};Tween.prototype._swapEndStartRepeatValues=function(property){var tmp=this._valuesStartRepeat[property];var endValue=this._valuesEnd[property];if(typeof endValue==="string"){this._valuesStartRepeat[property]=this._valuesStartRepeat[property]+parseFloat(endValue)}else{this._valuesStartRepeat[property]=this._valuesEnd[property]}this._valuesEnd[property]=tmp};Tween.autoStartOnUpdate=false;return Tween}();var VERSION="25.0.0";var nextId=Sequence.nextId;var TWEEN=mainGroup;var getAll=TWEEN.getAll.bind(TWEEN);var removeAll=TWEEN.removeAll.bind(TWEEN);var add=TWEEN.add.bind(TWEEN);var remove=TWEEN.remove.bind(TWEEN);var update=TWEEN.update.bind(TWEEN);var exports$1={Easing:Easing,Group:Group,Interpolation:Interpolation,now:now,setNow:setNow,Sequence:Sequence,nextId:nextId,Tween:Tween,VERSION:VERSION,getAll:getAll,removeAll:removeAll,add:add,remove:remove,update:update};exports.Easing=Easing;exports.Group=Group;exports.Interpolation=Interpolation;exports.Sequence=Sequence;exports.Tween=Tween;exports.VERSION=VERSION;exports.add=add;exports.default=exports$1;exports.getAll=getAll;exports.nextId=nextId;exports.now=now;exports.remove=remove;exports.removeAll=removeAll;exports.setNow=setNow;exports.update=update;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Box2.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Vector2}=require("./Vector2");class Box2{constructor(min,max){this.min=min!==undefined?min:new Vector2(Infinity,Infinity);this.max=max!==undefined?max:new Vector2(-Infinity,-Infinity)}set(min,max){this.min.copy(min);this.max.copy(max);return this}makeEmpty(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(target){if(target===undefined){target=new Vector2}if(this.isEmpty()){return target.set(0,0)}target.x=(this.min.x+this.max.x)*.5;target.y=(this.min.y+this.max.y)*.5;return target}getSize(target){if(target===undefined){target=new Vector2}if(this.isEmpty()){return target.set(0,0)}target.x=this.max.x-this.min.x;target.y=this.max.y-this.min.y;return target}expandByPoint(point){if(point.x<this.min.x)this.min.x=point.x;if(point.y<this.min.y)this.min.y=point.y;if(point.x>this.max.x)this.max.x=point.x;if(point.y>this.max.y)this.max.y=point.y;return this}setFromPoints(points){this.makeEmpty();for(let i=0;i<points.length;i++){this.expandByPoint(points[i])}return this}expandByVector(vector){this.min.x-=vector.x;this.min.y-=vector.y;this.max.x+=vector.x;this.max.y+=vector.y;return this}expandByScalar(scalar){this.min.x-=scalar;this.min.y-=scalar;this.max.x+=scalar;this.max.y+=scalar;return this}union(box){if(box.min.x<this.min.x)this.min.x=box.min.x;if(box.min.y<this.min.y)this.min.y=box.min.y;if(box.max.x>this.max.x)this.max.x=box.max.x;if(box.max.y>this.max.y)this.max.y=box.max.y;return this}intersect(box){this.min.x=Math.max(this.min.x,box.min.x);this.min.y=Math.max(this.min.y,box.min.y);this.max.x=Math.min(this.max.x,box.max.x);this.max.y=Math.min(this.max.y,box.max.y);if(this.isEmpty())this.makeEmpty();return this}translate(offset){this.min.x+=offset.x;this.min.y+=offset.y;this.max.x+=offset.x;this.max.y+=offset.y;return this}copy(box){this.min.copy(box.min);this.max.copy(box.max);return this}clone(){return(new Box2).copy(this)}containsPoint(point){return point.x>=this.min.x&&point.x<=this.max.x&&point.y>=this.min.y&&point.y<=this.max.y}containsBox(box){return this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y}intersectsBox(box){return!(box.max.x<this.min.x||box.min.x>this.max.x||box.max.y<this.min.y||box.min.y>this.max.y)}clampPoint(point,target){if(target===undefined){target=new Vector2}target.x=Math.max(this.min.x,Math.min(this.max.x,point.x));target.y=Math.max(this.min.y,Math.min(this.max.y,point.y));return target}distanceToPoint(point){const clampedPoint=new Vector2;this.clampPoint(point,clampedPoint);return clampedPoint.distanceTo(point)}equals(box){return box.min.equals(this.min)&&box.max.equals(this.max)}}exports.Box2=Box2;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Box3.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Vector3}=require("./Vector3");class Box3{constructor(min,max){this.min=min!==undefined?min:new Vector3(Infinity,Infinity,Infinity);this.max=max!==undefined?max:new Vector3(-Infinity,-Infinity,-Infinity)}set(min,max){this.min.copy(min);this.max.copy(max);return this}makeEmpty(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(target){if(target===undefined){target=new Vector3}return this.isEmpty()?target.set(0,0,0):target.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(target){if(target===undefined){target=new Vector3}return this.isEmpty()?target.set(0,0,0):target.subVectors(this.max,this.min)}expandByPoint(point){this.min.min(point);this.max.max(point);return this}setFromPoints(points){this.makeEmpty();for(let i=0;i<points.length;i++){this.expandByPoint(points[i])}return this}setFromBufferAttribute(attribute){this.makeEmpty();const array=attribute.array;const itemSize=attribute.itemSize;const count=attribute.count;for(let i=0;i<count;i++){const offset=i*itemSize;const x=array[offset];const y=array[offset+1];const z=itemSize>=3?array[offset+2]:0;if(x<this.min.x)this.min.x=x;if(y<this.min.y)this.min.y=y;if(z<this.min.z)this.min.z=z;if(x>this.max.x)this.max.x=x;if(y>this.max.y)this.max.y=y;if(z>this.max.z)this.max.z=z}return this}setFromObject(object){this.makeEmpty();return this.expandByObject(object)}expandByObject(object){object.updateWorldMatrix(false,false);const geometry=object.geometry;if(geometry!==undefined){if(geometry.boundingBox===null||geometry.boundingBox===undefined){geometry.computeBoundingBox()}const box=new Box3;box.copy(geometry.boundingBox);box.applyMatrix4(object.matrixWorld);this.union(box)}const children=object.children;if(children){for(let i=0;i<children.length;i++){this.expandByObject(children[i])}}return this}applyMatrix4(matrix){if(this.isEmpty())return this;const points=[new Vector3(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix),new Vector3(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix),new Vector3(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix),new Vector3(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix),new Vector3(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix),new Vector3(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix),new Vector3(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix),new Vector3(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix)];this.setFromPoints(points);return this}union(box){this.min.min(box.min);this.max.max(box.max);return this}copy(box){this.min.copy(box.min);this.max.copy(box.max);return this}clone(){return(new Box3).copy(this)}containsPoint(point){return point.x>=this.min.x&&point.x<=this.max.x&&point.y>=this.min.y&&point.y<=this.max.y&&point.z>=this.min.z&&point.z<=this.max.z}intersectsBox(box){return!(box.max.x<this.min.x||box.min.x>this.max.x||box.max.y<this.min.y||box.min.y>this.max.y||box.max.z<this.min.z||box.min.z>this.max.z)}}exports.Box3=Box3;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BoxGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferGeometry}=require("./BufferGeometry");const{BufferAttribute}=require("./BufferAttribute");class BoxGeometry extends BufferGeometry{constructor(width=1,height=1,depth=1,widthSegments=1,heightSegments=1,depthSegments=1){super();this.width=width;this.height=height;this.depth=depth;const scene=getCurrentScene();if(scene){if(widthSegments>5&&heightSegments>5&&depthSegments>5){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/BoxHighResolution.mesh")}else{this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Box.mesh").clone()}}else{console.warn("BoxGeometry: 无法加载Box.mesh,scene未创建")}let vertexData=this._amgObject.getVertexArray();let uvData=this._amgObject.getUvArray();let vertices=new Float32Array(vertexData.size()*3);let uvs=new Float32Array(uvData.size()*2);for(let i=0;i<vertexData.size();i++){vertices[i*3]=vertexData.get(i).x;vertices[i*3+1]=vertexData.get(i).y;vertices[i*3+2]=vertexData.get(i).z;uvs[i*2]=uvData.get(i).x;uvs[i*2+1]=uvData.get(i).y}this.initAttribute("position",new BufferAttribute(vertices,3));this.initAttribute("uv",new BufferAttribute(uvs,2));this.scale(width,height,depth)}getAttribute(name){if(name=="position"){let data=this._amgObject.getVertexArray();let array=new Float32Array(data.size()*3);for(let i=0;i<data.size();i++){array[i*3]=data.get(i).x;array[i*3+1]=data.get(i).y;array[i*3+2]=data.get(i).z}const bufferAttribute=new BufferAttribute(array,3);bufferAttribute.setNameAndGeometry("position",this);return bufferAttribute}if(name=="uv"){let data=this._amgObject.getUvArray();let array=new Float32Array(data.size()*2);for(let i=0;i<data.size();i++){array[i*2]=data.get(i).x;array[i*2+1]=data.get(i).y}const bufferAttribute=new BufferAttribute(array,2);bufferAttribute.setNameAndGeometry("uv",this);return bufferAttribute}return null}clone(){const clonedGeometry=new BoxGeometry(this.width,this.height,this.depth,this.widthSegments,this.heightSegments,this.depthSegments);clonedGeometry._amgObject=this._amgObject.clone();return clonedGeometry}}exports.BoxGeometry=BoxGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BufferAttribute.js ADDED
@@ -0,0 +1 @@
 
 
1
+ class BufferAttribute{constructor(array,itemSize,normalized=false){this.array=array;this.itemSize=itemSize;this.count=array.length/itemSize;this.normalized=normalized;this._needsUpdate=false;this.length=array.length;this._amgGeometry=null}set needsUpdate(value){this._needsUpdate=value;if(value&&this._amgGeometry&&this._amgGeometry._amgObject){this._updateToAMG()}}get needsUpdate(){return this._needsUpdate}setNameAndGeometry(name,geometry){this._name=name;this._amgGeometry=geometry}forceUpdateToAMG(){this._updateToAMG()}_updateToAMG(){if(!this._amgGeometry||!this._amgGeometry._amgObject){console.warn("BufferAttribute: 无法更新到AMG对象,几何体引用不存在");return}try{const amgObj=this._amgGeometry._amgObject;if(this.itemSize==2&&this._name=="uv"){const uvArray=[];for(let i=0;i<this.array.length;i+=2){uvArray.push(new effect.Amaz.Vector2f(this.array[i],this.array[i+1]))}amgObj.setUvArray(0,uvArray);this._needsUpdate=false;return}else if(this.itemSize==3&&this._name=="position"){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++)buffer.pushBack(this.array[i]);amgObj.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,this.array.length/this.itemSize);this._needsUpdate=false;return}else if(this._name=="colorA"||this._name=="colorR"||this._name=="colorG"||this._name=="colorB"){const colorArrayR=this._amgGeometry.getAttribute("colorR");const colorArrayG=this._amgGeometry.getAttribute("colorG");const colorArrayB=this._amgGeometry.getAttribute("colorB");const colorArrayA=this._amgGeometry.getAttribute("colorA");if(colorArrayR&&colorArrayG&&colorArrayB&&colorArrayA&&colorArrayR._needsUpdate&&colorArrayG._needsUpdate&&colorArrayB._needsUpdate&&colorArrayA._needsUpdate){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++){buffer.pushBack(colorArrayR.array[i]);buffer.pushBack(colorArrayG.array[i]);buffer.pushBack(colorArrayB.array[i]);buffer.pushBack(colorArrayA.array[i])}amgObj.setAttributeData(effect.Amaz.VertexAttribType.COLOR,buffer,0,this.array.length/this.itemSize);colorArrayR._needsUpdate=colorArrayG._needsUpdate=colorArrayB._needsUpdate=colorArrayA._needsUpdate=false}return}else if(this._name=="size"||this._name=="rotation"){const sizeAttribute=this._amgGeometry.getAttribute("size");const rotationAttribute=this._amgGeometry.getAttribute("rotation");if(sizeAttribute&&rotationAttribute&&sizeAttribute._needsUpdate&&rotationAttribute._needsUpdate){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++){buffer.pushBack(sizeAttribute.array[i]);buffer.pushBack(rotationAttribute.array[i]);buffer.pushBack(0);buffer.pushBack(0)}amgObj.setAttributeData(effect.Amaz.VertexAttribType.USER_DEFINE0,buffer,0,this.array.length/this.itemSize);sizeAttribute._needsUpdate=rotationAttribute._needsUpdate=false}return}else if(this._name=="lifetime"||this._name=="startLifetime"||this._name=="startFrame"){const lifetimeAttribute=this._amgGeometry.getAttribute("lifetime");const startLifetimeAttribute=this._amgGeometry.getAttribute("startLifetime");const startFrameAttribute=this._amgGeometry.getAttribute("startFrame");if(lifetimeAttribute&&startLifetimeAttribute&&startFrameAttribute&&lifetimeAttribute._needsUpdate&&startLifetimeAttribute._needsUpdate&&startFrameAttribute._needsUpdate){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++){buffer.pushBack(lifetimeAttribute.array[i]);buffer.pushBack(startLifetimeAttribute.array[i]);buffer.pushBack(startFrameAttribute.array[i])}amgObj.setAttributeData(effect.Amaz.VertexAttribType.USER_DEFINE1,buffer,0,this.array.length/this.itemSize);lifetimeAttribute._needsUpdate=startLifetimeAttribute._needsUpdate=startFrameAttribute._needsUpdate=false}return}else if(this.itemSize==3&&this._name=="targetPosition"){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++)buffer.pushBack(this.array[i]);amgObj.setAttributeData(effect.Amaz.VertexAttribType.POSITION_OFFSET,buffer,0,this.array.length/this.itemSize);this._needsUpdate=false;return}else if(this.itemSize==2&&this._name=="targetUV"){const buffer=new effect.Amaz.FloatVector;for(let i=0;i<this.array.length;i++)buffer.pushBack(this.array[i]);amgObj.setAttributeData(effect.Amaz.VertexAttribType.TEXCOORD1,buffer,0,this.array.length/this.itemSize);this._needsUpdate=false;return}}catch(error){console.error("BufferAttribute: 更新AMG对象时发生错误:",error)}}getX(index){if(index<0||index>=this.count){console.warn(`BufferAttribute.getX: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return 0}return this.array[index*this.itemSize]}getY(index){if(index<0||index>=this.count){console.warn(`BufferAttribute.getY: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return 0}return this.array[index*this.itemSize+1]}getZ(index){if(index<0||index>=this.count){console.warn(`BufferAttribute.getZ: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return 0}return this.array[index*this.itemSize+2]}setX(index,value){if(index<0||index>=this.count){console.warn(`BufferAttribute.setX: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return}this.array[index*this.itemSize]=value;this.needsUpdate=true}setY(index,value){if(index<0||index>=this.count){console.warn(`BufferAttribute.setY: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return}this.array[index*this.itemSize+1]=value;this.needsUpdate=true}setZ(index,value){if(index<0||index>=this.count){console.warn(`BufferAttribute.setZ: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return}this.array[index*this.itemSize+2]=value;this.needsUpdate=true}setXY(index,x,y){if(index<0||index>=this.count){console.warn(`BufferAttribute.setXY: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return}const offset=index*this.itemSize;this.array[offset]=x;this.array[offset+1]=y;this.needsUpdate=true}setXYZ(index,x,y,z){if(index<0||index>=this.count){console.warn(`BufferAttribute.setXYZ: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return}const offset=index*this.itemSize;this.array[offset]=x;this.array[offset+1]=y;this.array[offset+2]=z;this.needsUpdate=true}getXY(index){if(index<0||index>=this.count){console.warn(`BufferAttribute.getXY: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return{x:0,y:0}}const offset=index*this.itemSize;return{x:this.array[offset],y:this.array[offset+1]}}getXYZ(index){if(index<0||index>=this.count){console.warn(`BufferAttribute.getXYZ: 索引 ${index} 超出范围 [0, ${this.count-1}]`);return{x:0,y:0,z:0}}const offset=index*this.itemSize;return{x:this.array[offset],y:this.array[offset+1],z:this.array[offset+2]}}}exports.BufferAttribute=BufferAttribute;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/BufferGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferAttribute}=require("./BufferAttribute");const{Vector3}=require("./Vector3");const{Box3}=require("./Box3");class BufferGeometry{constructor(){this.userData={};this.attributes={};this.index=null;this.translateValue=new Vector3(0,0,0);const scene=getCurrentScene();if(scene){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Quad.mesh").clone()}else{console.warn("PlaneGeometry: 无法加载Quad.mesh,scene未创建")}{var vertexAttribs=this._amgObject.vertexAttribs;var attribDesc0=new effect.Amaz.VertexAttribDesc;attribDesc0.semantic=effect.Amaz.VertexAttribType.POSITION_OFFSET;attribDesc0.bindingIndex=0;attribDesc0.offset=36;attribDesc0.componentCount=3;vertexAttribs.pushBack(attribDesc0);var attribDesc1=new effect.Amaz.VertexAttribDesc;attribDesc1.semantic=effect.Amaz.VertexAttribType.TEXCOORD1;attribDesc1.bindingIndex=0;attribDesc1.offset=48;attribDesc1.componentCount=2;vertexAttribs.pushBack(attribDesc1);this._amgObject.vertexAttribs=vertexAttribs;const submesh=this._amgObject.submeshes.get(0);if(submesh){submesh.primitive=effect.Amaz.Primitive.TRIANGLES}}let vertexData=this._amgObject.getVertexArray();let uvData=this._amgObject.getUvArray();let vertices=new Float32Array(vertexData.size()*3);let uvs=new Float32Array(uvData.size()*2);for(let i=0;i<vertexData.size();i++){vertices[i*3]=vertexData.get(i).x;vertices[i*3+1]=vertexData.get(i).y;vertices[i*3+2]=vertexData.get(i).z;uvs[i*2]=uvData.get(i).x;uvs[i*2+1]=uvData.get(i).y}this.initAttribute("position",new BufferAttribute(vertices,3));this.initAttribute("uv",new BufferAttribute(uvs,2))}copy(source){if(!source)return this;try{this.userData=source.userData?JSON.parse(JSON.stringify(source.userData)):{}}catch(e){this.userData=source.userData?Object.assign({},source.userData):{}}if(source.translateValue&&this.translateValue&&typeof this.translateValue.copy==="function"){this.translateValue.copy(source.translateValue)}if(source._amgObject&&typeof source._amgObject.clone==="function"){this._amgObject=source._amgObject.clone()}this.attributes={};if(source.attributes){for(const name in source.attributes){const srcAttr=source.attributes[name];if(!srcAttr)continue;const srcArray=srcAttr.array;const itemSize=srcAttr.itemSize;const normalized=srcAttr.normalized;let clonedArray=null;if(srcArray&&typeof srcArray.length==="number"){if(srcArray.constructor&&srcArray.constructor.BYTES_PER_ELEMENT){clonedArray=new srcArray.constructor(srcArray)}else{clonedArray=srcArray.slice?srcArray.slice():Array.from(srcArray)}}else{clonedArray=srcArray}const newAttr=new BufferAttribute(clonedArray,itemSize,normalized);this.initAttribute(name,newAttr)}}if(source.index){let newIndex=null;if(Array.isArray(source.index)){newIndex=source.index.slice()}else if(source.index&&source.index.constructor&&source.index.constructor.BYTES_PER_ELEMENT){newIndex=new source.index.constructor(source.index)}if(newIndex)this.setIndex(newIndex);else this.index=source.index}else{this.index=null}if(source.groups){this.groups=Array.isArray(source.groups)?source.groups.map(g=>Object.assign({},g)):source.groups}if(source.boundingBox)this.boundingBox=source.boundingBox;if(source.boundingSphere)this.boundingSphere=source.boundingSphere;if(source.drawRange)this.drawRange=Object.assign({},source.drawRange);return this}initAttribute(name,attribute){this.attributes[name]=attribute;attribute.setNameAndGeometry(name,this);return this}setAttribute(name,attribute){this.attributes[name]=attribute;attribute.setNameAndGeometry(name,this);attribute.forceUpdateToAMG();return this}getAttribute(name){return this.attributes[name]}computeVertexNormals(){}computeBoundingBox(){}setIndex(index){this.index=index;if(this._amgObject&&this._amgObject.submeshes.get(0)){this._amgObject.submeshes.get(0).indices16=index;this._amgObject.submeshes.get(0).indicesCount=index.length}return this}setFromPoints(points){if(!Array.isArray(points)){console.warn("setFromPoints: points must be an array");return this}const positions=[];for(let i=0;i<points.length;i++){const point=points[i];if(point&&typeof point.x==="number"&&typeof point.y==="number"&&typeof point.z==="number"){positions.push(point.x,point.y,point.z)}else{console.warn(`setFromPoints: point at index ${i} is not a valid Vector3`);positions.push(0,0,0)}}const positionAttribute=new BufferAttribute(new Float32Array(positions),3);this.initAttribute("position",positionAttribute);if(this._amgObject&&this._amgObject.submeshes.get(0)){this._amgObject.submeshes.get(0).primitive=effect.Amaz.Primitive.Points;let list=new effect.Amaz.UInt16Vector;for(let i=0;i<points.length;i++)list.pushBack(i);this._amgObject.submeshes.get(0).indices16=list;this._amgObject.submeshes.get(0).indicesCount=points.length}return this}scale(x,y,z){const positionAttribute=this.attributes.position;if(!positionAttribute)return this;const positions=positionAttribute.array;for(let i=0;i<positions.length;i+=3){positions[i]*=x;positions[i+1]*=y;positions[i+2]*=z}if(this._amgObject){const vertexCount=positions.length/3;const buffer=new effect.Amaz.FloatVector;for(let i=0;i<vertexCount;i++){buffer.pushBack(positions[i*3]);buffer.pushBack(positions[i*3+1]);buffer.pushBack(positions[i*3+2])}this._amgObject.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,vertexCount)}return this}computeBoundingBox(){const positionAttribute=this.attributes.position;if(!positionAttribute){this.boundingBox=new Box3(new Vector3(0,0,0),new Vector3(0,0,0));return}const positions=positionAttribute.array;const min=new Vector3(Infinity,Infinity,Infinity);const max=new Vector3(-Infinity,-Infinity,-Infinity);for(let i=0;i<positions.length;i+=3){min.x=Math.min(min.x,positions[i]);min.y=Math.min(min.y,positions[i+1]);min.z=Math.min(min.z,positions[i+2]);max.x=Math.max(max.x,positions[i]);max.y=Math.max(max.y,positions[i+1]);max.z=Math.max(max.z,positions[i+2])}this.boundingBox=new Box3(min,max);return this}dispose(){for(const key in this.attributes){if(this.attributes[key]&&typeof this.attributes[key].dispose==="function"){this.attributes[key].dispose()}}this.attributes={};if(this.index){if(Array.isArray(this.index)){this.index.length=0}this.index=null}if(this._amgObject){if(this._amgObject.submeshes){try{const submeshCount=this._amgObject.submeshes.size();for(let i=0;i<submeshCount;i++){const submesh=this._amgObject.submeshes.get(i);if(submesh){if(submesh.indices16){if(typeof submesh.indices16.clear==="function"){submesh.indices16.clear()}submesh.indices16=null}submesh.indicesCount=0}}if(typeof this._amgObject.submeshes.clear==="function"){this._amgObject.submeshes.clear()}}catch(e){console.warn("BufferGeometry.dispose: 清理 submeshes 失败",e)}}if(this._amgObject.vertexAttribs){try{if(typeof this._amgObject.vertexAttribs.clear==="function"){this._amgObject.vertexAttribs.clear()}this._amgObject.vertexAttribs=null}catch(e){console.warn("BufferGeometry.dispose: 清理 vertexAttribs 失败",e)}}try{if(typeof this._amgObject.destroy==="function"){this._amgObject.destroy()}else if(typeof this._amgObject.release==="function"){this._amgObject.release()}}catch(e){console.warn("BufferGeometry.dispose: 清理 AMG 对象失败",e)}this._amgObject=null}this.translateValue=null;this.boundingBox=null;this.boundingSphere=null}clone(){const clone=new BufferGeometry;clone.copy(this);return clone}translate(x,y,z){this.translateValue.set(x,y,z)}}exports.BufferGeometry=BufferGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CapsuleGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferGeometry}=require("./BufferGeometry");class CapsuleGeometry extends BufferGeometry{constructor(radius=.5,height=1,radiusSegments=16,heightSegments=1){super();const scene=getCurrentScene();if(scene){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Capsule.mesh")}this.radius=radius;this.width=radius/.5;this.height=height;this.depth=radius/.5;this.radiusSegments=radiusSegments;this.heightSegments=heightSegments;this.scale(this.width,this.height,this.depth)}}exports.CapsuleGeometry=CapsuleGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Color.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const Vector3=require("./Vector3").Vector3;class Color{constructor(r=1,g=1,b=1){if(typeof r==="string"){this.setHexString(r)}else if(typeof r==="number"&&arguments.length===1){this.setHex(r)}else{this.r=r>1?r/255:r;this.g=g>1?g/255:g;this.b=b>1?b/255:b}}set(r,g,b){if(typeof r==="number"&&typeof g==="number"&&typeof b==="number"){this.r=r;this.g=g;this.b=b}else if(r instanceof Vector3){this.r=r.x;this.g=r.y;this.b=r.z}else if(r instanceof Color){this.r=r.r;this.g=r.g;this.b=r.b}else if(Array.isArray(r)&&r.length>=3){this.r=r[0];this.g=r[1];this.b=r[2]}else{console.warn("set: Unsupported color format",r,g,b)}return this}setHex(hex){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this}setHexString(hexString){hexString=hexString.replace(/^#/,"");if(hexString.length===3){hexString=hexString.split("").map(char=>char+char).join("")}const hex=parseInt(hexString,16);if(isNaN(hex)){console.warn(`Invalid hex color string: ${hexString}, using white`);this.setRGB(1,1,1);return this}this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this}setRGB(r,g,b){this.r=r;this.g=g;this.b=b;return this}setHSL(h,s,l){let r,g,b;if(s===0){r=g=b=l}else{const hue2rgb=function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p};const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)}this.r=r;this.g=g;this.b=b;return this}toAMGColor(){const color=new Amaz.Vector4f;color.x=this.r;color.y=this.g;color.z=this.b;color.w=1;return color}}exports.Color=Color;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Constants.js ADDED
@@ -0,0 +1 @@
 
 
1
+ exports.FrontSide=0;exports.BackSide=1;exports.DoubleSide=2;exports.NoBlending=0;exports.NormalBlending=1;exports.AdditiveBlending=2;exports.SubtractiveBlending=3;exports.MultiplyBlending=4;exports.CustomBlending=5;exports.RepeatWrapping=1e3;exports.ClampToEdgeWrapping=1001;exports.MirroredRepeatWrapping=1002;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CurvePath.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Vector2}=require("./Vector2");class CurvePath{constructor(){this.type="CurvePath";this.curves=[];this.autoClose=false;this.cacheLengths=null;this.cacheDivisions=null}add(curve){this.curves.push(curve);this.cacheLengths=null}closePath(){if(this.curves.length>0){const firstPoint=this.curves[0].getPoint(0);const lastCurve=this.curves[this.curves.length-1];const lastPoint=lastCurve.getPoint(1);if(!lastPoint.equals(firstPoint)){this.add(new LineCurve(lastPoint,firstPoint))}}this.autoClose=true}getPoints(divisions=12){const points=[];const epsilon=1e-10;for(let i=0;i<this.curves.length;i++){const curve=this.curves[i];const pts=curve.getPoints?curve.getPoints(divisions):[curve.getPoint(0),curve.getPoint(1)];for(let j=0;j<pts.length;j++){const point=pts[j];if(i===0||j>0||points.length===0||!point.equals(points[points.length-1],epsilon)){points.push(point)}}}if(this.autoClose&&points.length>1&&!points[points.length-1].equals(points[0],epsilon)){points.push(points[0].clone())}return points}getLengths(divisions=40){if(this.cacheLengths&&this.cacheDivisions===divisions){return this.cacheLengths}const lengths=[];let sum=0;for(let i=0;i<this.curves.length;i++){const curve=this.curves[i];let last=curve.getPoint(0);for(let j=1;j<=divisions;j++){const current=curve.getPoint(j/divisions);const dx=current.x-last.x;const dy=current.y-last.y;sum+=Math.sqrt(dx*dx+dy*dy);lengths.push(sum);last=current}}this.cacheLengths=lengths;this.cacheDivisions=divisions;return lengths}getLength(){const lengths=this.getLengths();return lengths.length>0?lengths[lengths.length-1]:0}getPointAt(u){const t=this.getUtoTmapping(u);return this.getPoint(t)}getUtoTmapping(u){const divisions=this.cacheDivisions||40;const lengths=this.getLengths(divisions);if(u===0)return 0;if(u===1)return 1;if(lengths.length===0)return 0;const targetLength=u*lengths[lengths.length-1];let low=0;let high=lengths.length-1;let comparison;while(low<=high){const i=Math.floor(low+(high-low)/2);comparison=lengths[i]-targetLength;if(comparison<0){low=i+1}else if(comparison>0){high=i-1}else{high=i;break}}let i=high;if(i<0)i=0;if(i>=lengths.length)i=lengths.length-1;const lengthBefore=i>0?lengths[i-1]:0;const lengthAfter=lengths[i];const segmentLength=lengthAfter-lengthBefore;const segmentFraction=segmentLength===0?0:(targetLength-lengthBefore)/segmentLength;const t=(i+segmentFraction)/(this.curves.length*divisions);return t}getPoint(t){const divisions=this.cacheDivisions||40;const d=t*this.curves.length*divisions;const segmentIndex=Math.floor(d);const segmentT=d-segmentIndex;const curveIndex=Math.floor(segmentIndex/divisions);const divisionIndex=segmentIndex%divisions;const curveT=(divisionIndex+segmentT)/divisions;if(curveIndex<0||this.curves.length===0){return this.curves.length>0?this.curves[0].getPoint(0):new Vector2}if(curveIndex>=this.curves.length){return this.curves[this.curves.length-1].getPoint(1)}return this.curves[curveIndex].getPoint(curveT)}getSpacedPoints(divisions=5){const points=[];if(this.curves.length===0){return points}for(let i=0;i<=divisions;i++){points.push(this.getPointAt(i/divisions))}return points}getTangent(t){const delta=1e-4;let t1=t-delta;let t2=t+delta;if(t1<0)t1=0;if(t2>1)t2=1;const pt1=this.getPoint(t1);const pt2=this.getPoint(t2);const tangent=(new Vector2).subVectors(pt2,pt1);return tangent.normalize()}getTangentAt(u){const t=this.getUtoTmapping(u);return this.getTangent(t)}getBounds(){const points=this.getPoints();let minX=Infinity,minY=Infinity;let maxX=-Infinity,maxY=-Infinity;for(let i=0;i<points.length;i++){const p=points[i];if(p.x<minX)minX=p.x;if(p.x>maxX)maxX=p.x;if(p.y<minY)minY=p.y;if(p.y>maxY)maxY=p.y}return{minX:minX,minY:minY,maxX:maxX,maxY:maxY}}}class LineCurve{constructor(v1,v2){this.type="LineCurve";this.v1=v1;this.v2=v2}getPoint(t){if(t===1){return this.v2.clone()}else{const x=this.v1.x+t*(this.v2.x-this.v1.x);const y=this.v1.y+t*(this.v2.y-this.v1.y);return new Vector2(x,y)}}getPoints(divisions=1){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}getTangent(t){const tangent=(new Vector2).subVectors(this.v2,this.v1);return tangent.normalize()}getLength(){return this.v1.distanceTo(this.v2)}translate(x,y){this.v1.x+=x;this.v1.y+=y;this.v2.x+=x;this.v2.y+=y;return this}scale(x,y){this.v1.x*=x;this.v1.y*=y;this.v2.x*=x;this.v2.y*=y;return this}rotate(cos,sin){let x=this.v1.x,y=this.v1.y;this.v1.x=x*cos-y*sin;this.v1.y=x*sin+y*cos;x=this.v2.x;y=this.v2.y;this.v2.x=x*cos-y*sin;this.v2.y=x*sin+y*cos;return this}clone(){return new LineCurve(this.v1.clone(),this.v2.clone())}copy(source){this.v1.copy(source.v1);this.v2.copy(source.v2);return this}}exports.CurvePath=CurvePath;exports.LineCurve=LineCurve;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/CylinderGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferGeometry}=require("./BufferGeometry");class CylinderGeometry extends BufferGeometry{constructor(radiusTop=.5,radiusBottom=.5,height=1,radiusSegments=16,heightSegments=1){super();const scene=getCurrentScene();if(scene){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Cylinder.mesh")}this.radiusTop=radiusTop;this.radiusBottom=radiusBottom;this.width=radiusTop/.5;this.height=height;this.depth=radiusTop/.5;this.radiusSegments=radiusSegments;this.heightSegments=heightSegments;this.scale(this.width,this.height,this.depth)}}exports.CylinderGeometry=CylinderGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Earcut.js ADDED
@@ -0,0 +1 @@
 
 
1
+ function earcut(data,holeIndices,dim){dim=dim||2;const hasHoles=holeIndices&&holeIndices.length;const outerLen=hasHoles?holeIndices[0]*dim:data.length;let outerNode=linkedList(data,0,outerLen,dim,true);const triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;if(hasHoles)outerNode=eliminateHoles(data,holeIndices,outerNode,dim);let minX,minY,maxX,maxY,x,y,invSize;if(data.length>80*dim){minX=maxX=data[0];minY=maxY=data[1];for(let i=dim;i<outerLen;i+=dim){x=data[i];y=data[i+1];if(x<minX)minX=x;if(y<minY)minY=y;if(x>maxX)maxX=x;if(y>maxY)maxY=y}invSize=Math.max(maxX-minX,maxY-minY);invSize=invSize!==0?1/invSize:0}earcutLinked(outerNode,triangles,dim,minX,minY,invSize);return triangles}function linkedList(data,start,end,dim,clockwise){let i,last;if(clockwise===signedArea(data,start,end,dim)>0){for(i=start;i<end;i+=dim)last=insertNode(i/dim,data[i],data[i+1],last)}else{for(i=end-dim;i>=start;i-=dim)last=insertNode(i/dim,data[i],data[i+1],last)}if(last&&equals(last,last.next)){removeNode(last);last=last.next}return last}function eliminateHoles(data,holeIndices,outerNode,dim){const queue=[];let i,len,start,end,list;for(i=0,len=holeIndices.length;i<len;i++){start=holeIndices[i]*dim;end=i<len-1?holeIndices[i+1]*dim:data.length;list=linkedList(data,start,end,dim,false);if(list===list.next)list.steiner=true;queue.push(getLeftmost(list))}queue.sort(compareX);for(i=0;i<queue.length;i++){eliminateHole(queue[i],outerNode);outerNode=filterPoints(outerNode,outerNode.next)}return outerNode}function compareX(a,b){return a.x-b.x}function eliminateHole(hole,outerNode){outerNode=findHoleBridge(hole,outerNode);if(outerNode){const b=splitPolygon(outerNode,hole);filterPoints(filterPoints(b,b.next),b.next)}}function findHoleBridge(hole,outerNode){let p=outerNode;const hx=hole.x;const hy=hole.y;let qx=-Infinity,m;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){const x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){qx=x;if(x===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m;const stop=m;const mx=m.x;const my=m.y;let tanMin=Infinity,tan;p=m;do{if(hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)){tan=Math.abs(hy-p.y)/(hx-p.x);if(locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&&sectorContainsSector(m,p)))){m=p;tanMin=tan}}p=p.next}while(p!==stop);return m}function sectorContainsSector(m,p){return area(m.prev,m,p.prev)<0&&area(p.next,m,m.next)<0}function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(!ear)return;if(!pass&&invSize)indexCurve(ear,minX,minY,invSize);let stop=ear,prev,next;while(ear.prev!==ear.next){prev=ear.prev;next=ear.next;if(invSize?isEarHashed(ear,minX,minY,invSize):isEar(ear)){triangles.push(prev.i,ear.i,next.i);removeNode(ear);ear=next.next;stop=next.next;continue}ear=next;if(ear===stop){if(!pass){earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1)}else if(pass===1){ear=cureLocalIntersections(filterPoints(ear),triangles,dim);earcutLinked(ear,triangles,dim,minX,minY,invSize,2)}else if(pass===2){splitEarcut(ear,triangles,dim,minX,minY,invSize)}break}}}function isEar(ear){const a=ear.prev;const b=ear;const c=ear.next;if(area(a,b,c)>=0)return false;let p=ear.next.next;while(p!==ear.prev){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0){return false}p=p.next}return true}function isEarHashed(ear,minX,minY,invSize){const a=ear.prev;const b=ear;const c=ear.next;if(area(a,b,c)>=0)return false;const minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x;const minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y;const maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x;const maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y;const minZ=zOrder(minTX,minTY,minX,minY,invSize);const maxZ=zOrder(maxTX,maxTY,minX,minY,invSize);let p=ear.prevZ;let n=ear.nextZ;while(p&&p.z>=minZ&&n&&n.z<=maxZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ;if(n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return false;n=n.nextZ}while(p&&p.z>=minZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ}while(n&&n.z<=maxZ){if(n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return false;n=n.nextZ}return true}function cureLocalIntersections(start,triangles,dim){let p=start;do{const a=p.prev;const b=p.next.next;if(!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)){triangles.push(a.i,p.i,b.i);removeNode(p);removeNode(p.next);p=start=b}p=p.next}while(p!==start);return filterPoints(p)}function splitEarcut(start,triangles,dim,minX,minY,invSize){let a=start;do{let b=a.next.next;while(b!==a.prev){if(a.i!==b.i&&isValidDiagonal(a,b)){let c=splitPolygon(a,b);a=filterPoints(a,a.next);c=filterPoints(c,c.next);earcutLinked(a,triangles,dim,minX,minY,invSize);earcutLinked(c,triangles,dim,minX,minY,invSize);return}b=b.next}a=a.next}while(a!==start)}function indexCurve(start,minX,minY,invSize){let p=start;do{if(p.z===null)p.z=zOrder(p.x,p.y,minX,minY,invSize);p.prevZ=p.prev;p.nextZ=p.next;p=p.next}while(p!==start);p.prevZ.nextZ=null;p.prevZ=null;sortLinked(p)}function sortLinked(list){let i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{p=list;list=null;tail=null;numMerges=0;while(p){numMerges++;q=p;pSize=0;for(i=0;i<inSize;i++){pSize++;q=q.nextZ;if(!q)break}qSize=inSize;while(pSize>0||qSize>0&&q){if(pSize!==0&&(qSize===0||!q||p.z<=q.z)){e=p;p=p.nextZ;pSize--}else{e=q;q=q.nextZ;qSize--}if(tail)tail.nextZ=e;else list=e;e.prevZ=tail;tail=e}p=q}tail.nextZ=null;inSize*=2}while(numMerges>1);return list}function zOrder(x,y,minX,minY,invSize){x=32767*(x-minX)*invSize;y=32767*(y-minY)*invSize;x=(x|x<<8)&16711935;x=(x|x<<4)&252645135;x=(x|x<<2)&858993459;x=(x|x<<1)&1431655765;y=(y|y<<8)&16711935;y=(y|y<<4)&252645135;y=(y|y<<2)&858993459;y=(y|y<<1)&1431655765;return x|y<<1}function getLeftmost(start){let p=start;let leftmost=start;do{if(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)leftmost=p;p=p.next}while(p!==start);return leftmost}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)-(ax-px)*(cy-py)>=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0}function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon(a,b)&&(locallyInside(a,b)&&locallyInside(b,a)&&middleInside(a,b)&&(area(a.prev,a,b.prev)||area(a,b.prev,b))||equals(a,b)&&area(a.prev,a,a.next)>0&&area(b.prev,b,b.next)>0)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){const o1=sign(area(p1,q1,p2));const o2=sign(area(p1,q1,q2));const o3=sign(area(p2,q2,p1));const o4=sign(area(p2,q2,q1));if(o1!==o2&&o3!==o4)return true;if(o1===0&&onSegment(p1,p2,q1))return true;if(o2===0&&onSegment(p1,q2,q1))return true;if(o3===0&&onSegment(p2,p1,q2))return true;if(o4===0&&onSegment(p2,q1,q2))return true;return false}function onSegment(p,q,r){return q.x<=Math.max(p.x,r.x)&&q.x>=Math.min(p.x,r.x)&&q.y<=Math.max(p.y,r.y)&&q.y>=Math.min(p.y,r.y)}function sign(num){return num>0?1:num<0?-1:0}function intersectsPolygon(a,b){let p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return true;p=p.next}while(p!==a);return false}function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0}function middleInside(p,q){let a=p;let inside=false;const px=(p.x+q.x)/2;const py=(p.y+q.y)/2;do{const sx=a.x;const sy=a.y;const ex=a.next.x;const ey=a.next.y;if(sy>py!==ey>py&&px<(ex-sx)*(py-sy)/(ey-sy)+sx)inside=!inside;a=a.next}while(a!==p);return inside}function splitPolygon(a,b){const a2=new Node(a.i,a.x,a.y);const b2=new Node(b.i,b.x,b.y);const an=a.next;const bp=b.prev;a.next=b;b.prev=a;a2.next=an;an.prev=a2;b2.next=a2;a2.prev=b2;bp.next=b2;b2.prev=bp;return b2}function insertNode(i,x,y,last){const p=new Node(i,x,y);if(!last){p.prev=p;p.next=p}else{p.next=last.next;p.prev=last;last.next.prev=p;last.next=p}return p}function removeNode(p){p.next.prev=p.prev;p.prev.next=p.next;if(p.prevZ)p.prevZ.nextZ=p.nextZ;if(p.nextZ)p.nextZ.prevZ=p.prevZ}function Node(i,x,y){this.i=i;this.x=x;this.y=y;this.prev=null;this.next=null;this.z=null;this.prevZ=null;this.nextZ=null;this.steiner=false}function signedArea(data,start,end,dim){let sum=0;for(let i=start,j=end-dim;i<end;i+=dim){sum+=(data[j]-data[i])*(data[i+1]+data[j+1]);j=i}return sum}function filterPoints(start,end){if(!start)return start;if(!end)end=start;let p=start,again;do{again=false;if(!p.steiner&&(equals(p,p.next)||area(p.prev,p,p.next)===0)){removeNode(p);p=end=p.prev;if(p===p.next)break;again=true}else{p=p.next}}while(again||p!==end);return end}exports.earcut=earcut;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Euler.js ADDED
@@ -0,0 +1 @@
 
 
1
+ class Euler{constructor(x=0,y=0,z=0,order="XYZ"){this.x=x;this.y=y;this.z=z;this.order=order}set(x,y,z,order){this.x=x;this.y=y;this.z=z;this.order=order||this.order;return this}setFromUnitVectors(vFrom,vTo){const from=vFrom.clone().normalize();const to=vTo.clone().normalize();const pitch=Math.asin(to.y);const yaw=Math.atan2(to.x,to.z);const roll=0;this.x=pitch;this.y=-yaw;this.z=roll;return this}setFromQuaternion(q,order){this.x=q.x;this.y=q.y;this.z=q.z;this.order=order||this.order;return this}clone(){return new Euler(this.x,this.y,this.z,this.order)}}exports.Euler=Euler;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ExtrudeGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{BufferGeometry}=require("./BufferGeometry");const{BufferAttribute}=require("./BufferAttribute");const{earcut}=require("./Earcut");const{Vector2}=require("./Vector2");const{Vector3}=require("./Vector3");const{Box3}=require("./Box3");class ExtrudeGeometry extends BufferGeometry{constructor(shapes,options={}){super();this.type="ExtrudeGeometry";const shapesArray=Array.isArray(shapes)?shapes:[shapes];this.parameters={shapes:shapes,options:options};const depth=options.depth!==undefined?options.depth:1;const steps=options.steps!==undefined?options.steps:1;const bevelEnabled=options.bevelEnabled!==undefined?options.bevelEnabled:true;const bevelThickness=options.bevelThickness!==undefined?options.bevelThickness:.2;const bevelSize=options.bevelSize!==undefined?options.bevelSize:bevelThickness-.1;const bevelOffset=options.bevelOffset!==undefined?options.bevelOffset:0;const bevelSegments=options.bevelSegments!==undefined?options.bevelSegments:3;const curveSegments=options.curveSegments!==undefined?options.curveSegments:12;const extrudePath=options.extrudePath;const UVGenerator=options.UVGenerator;this.depth=depth;this.steps=steps;this.bevelEnabled=bevelEnabled;this.bevelThickness=bevelThickness;this.bevelSize=bevelSize;this.bevelOffset=bevelOffset;this.bevelSegments=bevelSegments;this.curveSegments=curveSegments;const vertices=[];const indices=[];const uvs=[];const groups=[];for(let s=0;s<shapesArray.length;s++){const shape=shapesArray[s];const{shape:shapePoints,holes:holePoints}=shape.extractPoints(curveSegments);if(!shapePoints||shapePoints.length<3){console.warn("ExtrudeGeometry: 形状点数量不足");continue}this.addShape(shape,shapePoints,holePoints,vertices,indices,uvs,groups,s)}if(vertices.length>0){this.setAttribute("position",new BufferAttribute(new Float32Array(vertices),3));this.setAttribute("uv",new BufferAttribute(new Float32Array(uvs),2));if(indices.length>0){this.setIndex(indices)}this.updateAMGObject(vertices,indices,uvs)}this.groups=groups}addShape(shape,shapePoints,holePoints,vertices,indices,uvs,groups,materialIndex){const vertexOffset=vertices.length/3;const groupStart=indices.length;const triangulationData=this.prepareTriangulationData(shapePoints,holePoints);if(!triangulationData)return;const{flatVertices,holeIndices,vertexCount}=triangulationData;const triangleIndices=earcut(flatVertices,holeIndices,2);if(!triangleIndices||triangleIndices.length===0){console.warn("ExtrudeGeometry: 三角化失败");return}const bounds=this.calculateBounds(flatVertices);const contour=shapePoints;const holes=holePoints||[];if(this.bevelEnabled){this.buildWithBevel(contour,holes,flatVertices,triangleIndices,bounds,vertices,indices,uvs,vertexOffset)}else{this.buildWithoutBevel(contour,holes,flatVertices,triangleIndices,bounds,vertices,indices,uvs,vertexOffset)}const groupCount=indices.length-groupStart;if(groupCount>0){groups.push({start:groupStart,count:groupCount,materialIndex:materialIndex})}}buildWithoutBevel(contour,holes,flatVertices,triangleIndices,bounds,vertices,indices,uvs,vertexOffset){const depth=this.depth;const steps=this.steps;const allContours=[contour].concat(holes);let currentVertexOffset=vertexOffset;for(let i=0;i<flatVertices.length/2;i++){const x=flatVertices[i*2];const y=flatVertices[i*2+1];vertices.push(x,y,0);const u=(x-bounds.minX)/(bounds.maxX-bounds.minX);const v=(y-bounds.minY)/(bounds.maxY-bounds.minY);uvs.push(u,v)}for(let i=0;i<triangleIndices.length;i+=3){indices.push(currentVertexOffset+triangleIndices[i],currentVertexOffset+triangleIndices[i+1],currentVertexOffset+triangleIndices[i+2])}currentVertexOffset+=flatVertices.length/2;for(let i=0;i<flatVertices.length/2;i++){const x=flatVertices[i*2];const y=flatVertices[i*2+1];vertices.push(x,y,depth);const u=(x-bounds.minX)/(bounds.maxX-bounds.minX);const v=(y-bounds.minY)/(bounds.maxY-bounds.minY);uvs.push(u,v)}const backFaceOffset=currentVertexOffset;for(let i=0;i<triangleIndices.length;i+=3){indices.push(backFaceOffset+triangleIndices[i+2],backFaceOffset+triangleIndices[i+1],backFaceOffset+triangleIndices[i])}currentVertexOffset+=flatVertices.length/2;for(let c=0;c<allContours.length;c++){const pts=allContours[c];this.buildSideFaces(pts,depth,steps,vertices,indices,uvs,currentVertexOffset);currentVertexOffset+=pts.length*(steps+1)}}buildWithBevel(contour,holes,flatVertices,triangleIndices,bounds,vertices,indices,uvs,vertexOffset){const depth=this.depth;const steps=this.steps;const bevelThickness=this.bevelThickness;const bevelSize=this.bevelSize;const bevelSegments=this.bevelSegments;const allContours=[contour].concat(holes);let currentVertexOffset=vertexOffset;const shapeWidth=bounds.maxX-bounds.minX;const shapeHeight=bounds.maxY-bounds.minY;const shapeSize=Math.max(shapeWidth,shapeHeight);const normalizedBevelSize=bevelSize/shapeSize;const verticesPerLayer=flatVertices.length/2;const contourVertCount=contour.length;const frontBevelStartOffset=currentVertexOffset;for(let b=0;b<=bevelSegments;b++){const t=b/bevelSegments;const z=-bevelThickness*(1-t);const smoothT=this.smoothBevelCurve(t);const scale=1+normalizedBevelSize*smoothT;this.buildBevelLayer(flatVertices,bounds,z,scale,vertices,uvs)}for(let i=0;i<triangleIndices.length;i+=3){indices.push(frontBevelStartOffset+triangleIndices[i],frontBevelStartOffset+triangleIndices[i+1],frontBevelStartOffset+triangleIndices[i+2])}currentVertexOffset+=(bevelSegments+1)*verticesPerLayer;const mainBodyStartOffset=currentVertexOffset;const centerX=(bounds.minX+bounds.maxX)/2;const centerY=(bounds.minY+bounds.maxY)/2;const mainBodyScale=1+normalizedBevelSize;for(let step=0;step<=steps;step++){const t=step/steps;const z=t*depth;for(let i=0;i<verticesPerLayer;i++){const x=flatVertices[i*2];const y=flatVertices[i*2+1];const scaledX=centerX+(x-centerX)*mainBodyScale;const scaledY=centerY+(y-centerY)*mainBodyScale;vertices.push(scaledX,scaledY,z);const u=(x-bounds.minX)/shapeWidth;const v=(y-bounds.minY)/shapeHeight;uvs.push(u,v)}}currentVertexOffset+=(steps+1)*verticesPerLayer;const backBevelStartOffset=currentVertexOffset;for(let b=0;b<=bevelSegments;b++){const t=b/bevelSegments;const z=depth+bevelThickness*t;const smoothT=this.smoothBevelCurve(t);const scale=1+normalizedBevelSize*(1-smoothT);this.buildBevelLayer(flatVertices,bounds,z,scale,vertices,uvs)}for(let i=0;i<triangleIndices.length;i+=3){const layerOffset=backBevelStartOffset+bevelSegments*verticesPerLayer;indices.push(layerOffset+triangleIndices[i+2],layerOffset+triangleIndices[i+1],layerOffset+triangleIndices[i])}currentVertexOffset+=(bevelSegments+1)*verticesPerLayer;const allLayerInfo=[];for(let b=0;b<=bevelSegments;b++){const t=b/bevelSegments;const z=-bevelThickness*(1-t);allLayerInfo.push({z:z,type:"frontBevel",index:b})}for(let step=0;step<=steps;step++){const t=step/steps;const z=t*depth;allLayerInfo.push({z:z,type:"main",index:step})}for(let b=0;b<=bevelSegments;b++){const t=b/bevelSegments;const z=depth+bevelThickness*t;allLayerInfo.push({z:z,type:"backBevel",index:b})}const totalDepth=depth+2*bevelThickness;this.buildBevelSideFaces(contour,allLayerInfo,totalDepth,vertices,indices,uvs,currentVertexOffset);currentVertexOffset+=contour.length*allLayerInfo.length}smoothBevelCurve(t){return t*t*(3-2*t)}buildBevelSideFaces(contour,layerInfo,totalDepth,vertices,indices,uvs,startVertexOffset){const contourLength=this.calculateContourLength(contour);let minX=Infinity,maxX=-Infinity;let minY=Infinity,maxY=-Infinity;for(let i=0;i<contour.length;i++){if(contour[i].x<minX)minX=contour[i].x;if(contour[i].x>maxX)maxX=contour[i].x;if(contour[i].y<minY)minY=contour[i].y;if(contour[i].y>maxY)maxY=contour[i].y}const centerX=(minX+maxX)/2;const centerY=(minY+maxY)/2;const shapeWidth=maxX-minX;const shapeHeight=maxY-minY;const shapeSize=Math.max(shapeWidth,shapeHeight);const normalizedBevelSize=this.bevelSize/shapeSize;for(let layerIdx=0;layerIdx<layerInfo.length;layerIdx++){const layer=layerInfo[layerIdx];const z=layer.z;const vCoord=(z+this.bevelThickness)/totalDepth;let scale=1+normalizedBevelSize;if(layer.type==="frontBevel"){const t=layer.index/this.bevelSegments;const smoothT=this.smoothBevelCurve(t);scale=1+normalizedBevelSize*smoothT}else if(layer.type==="backBevel"){const t=layer.index/this.bevelSegments;const smoothT=this.smoothBevelCurve(t);scale=1+normalizedBevelSize*(1-smoothT)}let accumulatedLength=0;for(let i=0;i<contour.length;i++){const pt=contour[i];const scaledX=centerX+(pt.x-centerX)*scale;const scaledY=centerY+(pt.y-centerY)*scale;vertices.push(scaledX,scaledY,z);const uCoord=accumulatedLength/contourLength;uvs.push(uCoord,vCoord);if(i<contour.length-1){const nextPt=contour[i+1];const dx=nextPt.x-pt.x;const dy=nextPt.y-pt.y;accumulatedLength+=Math.sqrt(dx*dx+dy*dy)}}}const contourVertCount=contour.length;for(let layerIdx=0;layerIdx<layerInfo.length-1;layerIdx++){for(let i=0;i<contourVertCount;i++){const current=startVertexOffset+layerIdx*contourVertCount+i;const next=startVertexOffset+layerIdx*contourVertCount+(i+1)%contourVertCount;const currentNext=startVertexOffset+(layerIdx+1)*contourVertCount+i;const nextNext=startVertexOffset+(layerIdx+1)*contourVertCount+(i+1)%contourVertCount;indices.push(current,next,currentNext);indices.push(next,nextNext,currentNext)}}}buildLayerSideFaces(contourVertCount,layer1Offset,layer2Offset,indices){for(let i=0;i<contourVertCount;i++){const i1=i;const i2=(i+1)%contourVertCount;const v1=layer1Offset+i1;const v2=layer1Offset+i2;const v3=layer2Offset+i1;const v4=layer2Offset+i2;indices.push(v1,v2,v3);indices.push(v2,v4,v3)}}buildBevelLayer(flatVertices,bounds,z,scale,vertices,uvs){const centerX=(bounds.minX+bounds.maxX)/2;const centerY=(bounds.minY+bounds.maxY)/2;const shapeWidth=bounds.maxX-bounds.minX;const shapeHeight=bounds.maxY-bounds.minY;for(let i=0;i<flatVertices.length/2;i++){const x=flatVertices[i*2];const y=flatVertices[i*2+1];const scaledX=centerX+(x-centerX)*scale;const scaledY=centerY+(y-centerY)*scale;vertices.push(scaledX,scaledY,z);const u=(x-bounds.minX)/shapeWidth;const v=(y-bounds.minY)/shapeHeight;uvs.push(u,v)}}buildSideFaces(contour,depth,steps,vertices,indices,uvs,startVertexOffset){const contourLength=this.calculateContourLength(contour);let accumulatedLength=0;for(let step=0;step<=steps;step++){const z=step/steps*depth;accumulatedLength=0;for(let i=0;i<contour.length;i++){const pt=contour[i];vertices.push(pt.x,pt.y,z);const u=accumulatedLength/contourLength;const v=step/steps;uvs.push(u,v);if(i<contour.length-1){const nextPt=contour[i+1];const dx=nextPt.x-pt.x;const dy=nextPt.y-pt.y;accumulatedLength+=Math.sqrt(dx*dx+dy*dy)}}}for(let step=0;step<steps;step++){for(let i=0;i<contour.length;i++){const current=startVertexOffset+step*contour.length+i;const next=startVertexOffset+step*contour.length+(i+1)%contour.length;const currentNext=startVertexOffset+(step+1)*contour.length+i;const nextNext=startVertexOffset+(step+1)*contour.length+(i+1)%contour.length;indices.push(current,next,currentNext);indices.push(next,nextNext,currentNext)}}}calculateContourLength(contour){let length=0;for(let i=0;i<contour.length-1;i++){const dx=contour[i+1].x-contour[i].x;const dy=contour[i+1].y-contour[i].y;length+=Math.sqrt(dx*dx+dy*dy)}const dx=contour[0].x-contour[contour.length-1].x;const dy=contour[0].y-contour[contour.length-1].y;length+=Math.sqrt(dx*dx+dy*dy);return length}calculateContourNormals(contour){const normals=[];const n=contour.length;for(let i=0;i<n;i++){const prev=contour[(i-1+n)%n];const curr=contour[i];const next=contour[(i+1)%n];const dx1=curr.x-prev.x;const dy1=curr.y-prev.y;const dx2=next.x-curr.x;const dy2=next.y-curr.y;const len1=Math.sqrt(dx1*dx1+dy1*dy1);const len2=Math.sqrt(dx2*dx2+dy2*dy2);const nx1=len1>0?-dy1/len1:0;const ny1=len1>0?dx1/len1:0;const nx2=len2>0?-dy2/len2:0;const ny2=len2>0?dx2/len2:0;const nx=(nx1+nx2)/2;const ny=(ny1+ny2)/2;const nlen=Math.sqrt(nx*nx+ny*ny);normals.push({x:nlen>0?nx/nlen:0,y:nlen>0?ny/nlen:0})}return normals}prepareTriangulationData(shapePoints,holePoints){if(!shapePoints||shapePoints.length<3){return null}const flatVertices=[];const holeIndices=[];for(let i=0;i<shapePoints.length;i++){flatVertices.push(shapePoints[i].x,shapePoints[i].y)}let vertexCount=shapePoints.length;if(holePoints&&holePoints.length>0){for(let i=0;i<holePoints.length;i++){const hole=holePoints[i];if(hole&&hole.length>0){holeIndices.push(vertexCount);for(let j=0;j<hole.length;j++){flatVertices.push(hole[j].x,hole[j].y);vertexCount++}}}}return{flatVertices:flatVertices,holeIndices:holeIndices.length>0?holeIndices:null,vertexCount:vertexCount}}calculateBounds(vertices){let minX=Infinity,minY=Infinity;let maxX=-Infinity,maxY=-Infinity;for(let i=0;i<vertices.length;i+=2){const x=vertices[i];const y=vertices[i+1];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y}if(maxX===minX)maxX=minX+1;if(maxY===minY)maxY=minY+1;return{minX:minX,minY:minY,maxX:maxX,maxY:maxY}}updateAMGObject(vertices,indices,uvs){if(!this._amgObject||!this._amgObject.submeshes)return;try{const submesh=this._amgObject.submeshes.get(0);if(!submesh)return;submesh.primitive=effect.Amaz.Primitive.TRIANGLES;const vertexCount=vertices.length/3;const buffer=new effect.Amaz.FloatVector;for(let i=0;i<vertexCount;i++){buffer.pushBack(vertices[i*3]);buffer.pushBack(vertices[i*3+1]);buffer.pushBack(vertices[i*3+2])}this._amgObject.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,vertexCount);const uvArray=new effect.Amaz.Vec2Vector;for(let i=0;i<vertexCount;i++){const uv=new effect.Amaz.Vector2f(uvs[i*2],uvs[i*2+1]);uvArray.pushBack(uv)}this._amgObject.setUvArray(0,uvArray);if(indices.length>0){const indexArray=new effect.Amaz.UInt16Vector;for(let i=0;i<indices.length;i++){indexArray.pushBack(indices[i])}submesh.indices16=indexArray;submesh.indicesCount=indices.length}}catch(e){console.warn("ExtrudeGeometry: 更新 AMG 对象失败",e)}}center(){const positionAttribute=this.attributes.position;if(!positionAttribute)return this;const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}const centerX=(minX+maxX)/2;const centerY=(minY+maxY)/2;const centerZ=(minZ+maxZ)/2;for(let i=0;i<positions.length;i+=3){positions[i]-=centerX;positions[i+1]-=centerY;positions[i+2]-=centerZ}if(this._amgObject){const vertexCount=positions.length/3;const buffer=new effect.Amaz.FloatVector;for(let i=0;i<vertexCount;i++){buffer.pushBack(positions[i*3]);buffer.pushBack(positions[i*3+1]);buffer.pushBack(positions[i*3+2])}this._amgObject.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,vertexCount)}return this}computeBoundingBox(){const positionAttribute=this.attributes.position;if(!positionAttribute){this.boundingBox=new Box3(new Vector3(0,0,0),new Vector3(0,0,0));return}const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}this.boundingBox=new Box3(new Vector3(minX,minY,minZ),new Vector3(maxX,maxY,maxZ))}computeBoundingSphere(){const positionAttribute=this.attributes.position;if(!positionAttribute){this.boundingSphere={center:new Vector3(0,0,0),radius:0};return}const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}const centerX=(minX+maxX)/2;const centerY=(minY+maxY)/2;const centerZ=(minZ+maxZ)/2;let maxRadiusSq=0;for(let i=0;i<positions.length;i+=3){const dx=positions[i]-centerX;const dy=positions[i+1]-centerY;const dz=positions[i+2]-centerZ;const distSq=dx*dx+dy*dy+dz*dz;if(distSq>maxRadiusSq)maxRadiusSq=distSq}this.boundingSphere={center:new Vector3(centerX,centerY,centerZ),radius:Math.sqrt(maxRadiusSq)}}dispose(){if(this.groups){this.groups.length=0;this.groups=null}this.parameters=null;this.depth=null;this.steps=null;this.bevelEnabled=null;this.bevelThickness=null;this.bevelSize=null;this.bevelOffset=null;this.bevelSegments=null;this.curveSegments=null;super.dispose()}}exports.ExtrudeGeometry=ExtrudeGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Group.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Object3D}=require("./Object3D");class Group extends Object3D{constructor(name="Group_w"){super(name)}dispose(){super.dispose()}}exports.Group=Group;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Material.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const __THREE_CONSTS=require("./Constants");class Material{constructor(){this.transparent=false;this._opacity=1;this.side=__THREE_CONSTS.FrontSide;this.visible=true;this.userData={};Object.defineProperty(this,"opacity",{get:()=>this._opacity,set:value=>{this._opacity=value;this._syncOpacityToAMG()},enumerable:true,configurable:true});this._blending=__THREE_CONSTS.NormalBlending;Object.defineProperty(this,"blending",{get:()=>this._blending,set:value=>{this._blending=value;this._syncBlendingToAMG()},enumerable:true,configurable:true});this._depthTest=true;this._depthWrite=true;Object.defineProperty(this,"depthTest",{get:()=>this._depthTest,set:value=>{this._depthTest=value;this._syncDepthToAMG()},enumerable:true,configurable:true});Object.defineProperty(this,"depthWrite",{get:()=>this._depthWrite,set:value=>{this._depthWrite=value;this._syncDepthToAMG()},enumerable:true,configurable:true})}_syncOpacityToAMG(){if(this._amgObject&&typeof this._amgObject.setFloat==="function"){try{this._amgObject.setFloat("u_Opacity",this._opacity);if(this._amgObject.setFloat&&typeof this._amgObject.setFloat==="function"){this._amgObject.setFloat("u_Alpha",this._opacity)}}catch(error){console.warn("Material: 同步透明度到AMG材质失败:",error)}}}_syncDepthToAMG(){if(this._amgObject!==undefined&&this._amgObject.xshader!==undefined){const depthStencilState=this._amgObject.xshader.passes.get(0).renderState.depthstencil;depthStencilState.depthTestEnable=this._depthTest;depthStencilState.depthWriteEnable=this._depthWrite}}_applyDepthDefaults(transparent,explicitDepthTest,explicitDepthWrite){if(transparent&&this._opacity<1){this._depthTest=explicitDepthTest!==undefined?explicitDepthTest:true;this._depthWrite=explicitDepthWrite!==undefined?explicitDepthWrite:false}else{this._depthTest=explicitDepthTest!==undefined?explicitDepthTest:true;this._depthWrite=explicitDepthWrite!==undefined?explicitDepthWrite:true}this._syncDepthToAMG()}_syncBlendingToAMG(){if(this._amgObject!==undefined&&this._amgObject.xshader!==undefined){const colorBlendState=this._amgObject.xshader.passes.get(0).renderState.colorBlend.attachments.get(0);const setBlendState=function(state,srcColor,dstColor,srcAlpha,dstAlpha){state.srcColorBlendFactor=srcColor;state.dstColorBlendFactor=dstColor;state.srcAlphaBlendFactor=srcAlpha;state.dstAlphaBlendFactor=dstAlpha};if(this._blending==__THREE_CONSTS.NoBlending){colorBlendState.blendEnable=false;setBlendState(colorBlendState,Amaz.BlendFactor.ONE,Amaz.BlendFactor.ONE_MINUS_SRC_ALPHA,Amaz.BlendFactor.ONE,Amaz.BlendFactor.ONE_MINUS_SRC_ALPHA)}else if(this._blending==__THREE_CONSTS.NormalBlending){colorBlendState.blendEnable=true;setBlendState(colorBlendState,Amaz.BlendFactor.SRC_ALPHA,Amaz.BlendFactor.ONE_MINUS_SRC_ALPHA,Amaz.BlendFactor.SRC_ALPHA,Amaz.BlendFactor.ONE_MINUS_SRC_ALPHA)}else if(this._blending==__THREE_CONSTS.AdditiveBlending){colorBlendState.blendEnable=true;setBlendState(colorBlendState,Amaz.BlendFactor.ONE,Amaz.BlendFactor.ONE,Amaz.BlendFactor.ONE,Amaz.BlendFactor.ONE)}else if(this._blending==__THREE_CONSTS.SubtractiveBlending){colorBlendState.blendEnable=true;setBlendState(colorBlendState,Amaz.BlendFactor.ZERO,Amaz.BlendFactor.ONE_MINUS_SRC_COLOR,Amaz.BlendFactor.ZERO,Amaz.BlendFactor.ONE)}else if(this._blending==__THREE_CONSTS.MultiplyBlending){colorBlendState.blendEnable=true;setBlendState(colorBlendState,Amaz.BlendFactor.DST_COLOR,Amaz.BlendFactor.ONE_MINUS_SRC_ALPHA,Amaz.BlendFactor.ZERO,Amaz.BlendFactor.ONE)}else{Amaz.LOGE("three-amg-wrapper","混合模式未实现:"+this._blending)}}}setOpacity(opacity){this.opacity=opacity;return this}clone(){return this}dispose(){this._amgObject=null}}exports.Material=Material;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/MathUtils.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const MathUtils={lerp:(a,b,t)=>a+(b-a)*t,degToRad:degrees=>degrees*Math.PI/180,radToDeg:radians=>radians*180/Math.PI,randFloat:(min,max)=>Math.random()*(max-min)+min,clamp:(value,min,max)=>Math.min(Math.max(value,min),max),euclideanModulo:(n,m)=>(n%m+m)%m,randFloatSpread:range=>Math.random()*range-range*.5};exports.MathUtils=MathUtils;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Matrix4.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const Vector3=require("./Vector3").Vector3;class Matrix4{constructor(){this.elements=new Float32Array(16);this.identity()}identity(){const te=this.elements;te[0]=1;te[4]=0;te[8]=0;te[12]=0;te[1]=0;te[5]=1;te[9]=0;te[13]=0;te[2]=0;te[6]=0;te[10]=1;te[14]=0;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this}fromAMGMatrix4f(m){const te=this.elements;te[0]=m.get(0,0);te[4]=m.get(0,1);te[8]=m.get(0,2);te[12]=m.get(0,3);te[1]=m.get(1,0);te[5]=m.get(1,1);te[9]=m.get(1,2);te[13]=m.get(1,3);te[2]=m.get(2,0);te[6]=m.get(2,1);te[10]=m.get(2,2);te[14]=m.get(2,3);te[3]=m.get(3,0);te[7]=m.get(3,1);te[11]=m.get(3,2);te[15]=m.get(3,3);return this}copy(m){const te=this.elements;const me=m.elements;te[0]=me[0];te[1]=me[1];te[2]=me[2];te[3]=me[3];te[4]=me[4];te[5]=me[5];te[6]=me[6];te[7]=me[7];te[8]=me[8];te[9]=me[9];te[10]=me[10];te[11]=me[11];te[12]=me[12];te[13]=me[13];te[14]=me[14];te[15]=me[15];return this}multiplyMatrices(a,b){const ae=a.elements;const be=b.elements;const te=this.elements;const a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];const a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];const a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];const a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];const b11=be[0],b12=be[4],b13=be[8],b14=be[12];const b21=be[1],b22=be[5],b23=be[9],b24=be[13];const b31=be[2],b32=be[6],b33=be[10],b34=be[14];const b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this}makeRotationZ(angle){const c=Math.cos(angle);const s=Math.sin(angle);this.identity();this.elements[0]=c;this.elements[4]=-s;this.elements[1]=s;this.elements[5]=c;return this}lookAt(eye,target,up){this.identity();const z=(new Vector3).subVectors(eye,target);if(z.length()===0){z.z=1}else{z.normalize()}const x=new Vector3;up.cross(z,x);if(x.lengthSq()===0){if(Math.abs(up.z)===1){z.x+=1e-4}else{z.z+=1e-4}z.normalize();up.cross(z,x)}x.normalize();const y=(new Vector3).cross(z,x).normalize();const te=this.elements;te[0]=x.x;te[1]=x.y;te[2]=x.z;te[3]=0;te[4]=y.x;te[5]=y.y;te[6]=y.z;te[7]=0;te[8]=z.x;te[9]=z.y;te[10]=z.z;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this}compose(position,quaternion,scale){const te=this.elements;const x=quaternion.x,y=quaternion.y,z=quaternion.z,w=quaternion.w;const x2=x+x,y2=y+y,z2=z+z;const xx=x*x2,xy=x*y2,xz=x*z2;const yy=y*y2,yz=y*z2,zz=z*z2;const wx=w*x2,wy=w*y2,wz=w*z2;const sx=scale.x,sy=scale.y,sz=scale.z;te[0]=(1-(yy+zz))*sx;te[1]=(xy+wz)*sx;te[2]=(xz-wy)*sx;te[3]=0;te[4]=(xy-wz)*sy;te[5]=(1-(xx+zz))*sy;te[6]=(yz+wx)*sy;te[7]=0;te[8]=(xz+wy)*sz;te[9]=(yz-wx)*sz;te[10]=(1-(xx+yy))*sz;te[11]=0;te[12]=position.x;te[13]=position.y;te[14]=position.z;te[15]=1;return this}decompose(position,quaternion,scale){position.set(0,0,0);quaternion.set(0,0,0,1);scale.set(1,1,1)}}exports.Matrix4=Matrix4;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Mesh.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const getCurrentScene=require("./runtime").getCurrentScene;const{Object3D}=require("./Object3D");const{MeshBasicMaterial}=require("./MeshBasicMaterial");const{ShaderMaterial}=require("./ShaderMaterial");const{VideoTexture}=require("./Texture");class MeshWrapper extends Object3D{constructor(geometry,material){super("Mesh_w");this._amgEntity.scene=getCurrentScene()._amgScene;this._amgRenderEntity=new Amaz.Entity;this._amgRenderEntity.name="Render_w";this._amgRenderEntity.scene=getCurrentScene()._amgScene;this._amgRendertransform=this._amgRenderEntity.addComponent("Transform");this._transform.addTransform(this._amgRendertransform);this._amgRendertransform.localPosition=new effect.Amaz.Vector3f(geometry.translateValue.x||0,geometry.translateValue.y||0,geometry.translateValue.z||0);this._amgMeshRenderer=this._amgRenderEntity.addComponent("MeshRenderer");this._amgMeshRenderer.mesh=geometry._amgObject;if(material!=null){if(Array.isArray(material)){const materials=new effect.Amaz.Vector;for(let i=0;i<material.length;i++)materials.pushBack(material[i]._amgObject);this._amgMeshRenderer.materials=materials}else{this._amgMeshRenderer.sharedMaterial=material._amgObject}}this.geometry=geometry;this.material=material;Object.defineProperty(this,"material",{get:()=>material,set:value=>{material=value;if(Array.isArray(material)){const materials=new effect.Amaz.Vector;for(let i=0;i<value.length;i++){materials.pushBack(value[i]._amgObject)}this._amgMeshRenderer.materials=materials}else{this._amgMeshRenderer.sharedMaterial=value._amgObject}},enumerable:true,configurable:true})}update(){}getWorldPosition(target){return super.getWorldPosition(target||null)}getWorldQuaternion(target){return super.getWorldQuaternion(target||null)}seekToTime(time){if(this.material!==undefined&&this.material instanceof MeshBasicMaterial){if(this.material.map!==undefined&&this.material.map instanceof VideoTexture){const videoTexture=this.material.map;const renderer=videoTexture._amgSprite2DRenderer;if(renderer.materials.size()==1){const texture=renderer.materials.get(0).getTex("_MainTex");videoTexture.setImage(texture);this.material._updateMaterialParams();videoTexture._amgVideoAnimSeq.seekToTime(time/1e3)}}}else if(this.material!==undefined&&this.material instanceof ShaderMaterial){const uniforms=this.material.uniforms;if(uniforms!==undefined){for(const[key,uniform]of Object.entries(uniforms)){if(uniform.value!==undefined&&uniform.value instanceof VideoTexture){const videoTexture=uniform.value;const renderer=videoTexture._amgSprite2DRenderer;if(renderer.materials.size()==1){const texture=renderer.materials.get(0).getTex("_MainTex");videoTexture.setImage(texture);this.material._syncUniformToAMG(key,videoTexture);videoTexture._amgVideoAnimSeq.seekToTime(time/1e3)}}}}}}dispose(){const currentScene=getCurrentScene();if(this._amgEntity){if(currentScene&&currentScene._amgScene)currentScene._amgScene.removeEntity(this._amgEntity);if(this._amgMeshRenderer){this._amgEntity.removeComponent(this._amgMeshRenderer);this._amgMeshRenderer=null}if(this._transform){this._amgEntity.removeComponent(this._transform);this._transform=null}this._amgEntity=null}if(this.geometry&&this.geometry.dispose)this.geometry.dispose();if(this.material){if(Array.isArray(this.material))this.material.forEach(m=>m.dispose&&m.dispose());else if(this.material.dispose)this.material.dispose()}}}exports.MeshWrapper=MeshWrapper;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/MeshBasicMaterial.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const Material=require("./Material").Material;const __THREE_CONSTS=require("./Constants");const Color=require("./Color").Color;const getCurrentScene=require("./runtime").getCurrentScene;class MeshBasicMaterial extends Material{constructor(parameters={}){super();this.scene=getCurrentScene();this._amgObject=this.scene._amgScene.assetMgr.SyncLoad("material/Unlit/Unlit.material").clone();this._color=parameters.color!==undefined?parameters.color instanceof Color?parameters.color:(new Color).setHex(parameters.color):new Color(1,1,1);this._map=null;this.wireframe=parameters.wireframe||false;this.transparent=parameters.transparent||false;this.opacity=parameters.opacity!==undefined?parameters.opacity:1;this._applyDepthDefaults(this.transparent,parameters.depthTest,parameters.depthWrite);this.blending=parameters.blending!==undefined?parameters.blending:__THREE_CONSTS.NormalBlending;this._amgObject.setVec4("u_AlbedoColor",this._color.toAMGColor());if(parameters.map){this.map=parameters.map}Object.defineProperty(this,"color",{get:()=>this._color,set:value=>{this._color=value;this._amgObject.setVec4("u_AlbedoColor",this._color.toAMGColor())}});const originalSetRGB=this._color.setRGB;const material=this;this.color.setRGB=function(r,g,b){originalSetRGB.call(this,r,g,b);if(material._amgObject){material._amgObject.setVec4("u_AlbedoColor",material._color.toAMGColor())}}}get map(){return this._map}set map(value){if(this._map){this._map._removeMaterial(this)}this._map=value;if(this._map&&this._map._amgObject){this._map._addMaterial(this);this._updateMaterialParams()}}_updateMaterialParams(){if(this._map&&this._map._amgObject){this._amgObject.setTex("u_AlbedoTexture",this._map._amgObject);this._amgObject.setVec2("u_Repeat",new effect.Amaz.Vector2f(this._map.repeat.x,this._map.repeat.y));this._amgObject.setVec2("u_Offset",new effect.Amaz.Vector2f(this._map.offset.x,this._map.offset.y))}}_updateTextureParams(){if(this._map&&this._map._amgObject){this._amgObject.setVec2("u_Repeat",new effect.Amaz.Vector2f(this._map.repeat.x,this._map.repeat.y));this._amgObject.setVec2("u_Offset",new effect.Amaz.Vector2f(this._map.offset.x,this._map.offset.y))}}clone(){const clonedColor=this._color instanceof Color?new Color(this._color.r,this._color.g,this._color.b):this._color;return new MeshBasicMaterial({color:clonedColor,map:this._map?this._map.clone():null,wireframe:this.wireframe,transparent:this.transparent,opacity:this.opacity,blending:this.blending})}dispose(){if(this._map){this._map._removeMaterial(this)}super.dispose()}}exports.MeshBasicMaterial=MeshBasicMaterial;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Object3D.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const getCurrentScene=require("./runtime").getCurrentScene;const Vector3=require("./Vector3").Vector3;const Euler=require("./Euler").Euler;const Matrix4=require("./Matrix4").Matrix4;const Quaternion=require("./Quaternion").Quaternion;const MathUtils=require("./MathUtils").MathUtils;class Object3D{constructor(name="Object3D_w"){this._amgEntity=new Amaz.Entity;this._amgEntity.name=name;this._transform=this._amgEntity.addComponent("Transform");this.children=[];this.userData={};this.visible=true;this.isCamera=false;this.up=new Vector3(0,1,0);this.matrix=new Matrix4;this.matrixAutoUpdate=true;Object.defineProperty(this,"matrixWorld",{get:()=>{return(new Matrix4).fromAMGMatrix4f(this._transform.getWorldMatrix())},set:value=>{this._transform.worldMatrix=new effect.Amaz.Matrix4f(value.elements[0],value.elements[1],value.elements[2],value.elements[3],value.elements[4],value.elements[5],value.elements[6],value.elements[7],value.elements[8],value.elements[9],value.elements[10],value.elements[11],value.elements[12],value.elements[13],value.elements[14],value.elements[15])},enumerable:true,configurable:true});Object.defineProperty(this,"name",{get:()=>this._amgEntity.name,set:value=>{this._amgEntity.name=value}});let _visible=this.visible;Object.defineProperty(this,"visible",{get:()=>_visible,set:value=>{_visible=value;this._amgEntity.visible=value},enumerable:true,configurable:true});this.position=new Vector3;let _posX=this.position.x,_posY=this.position.y,_posZ=this.position.z;const updateTransform=()=>{if(this._transform){this._transform.localPosition=new effect.Amaz.Vector3f(_posX,_posY,_posZ)}};Object.defineProperty(this.position,"x",{get:()=>_posX,set:v=>{_posX=v;updateTransform()},enumerable:true,configurable:true});Object.defineProperty(this.position,"y",{get:()=>_posY,set:v=>{_posY=v;updateTransform()},enumerable:true,configurable:true});Object.defineProperty(this.position,"z",{get:()=>_posZ,set:v=>{_posZ=v;updateTransform()},enumerable:true,configurable:true});this.position.set=(x,y,z)=>{_posX=x;_posY=y;_posZ=z;updateTransform();return this.position};this.position.copy=v=>{_posX=v.x;_posY=v.y;_posZ=v.z;updateTransform();return this.position};this.position.setX=x=>{_posX=x;updateTransform();return this.position};this.position.setY=y=>{_posY=y;updateTransform();return this.position};this.position.setZ=z=>{_posZ=z;updateTransform();return this.position};this.rotation=new Euler;let _rotX=this.rotation.x,_rotY=this.rotation.y,_rotZ=this.rotation.z;let _syncing=false;const updateRotation=()=>{if(_syncing)return;_syncing=true;try{const e=new Euler(_rotX,_rotY,_rotZ,this.rotation.order);const q=(new Quaternion).setFromEuler(e);if(this._transform){this._transform.localOrientation=new effect.Amaz.Quaternionf(q.x,q.y,q.z,q.w);this._transform.localEulerAngle=new effect.Amaz.Vector3f(_rotX/Math.PI*180,_rotY/Math.PI*180,_rotZ/Math.PI*180)}_qx=q.x;_qy=q.y;_qz=q.z;_qw=q.w;this.quaternion.x=q.x;this.quaternion.y=q.y;this.quaternion.z=q.z;this.quaternion.w=q.w}catch(_){}_syncing=false};Object.defineProperty(this.rotation,"x",{get:()=>_rotX,set:v=>{_rotX=v;updateRotation()},enumerable:true,configurable:true});Object.defineProperty(this.rotation,"y",{get:()=>_rotY,set:v=>{_rotY=v;updateRotation()},enumerable:true,configurable:true});Object.defineProperty(this.rotation,"z",{get:()=>_rotZ,set:v=>{_rotZ=v;updateRotation()},enumerable:true,configurable:true});this.rotation.set=(x,y,z,order)=>{if(order===undefined||order===null){this.rotation.x=x;this.rotation.y=y;this.rotation.z=z;return this.rotation}this.rotation.order=order;this.quaternion=new Quaternion;for(let i=0;i<order.length;i++){const ch=order[i];let q=new Quaternion;if(ch==="X")q.setFromAxisAngle(new Vector3(1,0,0),x);else if(ch==="Y")q.setFromAxisAngle(new Vector3(0,1,0),y);else if(ch==="Z")q.setFromAxisAngle(new Vector3(0,0,1),z);this.quaternion.multiply(q)}const amgQuat=new effect.Amaz.Quaternionf(this.quaternion.x,this.quaternion.y,this.quaternion.z,this.quaternion.w);const euler=amgQuat.quaternionToEuler();this.rotation.x=euler.x;this.rotation.y=euler.y;this.rotation.z=euler.z;this.rotation.order=order;return this.rotation};this.rotation.copy=v=>{this.rotation.x=v.x;this.rotation.y=v.y;this.rotation.z=v.z;this.rotation.order=v.order;return this.rotation};this.quaternion=new Quaternion;let _qx=this.quaternion.x,_qy=this.quaternion.y,_qz=this.quaternion.z,_qw=this.quaternion.w;const updateQuaternion=()=>{if(_syncing)return;_syncing=true;try{if(this._transform){const amgQuat=new effect.Amaz.Quaternionf(_qx,_qy,_qz,_qw);this._transform.localOrientation=amgQuat;const euler=amgQuat.quaternionToEuler();_rotX=euler.x;_rotY=euler.y;_rotZ=euler.z;this._transform.localEulerAngle=new effect.Amaz.Vector3f(_rotX/Math.PI*180,_rotY/Math.PI*180,_rotZ/Math.PI*180)}_rotX=_rotX;_rotY=_rotY;_rotZ=_rotZ}catch(_){}_syncing=false};Object.defineProperty(this.quaternion,"x",{get:()=>_qx,set:v=>{_qx=v;updateQuaternion()},enumerable:true,configurable:true});Object.defineProperty(this.quaternion,"y",{get:()=>_qy,set:v=>{_qy=v;updateQuaternion()},enumerable:true,configurable:true});Object.defineProperty(this.quaternion,"z",{get:()=>_qz,set:v=>{_qz=v;updateQuaternion()},enumerable:true,configurable:true});Object.defineProperty(this.quaternion,"w",{get:()=>_qw,set:v=>{_qw=v;updateQuaternion()},enumerable:true,configurable:true});this.quaternion.set=function(x,y,z,w){_qx=x;_qy=y;_qz=z;_qw=w;updateQuaternion();return this};this.quaternion.copy=function(q){_qx=q.x;_qy=q.y;_qz=q.z;_qw=q.w;updateQuaternion();return this};const originalSetFromAxisAngle=this.quaternion.setFromAxisAngle.bind(this.quaternion);this.quaternion.setFromAxisAngle=function(axis,angle){const r=originalSetFromAxisAngle(axis,angle);_qx=this.x;_qy=this.y;_qz=this.z;_qw=this.w;updateQuaternion();return r};this.scale=new Vector3(1,1,1);let _sx=this.scale.x,_sy=this.scale.y,_sz=this.scale.z;const updateScale=()=>{if(this._transform)this._transform.localScale=new effect.Amaz.Vector3f(_sx,_sy,_sz)};Object.defineProperty(this.scale,"x",{get:()=>_sx,set:v=>{_sx=v;updateScale()},enumerable:true,configurable:true});Object.defineProperty(this.scale,"y",{get:()=>_sy,set:v=>{_sy=v;updateScale()},enumerable:true,configurable:true});Object.defineProperty(this.scale,"z",{get:()=>_sz,set:v=>{_sz=v;updateScale()},enumerable:true,configurable:true});this.scale.set=(x,y,z)=>{_sx=x;_sy=y;_sz=z;updateScale();return this.scale};this.scale.setScalar=v=>{_sx=v;_sy=v;_sz=v;updateScale()};this.scale.setX=x=>{_sx=x;updateScale();return this.scale};this.scale.setY=y=>{_sy=y;updateScale();return this.scale};this.scale.setZ=z=>{_sz=z;updateScale();return this.scale};this.scale.copy=v=>{_sx=v.x;_sy=v.y;_sz=v.z;updateScale();return this.scale}}clone(recursive=true){const cloned=new Object3D(this.name+"_clone");cloned.visible=this.visible;cloned.isCamera=this.isCamera;cloned.up.copy(this.up);cloned.userData={...this.userData};cloned.position.copy(this.position);cloned.rotation.copy(this.rotation);cloned.quaternion.copy(this.quaternion);cloned.scale.copy(this.scale);if(recursive){for(const child of this.children){const clonedChild=child.clone(recursive);cloned.add(clonedChild)}}return cloned}traverse(callback){callback(this);if(this.children&&this.children.length>0){this.children.forEach(child=>{if(child.traverse)child.traverse(callback);else callback(child)})}}getWorldPosition(target){if(!target)target=new Vector3;if(this._transform&&this._transform.worldPosition){target.set(this._transform.worldPosition.x,this._transform.worldPosition.y,this._transform.worldPosition.z)}else{target.copy(this.position)}return target}getWorldQuaternion(target){if(!target)target=new Quaternion;if(this._transform&&this._transform.worldOrientation)target.fromAMGQuaternion(this._transform.worldOrientation);else target.copy(this.quaternion);return target}add(object){if(object===this){console.warn("Object3D.add: 不能将对象添加到自身");return this}if(object.parent!==undefined){object.parent.remove(object)}object.parent=this;this.children.push(object);if(object._transform)this._transform.addTransform(object._transform);return this}remove(object){const index=this.children.indexOf(object);if(index!==-1){object.parent=undefined;this.children.splice(index,1);const currentScene=getCurrentScene();if(currentScene&&currentScene._amgScene)currentScene._amgScene.removeEntity(object._amgEntity)}return this}attach(child){if(!child||!child._transform){console.warn("attach error: invalid child or missing _transform component");return}this.children.push(child);this._transform.addTransform(child._transform);child._transform.worldPosition=child._transform.localPosition;child._transform.worldRotation=child._transform.localRotation;child._transform.worldScale=child._transform.localScale;return this}rotateX(angle){this.rotation.x+=angle;return this}rotateY(angle){this.rotation.y+=angle;return this}rotateZ(angle){this.rotation.z+=angle;return this}rotateOnAxis(vec3,rad){const axis=vec3.clone().normalize();const q=(new Quaternion).setFromAxisAngle(axis,rad);const currentQuat=this.quaternion.clone();currentQuat.multiply(q);this.quaternion.set(currentQuat.x,currentQuat.y,currentQuat.z,currentQuat.w);if(this._transform){const amgQuat=new effect.Amaz.Quaternionf(this.quaternion.x,this.quaternion.y,this.quaternion.z,this.quaternion.w);const euler=amgQuat.quaternionToEuler();this.rotation.set(euler.x,euler.y,euler.z)}return this}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale)}updateMatrixWorld(flag){}lookAt(x,y,z){if(x instanceof Vector3){this.lookAt(x.x,x.y,x.z);return this}const pos=new Vector3(this._transform.worldPosition.x,this._transform.worldPosition.y,this._transform.worldPosition.z);const tarOri=new Vector3(x,y,z);const Tar3=new Vector3(2*pos.x-tarOri.x,2*pos.y-tarOri.y,2*pos.z-tarOri.z);if(!this.isCamera){Tar3.copy(tarOri)}const normal=Tar3.clone().normalize();const angle=new Vector3(0-normal.x,1-normal.y,0-normal.z);if(angle.length()<.001)return this;const tar=new effect.Amaz.Vector3f(Tar3.x,Tar3.y,Tar3.z);const up=new effect.Amaz.Vector3f(0,1,0);this._transform.lookAt(tar,up);this.quaternion.set(this._transform.localOrientation.x,this._transform.localOrientation.y,this._transform.localOrientation.z,this._transform.localOrientation.w);return this}worldToLocal(worldPos){const localPos=new Vector3;if(!this._transform||!worldPos)return localPos;const thisWorldPos=this._transform.worldPosition;localPos.set(worldPos.x-thisWorldPos.x,worldPos.y-thisWorldPos.y,worldPos.z-thisWorldPos.z);try{if(this._transform.worldOrientation){const worldQ=(new Quaternion).fromAMGQuaternion(this._transform.worldOrientation).normalize();const invQ=new Quaternion(-worldQ.x,-worldQ.y,-worldQ.z,worldQ.w).normalize();localPos.applyQuaternion(invQ)}else if(this._transform.worldRotation){const ex=this._transform.worldRotation.x/180*Math.PI;const ey=this._transform.worldRotation.y/180*Math.PI;const ez=this._transform.worldRotation.z/180*Math.PI;const worldEuler=new Euler(ex,ey,ez);const worldQ=(new Quaternion).setFromEuler(worldEuler).normalize();const invQ=new Quaternion(-worldQ.x,-worldQ.y,-worldQ.z,worldQ.w).normalize();localPos.applyQuaternion(invQ)}}catch(_){}if(this._transform.worldScale){const ws=this._transform.worldScale;const sx=ws.x||1,sy=ws.y||1,sz=ws.z||1;if(sx!==0)localPos.x/=sx;if(sy!==0)localPos.y/=sy;if(sz!==0)localPos.z/=sz}return localPos}updateWorldMatrix(force=false,updateParents=false){}dispose(){while(this.children.length>0){const child=this.children[0];this.remove(child);if(child.dispose&&typeof child.dispose==="function")child.dispose()}const currentScene=getCurrentScene();if(currentScene&&currentScene._amgScene)currentScene._amgScene.removeEntity(this._amgEntity);if(this._transform){this._amgEntity.removeComponent(this._transform);this._transform=null}this._amgEntity=null;this.children=[]}}exports.Object3D=Object3D;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/PerspectiveCamera.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Object3D}=require("./Object3D");const{getCurrentScene}=require("./runtime");class PerspectiveCamera extends Object3D{constructor(fov=75,aspect=1,near=.1,far=1e3){super("PerspectiveCamera_w");this._amgEntity.scene=getCurrentScene()._amgScene;this.isCamera=true;this._amgObject=this._amgEntity.addComponent("Camera");this._amgObject.type=effect.Amaz.CameraType.PERSPECTIVE;this._amgObject.clearType=effect.Amaz.CameraClearType.COLOR_DEPTH;this._amgObject.clearColor=new effect.Amaz.Color(0,0,0,0);this._amgObject.layerVisibleMask=new effect.Amaz.DynamicBitset(1,1);this._amgObject.renderOrder=0;const renderTexture=getCurrentScene()._amgScene.assetMgr.SyncLoad("rt/RT_0.rt");this._amgObject.renderTexture=renderTexture;this._fov=fov;this.fovy=fov;this.aspect=aspect;this.near=near;this.far=far;this.updateProjectionMatrix()}set fov(value){this._fov=value;this.fovy=value;this.updateProjectionMatrix()}updateProjectionMatrix(){this._amgObject.fovy=this.fovy;this._amgObject.aspect=this.aspect;this._amgObject.zNear=this.near;this._amgObject.zFar=this.far}update(){}dispose(){const currentScene=getCurrentScene();if(this._amgEntity){if(currentScene&&currentScene._amgScene)currentScene._amgScene.removeEntity(this._amgEntity);if(this._amgObject.renderTexture){this._amgObject.renderTexture=null}if(this._amgObject){this._amgEntity.removeComponent(this._amgObject);this._amgObject=null}if(this._transform){this._amgEntity.removeComponent(this._transform);this._transform=null}this._amgEntity=null}}}exports.PerspectiveCamera=PerspectiveCamera;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/PlaneGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferGeometry}=require("./BufferGeometry");const{BufferAttribute}=require("./BufferAttribute");class PlaneGeometry extends BufferGeometry{constructor(width=1,height=1,widthSegments=1,heightSegments=1){super();this.width=width;this.height=height;this.widthSegments=widthSegments;this.heightSegments=heightSegments;const scene=getCurrentScene();if(scene){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Quad.mesh").clone()}else{console.warn("PlaneGeometry: 无法加载Quad.mesh,scerne未创建")}{var vertexAttribs=this._amgObject.vertexAttribs;var attribDesc0=new effect.Amaz.VertexAttribDesc;attribDesc0.semantic=effect.Amaz.VertexAttribType.POSITION_OFFSET;attribDesc0.bindingIndex=0;attribDesc0.offset=36;attribDesc0.componentCount=3;vertexAttribs.pushBack(attribDesc0);var attribDesc1=new effect.Amaz.VertexAttribDesc;attribDesc1.semantic=effect.Amaz.VertexAttribType.TEXCOORD1;attribDesc1.bindingIndex=0;attribDesc1.offset=48;attribDesc1.componentCount=2;vertexAttribs.pushBack(attribDesc1);this._amgObject.vertexAttribs=vertexAttribs;const submesh=this._amgObject.submeshes.get(0);if(submesh){submesh.primitive=effect.Amaz.Primitive.TRIANGLES}}const gridX=widthSegments;const gridY=heightSegments;const gridX1=gridX+1;const gridY1=gridY+1;const segmentWidth=width/gridX;const segmentHeight=height/gridY;const vertices=[];const uvs=[];const indices=[];for(let iy=0;iy<gridY1;iy++){const y=iy*segmentHeight-height/2;for(let ix=0;ix<gridX1;ix++){const x=ix*segmentWidth-width/2;vertices.push(x,-y,0);uvs.push(ix/gridX,1-iy/gridY)}}for(let iy=0;iy<gridY;iy++){for(let ix=0;ix<gridX;ix++){const a=iy*gridX1+ix;const b=iy*gridX1+ix+1;const c=(iy+1)*gridX1+ix+1;const d=(iy+1)*gridX1+ix;indices.push(a,b,c,a,c,d)}}this.setAttribute("position",new BufferAttribute(new Float32Array(vertices),3));this.setAttribute("uv",new BufferAttribute(new Float32Array(uvs),2));this.setIndex(indices)}}exports.PlaneGeometry=PlaneGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Quaternion.js ADDED
@@ -0,0 +1 @@
 
 
1
+ class Quaternion{constructor(x=0,y=0,z=0,w=1){this.x=x;this.y=y;this.z=z;this.w=w}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this}copy(q){this.x=q.x;this.y=q.y;this.z=q.z;this.w=q.w;return this}clone(){return new Quaternion(this.x,this.y,this.z,this.w)}normalize(){const len=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(len>0){const invLen=1/len;this.x*=invLen;this.y*=invLen;this.z*=invLen;this.w*=invLen}return this}identity(){this.x=0;this.y=0;this.z=0;this.w=1;return this}multiply(q){const x=this.x,y=this.y,z=this.z,w=this.w;const qx=q.x,qy=q.y,qz=q.z,qw=q.w;this.x=w*qx+x*qw+y*qz-z*qy;this.y=w*qy-x*qz+y*qw+z*qx;this.z=w*qz+x*qy-y*qx+z*qw;this.w=w*qw-x*qx-y*qy-z*qz;return this}setFromAxisAngle(axis,angle){const halfAngle=angle/2;const s=Math.sin(halfAngle);this.x=axis.x*s;this.y=axis.y*s;this.z=axis.z*s;this.w=Math.cos(halfAngle);return this}setFromEuler(euler){const x=euler.x/2;const y=euler.y/2;const z=euler.z/2;const cx=Math.cos(x);const sx=Math.sin(x);const cy=Math.cos(y);const sy=Math.sin(y);const cz=Math.cos(z);const sz=Math.sin(z);this.x=sx*cy*cz+cx*sy*sz;this.y=cx*sy*cz-sx*cy*sz;this.z=cx*cy*sz+sx*sy*cz;this.w=cx*cy*cz-sx*sy*sz;return this}slerp(q,t){const dot=this.x*q.x+this.y*q.y+this.z*q.z+this.w*q.w;let qx=q.x,qy=q.y,qz=q.z,qw=q.w;let dotValue=dot;if(dot<0){qx=-qx;qy=-qy;qz=-qz;qw=-qw;dotValue=-dotValue}const dotClamped=Math.max(-1,Math.min(1,dotValue));const theta=Math.acos(dotClamped);if(theta<.001){this.x=this.x+(qx-this.x)*t;this.y=this.y+(qy-this.y)*t;this.z=this.z+(qz-this.z)*t;this.w=this.w+(qw-this.w)*t}else{const sinTheta=Math.sin(theta);const sinThetaT=Math.sin(theta*t);const sinTheta1T=Math.sin(theta*(1-t));this.x=(this.x*sinTheta1T+qx*sinThetaT)/sinTheta;this.y=(this.y*sinTheta1T+qy*sinThetaT)/sinTheta;this.z=(this.z*sinTheta1T+qz*sinThetaT)/sinTheta;this.w=(this.w*sinTheta1T+qw*sinThetaT)/sinTheta}this.normalize();return this}setFromRotationMatrix(matrix){const te=matrix.elements;const m11=te[0],m12=te[4],m13=te[8];const m21=te[1],m22=te[5],m23=te[9];const m31=te[2],m32=te[6],m33=te[10];const trace=m11+m22+m33;let s;if(trace>0){s=Math.sqrt(trace+1)*2;this.w=.25*s;this.x=(m32-m23)/s;this.y=(m13-m31)/s;this.z=(m21-m12)/s}else if(m11>m22&&m11>m33){s=Math.sqrt(1+m11-m22-m33)*2;this.w=(m32-m23)/s;this.x=.25*s;this.y=(m12+m21)/s;this.z=(m13+m31)/s}else if(m22>m33){s=Math.sqrt(1+m22-m11-m33)*2;this.w=(m13-m31)/s;this.x=(m12+m21)/s;this.y=.25*s;this.z=(m23+m32)/s}else{s=Math.sqrt(1+m33-m11-m22)*2;this.w=(m21-m12)/s;this.x=(m13+m31)/s;this.y=(m23+m32)/s;this.z=.25*s}this.normalize();if(this.w<0){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w}return this}slerpQuaternions(q1,q2,t){this.copy(q1);return this.slerp(q2,t)}toArray(){return[this.x,this.y,this.z,this.w]}toString(){return`Quaternion(${this.x}, ${this.y}, ${this.z}, ${this.w})`}toAMGQuaternion(){return new effect.Amaz.Quaternionf(this.x,this.y,this.z,this.w)}fromAMGQuaternion(q){this.x=q.x;this.y=q.y;this.z=q.z;this.w=q.w;return this}}exports.Quaternion=Quaternion;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ShaderMaterial.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const Material=require("./Material").Material;const __THREE_CONSTS=require("./Constants");const getCurrentScene=require("./runtime").getCurrentScene;const Vector2=require("./Vector2").Vector2;const Vector3=require("./Vector3").Vector3;const Vector4=require("./Vector4").Vector4;const Color=require("./Color").Color;const Texture=require("./Texture").Texture;const ARRAY_PROXY_FLAG=Symbol("ShaderMaterialArrayProxy");const MUTATING_ARRAY_METHODS=new Set(["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin","copy","set"]);const __uniformBindingMap=new WeakMap;function __registerUniformBinding(uniform,material,key){let list=__uniformBindingMap.get(uniform);if(!list){list=[];__uniformBindingMap.set(uniform,list)}if(!list.some(b=>b.material===material&&b.key===key)){list.push({material:material,key:key})}}function __notifyUniformBindings(uniform,value){const list=__uniformBindingMap.get(uniform);if(!list)return;for(const b of list){if(b&&b.material&&typeof b.material._syncUniformToAMG==="function"){b.material._syncUniformToAMG(b.key,value)}}}class ShaderMaterial extends Material{constructor(parameters={}){super();this.originalVertexShader=parameters.vertexShader;this.originalFragmentShader=parameters.fragmentShader;this.scene=getCurrentScene();this._amgObject=this.scene._amgScene.assetMgr.SyncLoad("material/Unlit/Unlit.material").clone();this.transparent=parameters.transparent||false;this.opacity=parameters.opacity!==undefined?parameters.opacity:1;this._applyDepthDefaults(this.transparent,parameters.depthTest,parameters.depthWrite);if(this.transparent==true){this.blending=parameters.blending!==undefined?parameters.blending:__THREE_CONSTS.NormalBlending}else{this.blending=parameters.blending!==undefined?parameters.blending:__THREE_CONSTS.NoBlending}this._originalUniforms=parameters.uniforms||{};this._uniforms=this._createUniformsProxy(this._originalUniforms);this._hookUniforms(this._originalUniforms);if(parameters.uniforms){for(const[key,value]of Object.entries(parameters.uniforms)){this._syncUniformToAMG(key,value.value)}}let key="";if(parameters.vertexShader&&parameters.fragmentShader){let vertLength=parameters.vertexShader.length;let fragLength=parameters.fragmentShader.length;if(vertLength>0&&fragLength>0){key="c_"+vertLength+"_"+fragLength}}let xshader=this._amgObject.xshader.clone();let passes=xshader.passes;let pass=passes.get(0);let shaders=pass.shaders;let gles2=shaders.get("gles2");let glesShader1=gles2.get(0);let glesShader2=gles2.get(1);if(parameters.vertexShader){let shader=parameters.vertexShader;shader=shader.replace(/\buv\b/g,"attTexcoord0");shader=shader.replace(/\bnormal\b/g,"attNormal");shader=shader.replace(/\bposition\b/g,"attPosition");shader=shader.replace(/\bnormalMatrix\b/g,"mat3(u_MV)");shader=shader.replace(/\bmodelMatrix\b/g,"u_Model");shader=shader.replace(/\bviewMatrix\b/g,"u_View");shader=shader.replace(/\bmodelViewMatrix\b/g,"u_MV");shader=shader.replace(/\bprojectionMatrix\b/g,"u_Projection");shader=shader.replace(/\bmodelViewProjectionMatrix\b/g,"u_MVP");shader=shader.replace(/\bu_Projection \* u_View \* u_Model\b/g,"u_MVP");shader=shader.replace(/\bu_Projection \* u_MV\b/g,"u_MVP");parameters.vertexShader="precision highp float; attribute vec3 attPosition; attribute vec2 attTexcoord0; attribute vec3 attNormal; uniform mat4 u_MVP; uniform mat4 u_MV; uniform mat4 u_Projection; uniform mat4 u_Model; uniform mat4 u_View; "+shader;glesShader1.source=parameters.vertexShader;glesShader1.sourcePath=""}if(parameters.fragmentShader){parameters.fragmentShader="precision highp float;"+parameters.fragmentShader;glesShader2.source=parameters.fragmentShader;glesShader2.sourcePath=""}var rootDir=this.scene._amgScene.assetMgr.rootDir;var vertMetalPath=rootDir+"xshader/"+key+".vert.metal";var fragMetalPath=rootDir+"xshader/"+key+".frag.metal";var metalFileExist=false;var swingTemplateUtils=null;if(effect.Amaz.SwingTemplateUtils){swingTemplateUtils=new effect.Amaz.SwingTemplateUtils}if(swingTemplateUtils&&swingTemplateUtils.isFileExist(vertMetalPath)&&swingTemplateUtils.isFileExist(fragMetalPath)){metalFileExist=true}if(metalFileExist==false){let metal=shaders.get("metal");if(metal){shaders.remove("metal")}}else{let metal=shaders.get("metal");let metalShader1=metal.get(0);let metalShader2=metal.get(1);metalShader1.source="";metalShader1.sourcePath="xshader/"+key+".vert.metal";metalShader2.source="";metalShader2.sourcePath="xshader/"+key+".frag.metal"}this._amgObject.xshader=xshader}_createUniformsProxy(originalUniforms){const uniformsProxy={};for(const[key,uniform]of Object.entries(originalUniforms)){uniformsProxy[key]={get value(){return uniform.value},set value(newValue){uniform.value=newValue}}}return uniformsProxy}_cloneUniforms(sourceUniforms){if(!sourceUniforms)return{};const cloned={};for(const[key,uniform]of Object.entries(sourceUniforms)){if(!uniform||typeof uniform!=="object")continue;cloned[key]={value:this._cloneUniformValue(uniform.value)}}return cloned}_cloneUniformValue(value){if(value instanceof Texture){return value}if(value instanceof Vector2||value instanceof Vector3||value instanceof Vector4){return typeof value.clone==="function"?value.clone():value}if(value instanceof Color){return new Color(value.r,value.g,value.b)}if(Array.isArray(value)){return value.map(v=>this._cloneUniformValue(v))}if(value&&typeof value==="object"){return{...value}}return value}_hookUniforms(originalUniforms){if(!originalUniforms)return;for(const[key,uniform]of Object.entries(originalUniforms)){this._hookSingleUniform(key,uniform)}}_hookSingleUniform(key,uniform){if(!uniform||typeof uniform!=="object")return;this._normalizeUniformValue(uniform);__registerUniformBinding(uniform,this,key);this._attachUniformVectorObserver(uniform);this._attachUniformArrayObserver(uniform,key);if(uniform._amgUniformHooked)return;try{let _val=uniform.value;Object.defineProperty(uniform,"value",{get:()=>_val,set:v=>{_val=this._convertUniformValue(v);this._attachUniformVectorObserver(uniform,_val);const proxied=this._attachUniformArrayObserver(uniform,key,_val);if(proxied){_val=proxied}__notifyUniformBindings(uniform,_val)},enumerable:true,configurable:true});const proxied=this._attachUniformArrayObserver(uniform,key,_val);if(proxied){_val=proxied}Object.defineProperty(uniform,"_amgUniformHooked",{value:true,enumerable:false,configurable:true})}catch(e){}}_looksLikeVector(obj,components){if(!obj||typeof obj!=="object")return false;return components.every(c=>typeof obj[c]==="number")}_normalizeUniformValue(uniform){if(!uniform||typeof uniform!=="object"||!("value"in uniform))return;const converted=this._convertUniformValue(uniform.value);if(converted===uniform.value)return;const descriptor=Object.getOwnPropertyDescriptor(uniform,"value");if(descriptor&&typeof descriptor.set==="function"&&typeof descriptor.get==="function"){descriptor.set.call(uniform,converted)}else{uniform.value=converted}}_convertUniformValue(value){if(value instanceof Vector2||value instanceof Vector3||value instanceof Vector4){return value}if(value instanceof Color){return new Vector3(value.r,value.g,value.b)}if(Array.isArray(value)){const nums=value;if(nums.length===2&&nums.every(v=>typeof v==="number")){return new Vector2(nums[0],nums[1])}else if(nums.length===3&&nums.every(v=>typeof v==="number")){return new Vector3(nums[0],nums[1],nums[2])}else if(nums.length===4&&nums.every(v=>typeof v==="number")){return new Vector4(nums[0],nums[1],nums[2],nums[3])}return value}if(this._looksLikeVector(value,["x","y","z","w"])){return new Vector4(value.x,value.y,value.z,value.w)}else if(this._looksLikeVector(value,["x","y","z"])){return new Vector3(value.x,value.y,value.z)}else if(this._looksLikeVector(value,["x","y"])){return new Vector2(value.x,value.y)}return value}_attachUniformVectorObserver(uniform,valueOverride){if(!uniform||typeof uniform!=="object"||!("value"in uniform))return;const value=valueOverride||uniform.value;if(!(value instanceof Vector2||value instanceof Vector3||value instanceof Vector4||value instanceof Color)){return}if(value.__amgUniformVectorHooked)return;const wrapMethod=methodName=>{if(typeof value[methodName]!=="function")return;const original=value[methodName].bind(value);value[methodName]=(...args)=>{const result=original(...args);__notifyUniformBindings(uniform,value);return result}};wrapMethod("set");wrapMethod("copy");if(value instanceof Color){wrapMethod("setRGB");wrapMethod("setHex");wrapMethod("setHexString");wrapMethod("setHSL")}Object.defineProperty(value,"__amgUniformVectorHooked",{value:true,enumerable:false,configurable:true})}_attachUniformArrayObserver(uniform,key,valueOverride){if(!uniform||typeof uniform!=="object")return null;const value=valueOverride||uniform.value;const isTyped=this._isTypedArray(value);if(!Array.isArray(value)&&!isTyped)return null;if(value&&value[ARRAY_PROXY_FLAG])return value;const notifyArrayChange=()=>{try{__notifyUniformBindings(uniform,proxy)}catch(e){try{this._syncUniformToAMG(key,{value:proxy})}catch(err){}}};const proxy=this._getArrayProxy(value,notifyArrayChange);if(Array.isArray(value)){for(let i=0;i<value.length;i++){const element=value[i];if(element instanceof Vector2||element instanceof Vector3||element instanceof Vector4){if(!element.__amgArrayElementHooked){const wrapElementMethod=methodName=>{if(typeof element[methodName]!=="function")return;const original=element[methodName].bind(element);element[methodName]=(...args)=>{const result=original(...args);notifyArrayChange();return result}};wrapElementMethod("set");wrapElementMethod("copy");Object.defineProperty(element,"__amgArrayElementHooked",{value:true,enumerable:false,configurable:true})}}}}return proxy}_getArrayProxy(arrayTarget,onChange){if(!this._arrayProxyMap){this._arrayProxyMap=new WeakMap}if(this._arrayProxyMap.has(arrayTarget)){return this._arrayProxyMap.get(arrayTarget)}const notifyChange=()=>{try{onChange()}catch(e){}};const handler={get(target,prop,receiver){const value=Reflect.get(target,prop,receiver);if(typeof value==="function"&&MUTATING_ARRAY_METHODS.has(prop)){return function(){const result=value.apply(target,arguments);notifyChange();return result}}if(typeof prop==="string"&&/^\d+$/.test(prop)&&(value instanceof Vector2||value instanceof Vector3||value instanceof Vector4)){if(!value.__amgArrayElementHooked){const wrapElementMethod=methodName=>{if(typeof value[methodName]!=="function")return;const original=value[methodName].bind(value);value[methodName]=(...args)=>{const result=original(...args);notifyChange();return result}};wrapElementMethod("set");wrapElementMethod("copy");Object.defineProperty(value,"__amgArrayElementHooked",{value:true,enumerable:false,configurable:true})}}return value},set(target,prop,value,receiver){const result=Reflect.set(target,prop,value,receiver);if(typeof prop==="string"&&/^\d+$/.test(prop)&&(value instanceof Vector2||value instanceof Vector3||value instanceof Vector4)){if(!value.__amgArrayElementHooked){const wrapElementMethod=methodName=>{if(typeof value[methodName]!=="function")return;const original=value[methodName].bind(value);value[methodName]=(...args)=>{const result=original(...args);notifyChange();return result}};wrapElementMethod("set");wrapElementMethod("copy");Object.defineProperty(value,"__amgArrayElementHooked",{value:true,enumerable:false,configurable:true})}}notifyChange();return result}};const proxy=new Proxy(arrayTarget,handler);Object.defineProperty(proxy,ARRAY_PROXY_FLAG,{value:true,enumerable:false,configurable:false});this._arrayProxyMap.set(arrayTarget,proxy);return proxy}_isTypedArray(value){return typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&ArrayBuffer.isView(value)}_resolveUniformValueAndType(key,valueOrObject){let resolvedValue=valueOrObject;let resolvedType=undefined;if(valueOrObject&&typeof valueOrObject==="object"&&valueOrObject!==null&&"value"in valueOrObject){resolvedValue=valueOrObject.value;resolvedType=valueOrObject.type}if(!resolvedType&&this._originalUniforms&&this._originalUniforms[key]&&typeof this._originalUniforms[key]==="object"){resolvedType=this._originalUniforms[key].type}return{value:resolvedValue,type:resolvedType}}_syncUniformToAMG(key,valueOrObject){if(!this._amgObject)return;const{value,type}=this._resolveUniformValueAndType(key,valueOrObject);if(value===undefined||value===null)return;const convertedValue=Array.isArray(value)||this._isTypedArray(value)?value:this._convertUniformValue(value);let yModified=undefined;if(convertedValue instanceof Vector2||convertedValue instanceof Vector3){if(key==="videoTextureRepeat")yModified=-convertedValue.y;else if(key==="videoTextureOffset")yModified=-convertedValue.y+1;else yModified=convertedValue.y}const toVec2=(x,y)=>new effect.Amaz.Vector2f(x,y);const toVec3=(x,y,z)=>new effect.Amaz.Vector3f(x,y,z);const toVec4=(x,y,z,w)=>new effect.Amaz.Vector4f(x,y,z,w);const numbersOnly=arr=>Array.isArray(arr)&&arr.every(item=>typeof item==="number");try{if(convertedValue instanceof Texture){this._amgObject.setTex(key,convertedValue._amgObject);return}if(convertedValue instanceof Vector2){const y=typeof yModified==="number"?yModified:convertedValue.y;this._amgObject.setVec2(key,toVec2(convertedValue.x,y));return}if(convertedValue instanceof Vector3){this._amgObject.setVec3(key,toVec3(convertedValue.x,convertedValue.y,convertedValue.z));return}if(convertedValue instanceof Vector4){this._amgObject.setVec4(key,toVec4(convertedValue.x,convertedValue.y,convertedValue.z,convertedValue.w));return}if(typeof convertedValue==="number"){if(type&&type==="i"){this._amgObject.setInt(key,convertedValue)}else{this._amgObject.setFloat(key,convertedValue)}return}if(typeof convertedValue==="boolean"){this._amgObject.setFloat(key,convertedValue?1:0);return}if(Array.isArray(convertedValue)||this._isTypedArray(convertedValue)){let arr=Array.isArray(convertedValue)?convertedValue.slice():Array.from(convertedValue);if(Array.isArray(arr[0])){arr=arr.flat()}const allNums=numbersOnly(arr);if(!type||type==="vec2"||type==="vec3"||type==="vec4"){if(arr.length===2&&allNums&&(!type||type==="vec2")){this._amgObject.setVec2(key,toVec2(arr[0],arr[1]));return}if(arr.length===3&&allNums&&(!type||type==="vec3")){this._amgObject.setVec3(key,toVec3(arr[0],arr[1],arr[2]));return}if(arr.length===4&&allNums&&(!type||type==="vec4")){this._amgObject.setVec4(key,toVec4(arr[0],arr[1],arr[2],arr[3]));return}}const setVec2Array=list=>{const vecs=new effect.Amaz.Vec2Vector;if(numbersOnly(list)){if(list.length%2!==0){console.warn(`Expected vec2[] for ${key}, got length ${list.length}`)}for(let i=0;i<list.length;i+=2){const x=list[i];const y=list[i+1]!==undefined?list[i+1]:0;vecs.pushBack(toVec2(x,y))}}else{for(const item of list){if(this._looksLikeVector(item,["x","y"])){vecs.pushBack(toVec2(item.x,item.y))}else if(Array.isArray(item)&&item.length>=2){vecs.pushBack(toVec2(item[0],item[1]))}}}this._amgObject.setVec2Vector(key,vecs)};const setVec3Array=list=>{const vecs=new effect.Amaz.Vec3Vector;if(numbersOnly(list)){if(list.length%3!==0){console.warn(`Expected vec3[] for ${key}, got length ${list.length}`)}for(let i=0;i<list.length;i+=3){vecs.pushBack(toVec3(list[i],list[i+1]??0,list[i+2]??0))}}else{for(const item of list){if(item instanceof Color){vecs.pushBack(toVec3(item.r,item.g,item.b))}else if(this._looksLikeVector(item,["x","y","z"])){vecs.pushBack(toVec3(item.x,item.y,item.z))}else if(Array.isArray(item)&&item.length>=3){vecs.pushBack(toVec3(item[0],item[1],item[2]))}}}this._amgObject.setVec3Vector(key,vecs)};const setVec4Array=list=>{const vecs=new effect.Amaz.Vec4Vector;if(numbersOnly(list)){if(list.length%4!==0){console.warn(`Expected vec4[] for ${key}, got length ${list.length}`)}for(let i=0;i<list.length;i+=4){vecs.pushBack(toVec4(list[i],list[i+1]??0,list[i+2]??0,list[i+3]??0))}}else{for(const item of list){if(this._looksLikeVector(item,["x","y","z","w"])){vecs.pushBack(toVec4(item.x,item.y,item.z,item.w))}else if(Array.isArray(item)&&item.length>=4){vecs.pushBack(toVec4(item[0],item[1],item[2],item[3]))}}}this._amgObject.setVec4Vector(key,vecs)};const setFloatArray=list=>{const floats=new effect.Amaz.FloatVector;for(const num of list){if(typeof num==="number"){floats.pushBack(num)}}this._amgObject.setFloatVector(key,floats)};if(type==="vec2[]"){setVec2Array(arr);return}if(type==="vec3[]"){setVec3Array(arr);return}if(type==="vec4[]"){setVec4Array(arr);return}if(type==="float[]"){setFloatArray(arr);return}console.warn(`Unsupported array uniform type for ${key}:`,type||typeof convertedValue);return}console.warn(`Unsupported uniform type for ${key}:`,convertedValue)}catch(error){console.error(`Failed to sync uniform ${key} to AMG:`,error)}}get uniforms(){return this._uniforms}set uniforms(newUniforms){this._originalUniforms=newUniforms||{};this._uniforms=this._createUniformsProxy(this._originalUniforms);this._hookUniforms(this._originalUniforms);for(const[key,uniform]of Object.entries(this._originalUniforms)){if(uniform&&"value"in uniform){this._syncUniformToAMG(key,uniform.value)}}}clone(){const clonedUniforms=this._cloneUniforms(this._originalUniforms);return new ShaderMaterial({uniforms:clonedUniforms,vertexShader:this.originalVertexShader,fragmentShader:this.originalFragmentShader,transparent:this.transparent,blending:this.blending,depthTest:this.depthTest,depthWrite:this.depthWrite,opacity:this.opacity})}dispose(){this._amgObject=null;this._originalUniforms=null;this._uniforms=null;this._arrayProxyMap=null;this._originalVertexShader=null;this._originalFragmentShader=null;this.scene=null}}exports.ShaderMaterial=ShaderMaterial;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Shape.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{Vector2}=require("./Vector2");class Shape{constructor(points){this.type="Shape";this.uuid=generateUUID();this.currentPoint=new Vector2;this.curves=[];this.holes=[];if(points!==undefined){this.moveTo(points[0].x,points[0].y);for(let i=1;i<points.length;i++){this.lineTo(points[i].x,points[i].y)}}}moveTo(x,y){this.currentPoint.set(x,y);return this}lineTo(x,y){const line=new LineCurve(this.currentPoint.clone(),new Vector2(x,y));this.curves.push(line);this.currentPoint.set(x,y);return this}quadraticCurveTo(cpX,cpY,x,y){const curve=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(cpX,cpY),new Vector2(x,y));this.curves.push(curve);this.currentPoint.set(x,y);return this}bezierCurveTo(cp1X,cp1Y,cp2X,cp2Y,x,y){const curve=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(cp1X,cp1Y),new Vector2(cp2X,cp2Y),new Vector2(x,y));this.curves.push(curve);this.currentPoint.set(x,y);return this}splineThru(points){const npts=[this.currentPoint.clone()].concat(points);const curve=new SplineCurve(npts);this.curves.push(curve);this.currentPoint.copy(points[points.length-1]);return this}arc(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){const x0=this.currentPoint.x;const y0=this.currentPoint.y;this.absarc(aX+x0,aY+y0,aRadius,aStartAngle,aEndAngle,aClockwise);return this}absarc(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){this.absellipse(aX,aY,aRadius,aRadius,aStartAngle,aEndAngle,aClockwise,0);return this}ellipse(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation){const x0=this.currentPoint.x;const y0=this.currentPoint.y;this.absellipse(aX+x0,aY+y0,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation);return this}absellipse(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation){const curve=new EllipseCurve(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation);if(this.curves.length>0){const firstPoint=curve.getPoint(0);if(!firstPoint.equals(this.currentPoint)){this.lineTo(firstPoint.x,firstPoint.y)}}this.curves.push(curve);const lastPoint=curve.getPoint(1);this.currentPoint.copy(lastPoint);return this}closePath(){if(this.curves.length>0){const firstPoint=this.curves[0].getPoint(0);if(!this.currentPoint.equals(firstPoint)){this.lineTo(firstPoint.x,firstPoint.y)}}return this}getPoints(divisions=12){const points=[];const epsilon=1e-10;for(let i=0;i<this.curves.length;i++){const curve=this.curves[i];const pts=curve.getPoints(divisions);for(let j=0;j<pts.length;j++){const point=pts[j];if(i===0||j>0||(points.length===0||!point.equals(points[points.length-1],epsilon))){points.push(point)}}}return points}extractPoints(divisions){return{shape:this.getPoints(divisions),holes:this.holes.map(hole=>hole.getPoints(divisions))}}translate(x,y){for(let i=0;i<this.curves.length;i++){this.curves[i].translate(x,y)}return this}scale(x,y){for(let i=0;i<this.curves.length;i++){this.curves[i].scale(x,y)}return this}rotate(angle){const cos=Math.cos(angle);const sin=Math.sin(angle);for(let i=0;i<this.curves.length;i++){this.curves[i].rotate(cos,sin)}return this}getBounds(){const points=this.getPoints();let minX=Infinity,minY=Infinity;let maxX=-Infinity,maxY=-Infinity;for(let i=0;i<points.length;i++){const p=points[i];if(p.x<minX)minX=p.x;if(p.x>maxX)maxX=p.x;if(p.y<minY)minY=p.y;if(p.y>maxY)maxY=p.y}return{minX:minX,minY:minY,maxX:maxX,maxY:maxY}}getLengths(divisions=40){if(!this.cacheLengths||this.cacheDivisions!==divisions){const lengths=[];let sum=0;for(let i=0;i<this.curves.length;i++){const curve=this.curves[i];if(curve&&typeof curve.getPoint==="function"){let last=curve.getPoint(0);for(let j=1;j<=divisions;j++){const current=curve.getPoint(j/divisions);const dx=current.x-last.x;const dy=current.y-last.y;sum+=Math.sqrt(dx*dx+dy*dy);lengths.push(sum);last=current}}}this.cacheLengths=lengths;this.cacheDivisions=divisions}return this.cacheLengths}getLength(){const lengths=this.getLengths();return lengths.length>0?lengths[lengths.length-1]:0}getPointAt(u){const t=this.getUtoTmapping(u);return this.getPoint(t)}getUtoTmapping(u){const divisions=this.cacheDivisions||40;const lengths=this.getLengths(divisions);if(u===0)return 0;if(u===1)return 1;const targetLength=u*lengths[lengths.length-1];let low=0;let high=lengths.length-1;let comparison;while(low<=high){const i=Math.floor(low+(high-low)/2);comparison=lengths[i]-targetLength;if(comparison<0){low=i+1}else if(comparison>0){high=i-1}else{high=i;break}}let i=high;if(i<0)i=0;if(i>=lengths.length)i=lengths.length-1;const lengthBefore=i>0?lengths[i-1]:0;const lengthAfter=lengths[i];const segmentLength=lengthAfter-lengthBefore;const segmentFraction=segmentLength===0?0:(targetLength-lengthBefore)/segmentLength;const t=(i+segmentFraction)/(this.curves.length*divisions);return t}getPoint(t){const divisions=this.cacheDivisions||40;const d=t*this.curves.length*divisions;const segmentIndex=Math.floor(d);const segmentT=d-segmentIndex;const curveIndex=Math.floor(segmentIndex/divisions);const divisionIndex=segmentIndex%divisions;const curveT=(divisionIndex+segmentT)/divisions;if(curveIndex<0){return this.curves[0].getPoint(0)}if(curveIndex>=this.curves.length){return this.curves[this.curves.length-1].getPoint(1)}return this.curves[curveIndex].getPoint(curveT)}getSpacedPoints(divisions=5){const points=[];if(this.curves.length===0){return points}for(let i=0;i<=divisions;i++){points.push(this.getPointAt(i/divisions))}return points}dispose(){if(this.curves){for(let i=0;i<this.curves.length;i++){if(this.curves[i]&&typeof this.curves[i].dispose==="function"){this.curves[i].dispose()}this.curves[i]=null}this.curves.length=0;this.curves=null}if(this.holes){for(let i=0;i<this.holes.length;i++){if(this.holes[i]&&typeof this.holes[i].dispose==="function"){this.holes[i].dispose()}this.holes[i]=null}this.holes.length=0;this.holes=null}if(this.cacheLengths){this.cacheLengths.length=0;this.cacheLengths=null}this.cacheDivisions=null;this.currentPoint=null;this.type=null;this.uuid=null}}class LineCurve{constructor(v1,v2){this.v1=v1;this.v2=v2}getPoint(t){const x=this.v1.x+t*(this.v2.x-this.v1.x);const y=this.v1.y+t*(this.v2.y-this.v1.y);return new Vector2(x,y)}getPoints(divisions=1){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}translate(x,y){this.v1.x+=x;this.v1.y+=y;this.v2.x+=x;this.v2.y+=y}scale(x,y){this.v1.x*=x;this.v1.y*=y;this.v2.x*=x;this.v2.y*=y}rotate(cos,sin){let x=this.v1.x,y=this.v1.y;this.v1.x=x*cos-y*sin;this.v1.y=x*sin+y*cos;x=this.v2.x;y=this.v2.y;this.v2.x=x*cos-y*sin;this.v2.y=x*sin+y*cos}getLength(){const dx=this.v2.x-this.v1.x;const dy=this.v2.y-this.v1.y;return Math.sqrt(dx*dx+dy*dy)}}class QuadraticBezierCurve{constructor(v0,v1,v2){this.v0=v0;this.v1=v1;this.v2=v2}getPoint(t){const u=1-t;const tt=t*t;const uu=u*u;const ut2=2*u*t;const x=uu*this.v0.x+ut2*this.v1.x+tt*this.v2.x;const y=uu*this.v0.y+ut2*this.v1.y+tt*this.v2.y;return new Vector2(x,y)}getPoints(divisions=12){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}translate(x,y){this.v0.x+=x;this.v0.y+=y;this.v1.x+=x;this.v1.y+=y;this.v2.x+=x;this.v2.y+=y}scale(x,y){this.v0.x*=x;this.v0.y*=y;this.v1.x*=x;this.v1.y*=y;this.v2.x*=x;this.v2.y*=y}rotate(cos,sin){let x=this.v0.x,y=this.v0.y;this.v0.x=x*cos-y*sin;this.v0.y=x*sin+y*cos;x=this.v1.x;y=this.v1.y;this.v1.x=x*cos-y*sin;this.v1.y=x*sin+y*cos;x=this.v2.x;y=this.v2.y;this.v2.x=x*cos-y*sin;this.v2.y=x*sin+y*cos}getLength(){const divisions=200;let length=0;let lastPoint=this.getPoint(0);for(let i=1;i<=divisions;i++){const point=this.getPoint(i/divisions);const dx=point.x-lastPoint.x;const dy=point.y-lastPoint.y;length+=Math.sqrt(dx*dx+dy*dy);lastPoint=point}return length}}class CubicBezierCurve{constructor(v0,v1,v2,v3){this.v0=v0;this.v1=v1;this.v2=v2;this.v3=v3}getPoint(t){const u=1-t;const tt=t*t;const uu=u*u;const uuu=uu*u;const ttt=tt*t;const x=uuu*this.v0.x+3*uu*t*this.v1.x+3*u*tt*this.v2.x+ttt*this.v3.x;const y=uuu*this.v0.y+3*uu*t*this.v1.y+3*u*tt*this.v2.y+ttt*this.v3.y;return new Vector2(x,y)}getPoints(divisions=12){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}translate(x,y){this.v0.x+=x;this.v0.y+=y;this.v1.x+=x;this.v1.y+=y;this.v2.x+=x;this.v2.y+=y;this.v3.x+=x;this.v3.y+=y}scale(x,y){this.v0.x*=x;this.v0.y*=y;this.v1.x*=x;this.v1.y*=y;this.v2.x*=x;this.v2.y*=y;this.v3.x*=x;this.v3.y*=y}rotate(cos,sin){let x=this.v0.x,y=this.v0.y;this.v0.x=x*cos-y*sin;this.v0.y=x*sin+y*cos;x=this.v1.x;y=this.v1.y;this.v1.x=x*cos-y*sin;this.v1.y=x*sin+y*cos;x=this.v2.x;y=this.v2.y;this.v2.x=x*cos-y*sin;this.v2.y=x*sin+y*cos;x=this.v3.x;y=this.v3.y;this.v3.x=x*cos-y*sin;this.v3.y=x*sin+y*cos}getLength(){const divisions=200;let length=0;let lastPoint=this.getPoint(0);for(let i=1;i<=divisions;i++){const point=this.getPoint(i/divisions);const dx=point.x-lastPoint.x;const dy=point.y-lastPoint.y;length+=Math.sqrt(dx*dx+dy*dy);lastPoint=point}return length}}class SplineCurve{constructor(points){this.points=points}getPoint(t){const points=this.points;const point=(points.length-1)*t;const intPoint=Math.floor(point);const weight=point-intPoint;const p0=points[intPoint===0?intPoint:intPoint-1];const p1=points[intPoint];const p2=points[intPoint>points.length-2?points.length-1:intPoint+1];const p3=points[intPoint>points.length-3?points.length-1:intPoint+2];const x=catmullRom(weight,p0.x,p1.x,p2.x,p3.x);const y=catmullRom(weight,p0.y,p1.y,p2.y,p3.y);return new Vector2(x,y)}getPoints(divisions=12){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}translate(x,y){for(let i=0;i<this.points.length;i++){this.points[i].x+=x;this.points[i].y+=y}}scale(x,y){for(let i=0;i<this.points.length;i++){this.points[i].x*=x;this.points[i].y*=y}}rotate(cos,sin){for(let i=0;i<this.points.length;i++){const x=this.points[i].x;const y=this.points[i].y;this.points[i].x=x*cos-y*sin;this.points[i].y=x*sin+y*cos}}getLength(){const divisions=200;let length=0;let lastPoint=this.getPoint(0);for(let i=1;i<=divisions;i++){const point=this.getPoint(i/divisions);const dx=point.x-lastPoint.x;const dy=point.y-lastPoint.y;length+=Math.sqrt(dx*dx+dy*dy);lastPoint=point}return length}}class EllipseCurve{constructor(aX,aY,xRadius,yRadius,aStartAngle,aEndAngle,aClockwise,aRotation){this.aX=aX;this.aY=aY;this.xRadius=xRadius;this.yRadius=yRadius;this.aStartAngle=aStartAngle;this.aEndAngle=aEndAngle;this.aClockwise=aClockwise!==undefined?aClockwise:false;this.aRotation=aRotation!==undefined?aRotation:0}getPoint(t){const twoPi=Math.PI*2;let deltaAngle=this.aEndAngle-this.aStartAngle;const samePoints=Math.abs(deltaAngle)<Number.EPSILON;while(deltaAngle<0)deltaAngle+=twoPi;while(deltaAngle>twoPi)deltaAngle-=twoPi;if(deltaAngle<Number.EPSILON){if(samePoints){deltaAngle=0}else{deltaAngle=twoPi}}if(this.aClockwise===true&&!samePoints){if(deltaAngle===twoPi){deltaAngle=-twoPi}else{deltaAngle=deltaAngle-twoPi}}const angle=this.aStartAngle+t*deltaAngle;let x=this.aX+this.xRadius*Math.cos(angle);let y=this.aY+this.yRadius*Math.sin(angle);if(this.aRotation!==0){const cos=Math.cos(this.aRotation);const sin=Math.sin(this.aRotation);const tx=x-this.aX;const ty=y-this.aY;x=tx*cos-ty*sin+this.aX;y=tx*sin+ty*cos+this.aY}return new Vector2(x,y)}getPoints(divisions=12){const points=[];for(let i=0;i<=divisions;i++){points.push(this.getPoint(i/divisions))}return points}translate(x,y){this.aX+=x;this.aY+=y}scale(x,y){this.xRadius*=x;this.yRadius*=y;this.aX*=x;this.aY*=y}rotate(cos,sin){const x=this.aX;const y=this.aY;this.aX=x*cos-y*sin;this.aY=x*sin+y*cos;this.aRotation+=Math.atan2(sin,cos)}getLength(){const divisions=200;let length=0;let lastPoint=this.getPoint(0);for(let i=1;i<=divisions;i++){const point=this.getPoint(i/divisions);const dx=point.x-lastPoint.x;const dy=point.y-lastPoint.y;length+=Math.sqrt(dx*dx+dy*dy);lastPoint=point}return length}}function catmullRom(t,p0,p1,p2,p3){const v0=(p2-p0)*.5;const v1=(p3-p1)*.5;const t2=t*t;const t3=t*t2;return(2*p1-2*p2+v0+v1)*t3+(-3*p1+3*p2-2*v0-v1)*t2+v0*t+p1}function generateUUID(){const chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");const uuid=new Array(36);let rnd=0;for(let i=0;i<36;i++){if(i===8||i===13||i===18||i===23){uuid[i]="-"}else if(i===14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;const r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i===19?r&3|8:r]}}return uuid.join("")}exports.Shape=Shape;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/ShapeGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{BufferGeometry}=require("./BufferGeometry");const{BufferAttribute}=require("./BufferAttribute");const{earcut}=require("./Earcut");const{Vector2}=require("./Vector2");const{Vector3}=require("./Vector3");const{Box3}=require("./Box3");class ShapeGeometry extends BufferGeometry{constructor(shapes,curveSegments=12){super();this.type="ShapeGeometry";this.parameters={shapes:shapes,curveSegments:curveSegments};const shapesArray=Array.isArray(shapes)?shapes:[shapes];const vertices=[];const indices=[];const uvs=[];const groups=[];let groupStart=0;let groupCount=0;for(let i=0;i<shapesArray.length;i++){const shape=shapesArray[i];const{shape:shapePoints,holes:holePoints}=shape.extractPoints(curveSegments);const triangulationData=prepareTriangulationData(shapePoints,holePoints);if(triangulationData){const{flatVertices,holeIndices,vertexCount}=triangulationData;const triangleIndices=earcut(flatVertices,holeIndices,2);if(triangleIndices&&triangleIndices.length>0){const bounds=calculateBounds(flatVertices);const vertexOffset=vertices.length/3;for(let j=0;j<vertexCount;j++){const x=flatVertices[j*2];const y=flatVertices[j*2+1];vertices.push(x,y,0);const u=(x-bounds.minX)/(bounds.maxX-bounds.minX);const v=(y-bounds.minY)/(bounds.maxY-bounds.minY);uvs.push(u,v)}for(let j=0;j<triangleIndices.length;j++){indices.push(triangleIndices[j]+vertexOffset)}groupCount=triangleIndices.length;groups.push({start:groupStart,count:groupCount,materialIndex:i});groupStart+=groupCount}}}if(vertices.length>0){this.setAttribute("position",new BufferAttribute(new Float32Array(vertices),3));this.setAttribute("uv",new BufferAttribute(new Float32Array(uvs),2));if(indices.length>0){this.setIndex(indices)}this.updateAMGObject(vertices,indices,uvs)}this.groups=groups}updateAMGObject(vertices,indices,uvs){if(!this._amgObject||!this._amgObject.submeshes)return;try{const submesh=this._amgObject.submeshes.get(0);if(!submesh)return;submesh.primitive=effect.Amaz.Primitive.TRIANGLES;const vertexCount=vertices.length/3;const vertexArray=new effect.Amaz.Vec3Vector;for(let i=0;i<vertexCount;i++){const v=new effect.Amaz.Vector3f(vertices[i*3],vertices[i*3+1],vertices[i*3+2]);vertexArray.pushBack(v)}const buffer=new effect.Amaz.FloatVector;for(let i=0;i<vertexCount;i++){buffer.pushBack(vertices[i*3]);buffer.pushBack(vertices[i*3+1]);buffer.pushBack(vertices[i*3+2])}this._amgObject.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,vertexCount);const uvArray=new effect.Amaz.Vec2Vector;for(let i=0;i<vertexCount;i++){const uv=new effect.Amaz.Vector2f(uvs[i*2],uvs[i*2+1]);uvArray.pushBack(uv)}this._amgObject.setUvArray(0,uvArray);if(indices.length>0){const indexArray=new effect.Amaz.UInt16Vector;for(let i=0;i<indices.length;i++){indexArray.pushBack(indices[i])}submesh.indices16=indexArray;submesh.indicesCount=indices.length;submesh.primitive=effect.Amaz.Primitive.TRIANGLES}}catch(e){console.warn("ShapeGeometry: 更新 AMG 对象失败",e)}}addShape(shape,curveSegments=1){console.warn("ShapeGeometry.addShape: 暂未实现动态添加形状功能")}center(){const positionAttribute=this.attributes.position;if(!positionAttribute)return this;const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}const centerX=(minX+maxX)/2;const centerY=(minY+maxY)/2;const centerZ=(minZ+maxZ)/2;for(let i=0;i<positions.length;i+=3){positions[i]-=centerX;positions[i+1]-=centerY;positions[i+2]-=centerZ}if(this._amgObject){const vertexCount=positions.length/3;const buffer=new effect.Amaz.FloatVector;for(let i=0;i<vertexCount;i++){buffer.pushBack(positions[i*3]);buffer.pushBack(positions[i*3+1]);buffer.pushBack(positions[i*3+2])}this._amgObject.setAttributeData(effect.Amaz.VertexAttribType.POSITION,buffer,0,vertexCount)}return this}computeBoundingBox(){const positionAttribute=this.attributes.position;if(!positionAttribute){this.boundingBox=new Box3(new Vector3(0,0,0),new Vector3(0,0,0));return}const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}this.boundingBox=new Box3(new Vector3(minX,minY,minZ),new Vector3(maxX,maxY,maxZ))}computeBoundingSphere(){const positionAttribute=this.attributes.position;if(!positionAttribute){this.boundingSphere={center:{x:0,y:0,z:0},radius:0};return}const positions=positionAttribute.array;let minX=Infinity,minY=Infinity,minZ=Infinity;let maxX=-Infinity,maxY=-Infinity,maxZ=-Infinity;for(let i=0;i<positions.length;i+=3){const x=positions[i];const y=positions[i+1];const z=positions[i+2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}const centerX=(minX+maxX)/2;const centerY=(minY+maxY)/2;const centerZ=(minZ+maxZ)/2;let maxRadiusSq=0;for(let i=0;i<positions.length;i+=3){const dx=positions[i]-centerX;const dy=positions[i+1]-centerY;const dz=positions[i+2]-centerZ;const distSq=dx*dx+dy*dy+dz*dz;if(distSq>maxRadiusSq)maxRadiusSq=distSq}this.boundingSphere={center:{x:centerX,y:centerY,z:centerZ},radius:Math.sqrt(maxRadiusSq)}}dispose(){if(this.groups){this.groups.length=0;this.groups=null}this.parameters=null;super.dispose()}}function prepareTriangulationData(shapePoints,holePoints){if(!shapePoints||shapePoints.length<3){console.warn("ShapeGeometry: 形状点数量不足");return null}const flatVertices=[];const holeIndices=[];for(let i=0;i<shapePoints.length;i++){flatVertices.push(shapePoints[i].x,shapePoints[i].y)}let vertexCount=shapePoints.length;if(holePoints&&holePoints.length>0){for(let i=0;i<holePoints.length;i++){const hole=holePoints[i];if(hole&&hole.length>0){holeIndices.push(vertexCount);for(let j=0;j<hole.length;j++){flatVertices.push(hole[j].x,hole[j].y);vertexCount++}}}}return{flatVertices:flatVertices,holeIndices:holeIndices.length>0?holeIndices:null,vertexCount:vertexCount}}function calculateBounds(vertices){let minX=Infinity,minY=Infinity;let maxX=-Infinity,maxY=-Infinity;for(let i=0;i<vertices.length;i+=2){const x=vertices[i];const y=vertices[i+1];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y}if(maxX===minX)maxX=minX+1;if(maxY===minY)maxY=minY+1;return{minX:minX,minY:minY,maxX:maxX,maxY:maxY}}exports.ShapeGeometry=ShapeGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/SphereGeometry.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const{getCurrentScene}=require("./runtime");const{BufferGeometry}=require("./BufferGeometry");const{BufferAttribute}=require("./BufferAttribute");class SphereGeometry extends BufferGeometry{constructor(radius=1,widthSegments=8,heightSegments=6){super();const scene=getCurrentScene();if(scene){this._amgObject=scene._amgScene.assetMgr.SyncLoad("mesh/Sphere.mesh")}this.width=radius;this.height=radius;this.depth=radius;const vertexCount=(widthSegments+1)*(heightSegments+1);const vertices=new Float32Array(vertexCount*3);const uvs=new Float32Array(vertexCount*2);this.initAttribute("position",new BufferAttribute(vertices,3));this.initAttribute("uv",new BufferAttribute(uvs,2));this.scale(this.width,this.height,this.depth)}}exports.SphereGeometry=SphereGeometry;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Texture.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const{getCurrentScene}=require("./runtime");const Vector2=require("./Vector2").Vector2;const __THREE_CONSTS=require("./Constants");class Texture{constructor(){this._amgObject=null;this._materials=[];this.repeat=new Vector2(1,1);this.offset=new Vector2(0,0);this.center=new Vector2(.5,.5);this.rotation=0;this._setupListeners();this._wrapS=__THREE_CONSTS.ClampToEdgeWrapping;Object.defineProperty(this,"wrapS",{get:()=>this._wrapS,set:value=>{this._wrapS=value;if(this._amgObject!==undefined){if(value==__THREE_CONSTS.RepeatWrapping){this._amgObject.wrapModeS=Amaz.WrapMode.REPEAT}else if(value==__THREE_CONSTS.ClampToEdgeWrapping){this._amgObject.wrapModeS=Amaz.WrapMode.CLAMP}else if(value==__THREE_CONSTS.MirroredRepeatWrapping){this._amgObject.wrapModeS=Amaz.WrapMode.Mirror}}},enumerable:true,configurable:true});this._wrapT=__THREE_CONSTS.ClampToEdgeWrapping;Object.defineProperty(this,"wrapT",{get:()=>this._wrapT,set:value=>{this._wrapT=value;if(this._amgObject!==undefined){if(value==__THREE_CONSTS.RepeatWrapping){this._amgObject.wrapModeT=Amaz.WrapMode.REPEAT}else if(value==__THREE_CONSTS.ClampToEdgeWrapping){this._amgObject.wrapModeT=Amaz.WrapMode.CLAMP}else if(value==__THREE_CONSTS.MirroredRepeatWrapping){this._amgObject.wrapModeT=Amaz.WrapMode.Mirror}}},enumerable:true,configurable:true})}setImage(image){this._amgObject=image;this.image=image;this.wrapS=this._wrapS;this.wrapT=this._wrapT}clone(){const cloned=new Texture;cloned._amgObject=this._amgObject;cloned.repeat.set(this.repeat.x,this.repeat.y);cloned.offset.set(this.offset.x,this.offset.y);return cloned}dispose(){this._amgObject=null;this.image=null;this._materials=[]}_addMaterial(material){if(!this._materials.includes(material))this._materials.push(material)}_removeMaterial(material){const i=this._materials.indexOf(material);if(i>-1)this._materials.splice(i,1)}_setupListeners(){this.repeat=new Proxy(this.repeat,{set:(target,property,value)=>{target[property]=value;this._notifyMaterials();return true}});this.offset=new Proxy(this.offset,{set:(target,property,value)=>{target[property]=value;this._notifyMaterials();return true}});const originalRepeatSet=this.repeat.set.bind(this.repeat);this.repeat.set=(x,y)=>{const r=originalRepeatSet(x,y);this._notifyMaterials();return r};const originalOffsetSet=this.offset.set.bind(this.offset);this.offset.set=(x,y)=>{const r=originalOffsetSet(x,y);this._notifyMaterials();return r}}_notifyMaterials(){this._materials.forEach(m=>{if(m._updateTextureParams)m._updateTextureParams()})}}class VideoTexture extends Texture{constructor(path,loop,playbackRate){super();this.path=path;this.loop=loop;this.playbackRate=playbackRate}clone(){const cloned=new VideoTexture(this.path,this.loop,this.playbackRate);cloned._amgObject=this._amgObject;cloned.repeat.set(this.repeat.x,this.repeat.y);cloned.offset.set(this.offset.x,this.offset.y);return cloned}load(){const amgScene=getCurrentScene()._amgScene;this._amgEntity=new Amaz.Entity;this._amgEntity.name="VideoTextureEntity";this._amgEntity.scene=amgScene;this._transform=this._amgEntity.addComponent("Transform");this._amgVideoAnimSeq=this._amgEntity.addComponent("VideoAnimSeq");this._amgVideoAnimSeq.videoFilename=this.path;this._amgVideoAnimSeq.texName="_MainTex";this._amgVideoAnimSeq.playmode=this.loop?Amaz.PlayMode.loop:Amaz.PlayMode.once;this._amgVideoAnimSeq.speed=this.playbackRate;this._amgVideoAnimSeq.autoplay=true;this._amgVideoAnimSeq.enableAlphaBlend=false;this._amgVideoAnimSeq.enableFixedSeekMode=true;this._amgSprite2DRenderer=this._amgEntity.addComponent("Sprite2DRenderer");this._amgSprite2DRenderer.enabled=false;amgScene.addEntity(this._amgEntity)}dispose(){this._amgEntity=null;this._amgVideoAnimSeq=null;this._amgSprite2DRenderer=null}}class TextureLoader{constructor(){}load(url,onLoad,onProgress,onError){const texture=new Texture;const assetMgr=getCurrentScene()._amgScene.assetMgr;texture.setImage(assetMgr.SyncLoad(url));if(onLoad!==undefined)onLoad(texture);return texture}}exports.Texture=Texture;exports.VideoTexture=VideoTexture;exports.TextureLoader=TextureLoader;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector2.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;class Vector2{constructor(x=0,y=0){this.x=x;this.y=y}set(x,y){this.x=x;this.y=y;return this}toAMGVector2(){return new Amaz.Vector2f(this.x,this.y)}copy(v){this.x=v.x;this.y=v.y;return this}lerpVectors(vec1,vec2,t){this.x=vec1.x+(vec2.x-vec1.x)*t;this.y=vec1.y+(vec2.y-vec1.y)*t;return this}clone(){return new Vector2(this.x,this.y)}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){const length=this.length();if(length>0){this.x/=length;this.y/=length}return this}subScalar(s){this.x-=s;this.y-=s;return this}addScalar(s){this.x+=s;this.y+=s;return this}multiplyScalar(s){this.x*=s;this.y*=s;return this}divideScalar(s){this.x/=s;this.y/=s;return this}distanceTo(v){const dx=this.x-v.x;const dy=this.y-v.y;return Math.sqrt(dx*dx+dy*dy)}equals(v,epsilon=Number.EPSILON){return Math.abs(this.x-v.x)<epsilon&&Math.abs(this.y-v.y)<epsilon}}exports.Vector2=Vector2;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector3.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;const Quaternion=require("./Quaternion").Quaternion;class Vector3{constructor(x=0,y=0,z=0){this.x=x;this.y=y;this.z=z}set(x,y,z){this.x=x;this.y=y;this.z=z;return this}clone(){return new Vector3(this.x,this.y,this.z)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}addScaledVector(v,s){this.x+=v.x*s;this.y+=v.y*s;this.z+=v.z*s;return this}divideScalar(scalar){this.x/=scalar;this.y/=scalar;this.z/=scalar;return this}normalize(){const length=this.length();if(length>0){this.x/=length;this.y/=length;this.z/=length}return this}multiplyScalar(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;return this}add(v){this.x+=v.x;this.y+=v.y;this.z+=v.z;return this}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z}cross(v,target){const ax=this.x,ay=this.y,az=this.z;const bx=v.x,by=v.y,bz=v.z;if(target){target.x=ay*bz-az*by;target.y=az*bx-ax*bz;target.z=ax*by-ay*bx;return target}else{this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this}}sub(v){this.x-=v.x;this.y-=v.y;this.z-=v.z;return this}copy(v){this.x=v.x;this.y=v.y;this.z=v.z;return this}lerp(v,t){this.x=this.x+(v.x-this.x)*t;this.y=this.y+(v.y-this.y)*t;this.z=this.z+(v.z-this.z)*t;return this}lerpVectors(vec1,vec2,t){this.x=vec1.x+(vec2.x-vec1.x)*t;this.y=vec1.y+(vec2.y-vec1.y)*t;this.z=vec1.z+(vec2.z-vec1.z)*t;return this}applyQuaternion(quat){const qx=quat.x;const qy=quat.y;const qz=quat.z;const qw=quat.w;const vx=this.x;const vy=this.y;const vz=this.z;const x=(qw*qw+qx*qx-qy*qy-qz*qz)*vx+2*(qx*qy-qw*qz)*vy+2*(qx*qz+qw*qy)*vz;const y=2*(qx*qy+qw*qz)*vx+(qw*qw-qx*qx+qy*qy-qz*qz)*vy+2*(qy*qz-qw*qx)*vz;const z=2*(qx*qz-qw*qy)*vx+2*(qy*qz+qw*qx)*vy+(qw*qw-qx*qx-qy*qy+qz*qz)*vz;this.x=x;this.y=y;this.z=z;return this}applyMatrix4(matrix){const e=matrix.elements;const x=this.x,y=this.y,z=this.z;const w=e[3]*x+e[7]*y+e[11]*z+e[15];this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];if(w!==1&&w!==0){this.x/=w;this.y/=w;this.z/=w}return this}applyAxisAngle(vector,angle){const axis=vector.clone().normalize();const q=(new Quaternion).setFromAxisAngle(axis,angle);this.applyQuaternion(q);return this}applyEuler(euler){const q=(new Quaternion).setFromEuler(euler);this.applyQuaternion(q);return this}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this}subScalar(s){this.x-=s;this.y-=s;this.z-=s;return this}addScalar(s){this.x+=s;this.y+=s;this.z+=s;return this}toAMGVector3(){return new Amaz.Vector3f(this.x,this.y,this.z)}multiplyScalar(s){this.x*=s;this.y*=s;this.z*=s;return this}divideScalar(s){this.x/=s;this.y/=s;this.z/=s;return this}min(v){this.x=Math.min(this.x,v.x);this.y=Math.min(this.y,v.y);this.z=Math.min(this.z,v.z);return this}max(v){this.x=Math.max(this.x,v.x);this.y=Math.max(this.y,v.y);this.z=Math.max(this.z,v.z);return this}distanceTo(v){const dx=this.x-v.x;const dy=this.y-v.y;const dz=this.z-v.z;return Math.sqrt(dx*dx+dy*dy+dz*dz)}equals(v,epsilon=Number.EPSILON){return Math.abs(this.x-v.x)<epsilon&&Math.abs(this.y-v.y)<epsilon&&Math.abs(this.z-v.z)<epsilon}}exports.Vector3=Vector3;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/Vector4.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const effect_api=typeof effect!=="undefined"?effect:typeof tt!=="undefined"?tt:typeof lynx!=="undefined"?lynx:{};const Amaz=effect_api.getAmaz?effect_api.getAmaz():null;class Vector4{constructor(x=0,y=0,z=0,w=0){this.x=x;this.y=y;this.z=z;this.w=w}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this}clone(){return new Vector4(this.x,this.y,this.z,this.w)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}normalize(){const length=this.length();if(length>0){this.x/=length;this.y/=length;this.z/=length;this.w/=length}return this}multiplyScalar(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;this.w*=scalar;return this}add(v){this.x+=v.x;this.y+=v.y;this.z+=v.z;this.w+=v.w;return this}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.w}sub(v){this.x-=v.x;this.y-=v.y;this.z-=v.z;this.w-=v.w;return this}copy(v){this.x=v.x;this.y=v.y;this.z=v.z;this.w=v.w;return this}subScalar(s){this.x-=s;this.y-=s;this.z-=s;this.w-=s;return this}addScalar(s){this.x+=s;this.y+=s;this.z+=s;this.w+=s;return this}multiplyScalar(s){this.x*=s;this.y*=s;this.z*=s;this.w*=s;return this}divideScalar(s){this.x/=s;this.y/=s;this.z/=s;this.w/=s;return this}equals(v,epsilon=Number.EPSILON){return Math.abs(this.x-v.x)<epsilon&&Math.abs(this.y-v.y)<epsilon&&Math.abs(this.z-v.z)<epsilon&&Math.abs(this.w-v.w)<epsilon}toAMGVector4(){return new Amaz.Vector4f(this.x,this.y,this.z,this.w)}}exports.Vector4=Vector4;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/WebGLRenderer.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const Color=require("./Color").Color;class WebGLRenderer{constructor(parameters={}){this.width=parameters.width||800;this.height=parameters.height||600;this.antialias=parameters.antialias||false;this.pixelRatio=1;this.domElement=document.createElement("div");this.domElement.style.width=this.width+"px";this.domElement.style.height=this.height+"px";console.log("AMG renderer initialized, size:",this.width,"x",this.height)}setAnimationLoop(callback){console.log("WebGLRenderer.setAnimationLoop: empty implementation")}setSize(width,height){this.width=width;this.height=height;this.domElement.style.width=width+"px";this.domElement.style.height=height+"px";effect.Amaz.AmazingManager.resize(width,height)}setPixelRatio(ratio){this.pixelRatio=ratio}render(scene,camera){const amgScene=scene._amgScene}setClearColor(color,alpha=1){const amgColor=color instanceof Color?color.toAMGColor():(new Color).setHex(color).toAMGColor();amgColor.w=alpha}dispose(){console.log("WebGLRenderer.dispose: empty implementation")}}exports.WebGLRenderer=WebGLRenderer;
scripts/7681165424754429202/AmazingFeature/js/ThreeJS/wrapper/runtime.js ADDED
@@ -0,0 +1 @@
 
 
1
+ let currentScene=null;function getCurrentScene(){if(!currentScene){console.warn("Scene实例尚未创建")}return currentScene}function setCurrentScene(scene){currentScene=scene}function clearCurrentScene(){currentScene=null}exports.getCurrentScene=getCurrentScene;exports.setCurrentScene=setCurrentScene;exports.clearCurrentScene=clearCurrentScene;
scripts/7681165424754429202/AmazingFeature/xshader/Unlit.frag ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ precision highp float;
2
+ uniform sampler2D u_AlbedoTexture;
3
+ uniform vec4 u_AlbedoColor;
4
+ uniform vec2 u_Repeat;
5
+ uniform vec2 u_Offset;
6
+ uniform float u_Translucency;
7
+ uniform float u_Opacity;
8
+ varying vec2 g_vary_uv0;
9
+ void main ()
10
+ {
11
+ vec2 uv_1;
12
+ uv_1.x = g_vary_uv0.x;
13
+ uv_1.y = (g_vary_uv0.y);
14
+ lowp vec4 tmpvar_2;
15
+ tmpvar_2 = texture2D (u_AlbedoTexture, (uv_1 * u_Repeat + u_Offset));
16
+ lowp vec3 tmpvar_3;
17
+ tmpvar_3 = (tmpvar_2.xyz * u_AlbedoColor.xyz);
18
+ lowp float tmpvar_4;
19
+ tmpvar_4 = (tmpvar_2.w * u_Translucency);
20
+ mediump vec4 tmpvar_5;
21
+ tmpvar_5.xyz = tmpvar_3;
22
+ tmpvar_5.w = tmpvar_4;
23
+ gl_FragColor = vec4(tmpvar_5.xyz * u_Opacity, tmpvar_5.w * u_Opacity);
24
+ }
25
+
scripts/7681165424754429202/AmazingFeature/xshader/Unlit.vert ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ precision highp float;
2
+ attribute vec3 attPosition;
3
+ attribute vec2 attTexcoord0;
4
+
5
+ //#define AMAZING_USE_BONES
6
+
7
+ #ifdef AMAZING_USE_BONES
8
+ attribute vec4 attBoneIds;
9
+ attribute vec4 attWeights;
10
+ const int MAX_BONES = 50;
11
+ uniform mat4 u_Palatte[MAX_BONES];
12
+ #endif
13
+
14
+ uniform mat4 u_Model;
15
+ uniform mat4 u_MVP;
16
+ varying vec2 g_vary_uv0;
17
+
18
+
19
+
20
+ void main ()
21
+ {
22
+ vec3 modelPostiton = attPosition;
23
+ vec4 homogeneous_pos = vec4(attPosition, 1.0);
24
+ g_vary_uv0 = attTexcoord0;
25
+
26
+ #ifdef AMAZING_USE_BONES
27
+ mat4 boneTransform = u_Palatte[int(attBoneIds.x)] * attWeights.x;
28
+ boneTransform += u_Palatte[int(attBoneIds.y)] * attWeights.y;
29
+ boneTransform += u_Palatte[int(attBoneIds.z)] * attWeights.z;
30
+ boneTransform += u_Palatte[int(attBoneIds.w)] * attWeights.w;
31
+ gl_Position = u_MVP * boneTransform * homogeneous_pos;
32
+ #else
33
+ gl_Position = u_MVP * homogeneous_pos;
34
+ #endif
35
+ }
scripts/7681165424754429202/AmazingFeature/xshader/noface.frag ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ precision lowp float;
2
+ varying highp vec2 uv0;
3
+ uniform sampler2D u_albedo;
4
+ void main()
5
+ {
6
+ gl_FragColor = texture2D(u_albedo, uv0);
7
+ }