tianhaobu 3 месяцев назад
Родитель
Сommit
2efa1fbea8

+ 17 - 9
objects/oInGameManager/Create_0.gml

@@ -23,12 +23,20 @@ global.target_room = noone;
 var _camera = view_camera[0];
 // 2. 初始化 Bulb 渲染器
 global.bulb_renderer = new BulbRenderer(_camera);
-// 3. 配置环境光 (根据截图中的变量列表)
-// .ambientColor: 设置环境光颜色 (c_black = 全黑, c_dkgray = 昏暗)
-global.bulb_renderer.ambientColor = c_dkgray;
-// 4. 配置阴影质量 (可选)
-// .smooth: 是否使用双线性过滤 (默认 true)
-global.bulb_renderer.smooth = true;
-// .soft: 是否使用软阴影 (默认 true)
-global.bulb_renderer.soft = true;
-application_surface_draw_enable(false);
+
+// 1. 环境光:不要死黑,但要足够暗才有“染色”感
+global.bulb_renderer.ambientColor = c_dkgray; 
+
+// 2. 伽马空间校正 (关键!)
+// 如果你的素材是在普通绘图软件里画的,设为 true 可以让色彩过渡更自然,减少“雾感”
+global.bulb_renderer.ambientInGammaSpace = true;
+
+// 3. 开启 HDR 和 曝光
+// 开启 HDR 会允许光照强度超过 1.0,从而产生那种“发光”的质感
+global.bulb_renderer.hdr = true;
+global.bulb_renderer.exposure = 1.2; // 调整整体亮度
+
+// 4. 开启 Bloom (辉光)
+// 这是消除“贴纸感”的神器,让光线看起来像是在空气中散开
+global.bulb_renderer.hdrBloomIntensity = 0.5;
+global.bulb_renderer.hdrBloomThresholdMin = 0.6; // 只有够亮的地方才会发光

+ 5 - 5
objects/oInGameManager/Draw_77.gml

@@ -1,9 +1,9 @@
 
 // rendering
 // 获取应用表面的宽高
-var _surf_w = surface_get_width(application_surface);
-var _surf_h = surface_get_height(application_surface);
+var _sw = surface_get_width(application_surface);
+var _sh = surface_get_height(application_surface);
 
-// 将光照渲染到应用表面上
-// 参数解析:(targetSurface, x, y, width, height, [textureFiltering], [alphaBlend])
-global.bulb_renderer.DrawLitSurface(application_surface, 0, 0, _surf_w, _surf_h);
+// 参数:素材, x, y, 宽, 高, [抗锯齿], [Alpha混合]
+// 开启抗锯齿 (true) 可以让光照边缘更平滑
+global.bulb_renderer.DrawLitSurface(application_surface, 0, 0, _sw, _sh, true, false);

+ 9 - 0
objects/oLight/CleanUp_0.gml

@@ -0,0 +1,9 @@
+/// oLight Clean Up Event
+
+// 如果结构体还没被清理
+if (variable_instance_exists(id, "light_struct") && light_struct != undefined) {
+    // 大多数 Bulb 版本不需要手动调用 destroy,因为它们使用弱引用自动清理
+    // 但为了 100% 的鲁棒性,如果有 .Free() 或 .Destroy() 方法,请调用它
+    // 简单做法:直接设为 undefined,Bulb 的垃圾回收机制通常会处理掉它
+    light_struct = undefined;
+}

+ 15 - 5
objects/oLight/Create_0.gml

@@ -1,6 +1,16 @@
-my_light = new BulbLight(global.bulb_renderer, sLightCookie, 0, x, y);
-my_light.color = c_orange; // 注意检查属性名是否也是驼峰 (color vs blend)
-my_light.penumbraSize = 30; // 半影大小(软阴影)
+light_struct = new BulbLight(global.bulb_renderer, sLightCookie, 0, x, y);
 
-my_light.x = x;
-my_light.y = y;
+// 1. 颜色:使用高饱和度颜色进行染色
+light_struct.blend = c_white; 
+
+// 2. 软阴影:这是消除“贴纸感”的核心
+// 这个值越大,阴影边缘越模糊,光照看起来越真实
+light_struct.soft = true;
+light_struct.penumbraSize = 64; 
+
+// 3. 强度:开启 HDR 后,可以将 alpha 设得略高
+light_struct.alpha = 1.5; 
+
+// 4. 自身光照 (Self Lighting)
+// 设置为 false,光照不会照亮“遮挡物”内部,这能增加深度感
+light_struct.selfLighting = false;

+ 12 - 0
objects/oLight/Step_0.gml

@@ -0,0 +1,12 @@
+/// oLight Step Event
+
+// 确保结构体存在 (防止报错)
+if (light_struct != undefined) {
+    light_struct.x = x;
+    light_struct.y = y;
+    
+    // 如果你想做“呼吸灯”效果,可以在这里动态修改 alpha
+    // light_struct.alpha = 0.8 + sin(current_time / 200) * 0.2;
+}
+x = global.player.x
+y = global.player.y-64

+ 7 - 2
objects/oLight/oLight.yy

@@ -3,6 +3,8 @@
   "%Name":"oLight",
   "eventList":[
     {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
+    {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
+    {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":12,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
   ],
   "managed":true,
   "name":"oLight",
@@ -29,7 +31,10 @@
   "resourceType":"GMObject",
   "resourceVersion":"2.0",
   "solid":false,
-  "spriteId":null,
+  "spriteId":{
+    "name":"sLightCookie",
+    "path":"sprites/sLightCookie/sLightCookie.yy",
+  },
   "spriteMaskId":null,
-  "visible":true,
+  "visible":false,
 }

+ 1 - 0
objects/oMain/Create_0.gml

@@ -42,3 +42,4 @@ global.developer_mode = true;
 // save file
 global.save_data = {};
 global.save_filename = "ddmyx_save.dat";
+application_surface_draw_enable(false);

+ 28 - 0
rooms/rTest_2/rTest_2.yy

@@ -415,6 +415,20 @@
     {"name":"inst_1BFB78B","path":"rooms/rTest_2/rTest_2.yy",},
     {"name":"inst_2B4CE3D8","path":"rooms/rTest_2/rTest_2.yy",},
     {"name":"inst_72D10E65","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_2DEB5241","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_76EA917C","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_5E523AE4","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_33396788","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_12DF5456","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_5EE7B2A6","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_525D71B9","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_415CAA67","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_289BB828","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_56829197","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_2EEE7A94","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_22DC81BE","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_53FEE36C","path":"rooms/rTest_2/rTest_2.yy",},
+    {"name":"inst_40F8F49B","path":"rooms/rTest_2/rTest_2.yy",},
   ],
   "isDnd":false,
   "layers":[
@@ -846,6 +860,20 @@
         {"$GMRInstance":"v4","%Name":"inst_1BFB78B","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_1BFB78B","objectId":{"name":"oBlockSlippery","path":"objects/oBlockSlippery/oBlockSlippery.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1120.0,"y":1184.0,},
         {"$GMRInstance":"v4","%Name":"inst_2B4CE3D8","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_2B4CE3D8","objectId":{"name":"oBlockSlippery","path":"objects/oBlockSlippery/oBlockSlippery.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1248.0,"y":1120.0,},
         {"$GMRInstance":"v4","%Name":"inst_72D10E65","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_72D10E65","objectId":{"name":"oBossHex","path":"objects/oBossHex/oBossHex.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":672.0,"y":896.0,},
+        {"$GMRInstance":"v4","%Name":"inst_2DEB5241","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_2DEB5241","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1088.0,"y":768.0,},
+        {"$GMRInstance":"v4","%Name":"inst_76EA917C","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_76EA917C","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1120.0,"y":1376.0,},
+        {"$GMRInstance":"v4","%Name":"inst_5E523AE4","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_5E523AE4","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":544.0,"y":1344.0,},
+        {"$GMRInstance":"v4","%Name":"inst_33396788","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_33396788","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":768.0,"y":1408.0,},
+        {"$GMRInstance":"v4","%Name":"inst_12DF5456","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_12DF5456","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1312.0,"y":1312.0,},
+        {"$GMRInstance":"v4","%Name":"inst_5EE7B2A6","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_5EE7B2A6","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1856.0,"y":1344.0,},
+        {"$GMRInstance":"v4","%Name":"inst_525D71B9","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_525D71B9","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2048.0,"y":1312.0,},
+        {"$GMRInstance":"v4","%Name":"inst_415CAA67","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_415CAA67","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2336.0,"y":1344.0,},
+        {"$GMRInstance":"v4","%Name":"inst_289BB828","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_289BB828","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2720.0,"y":1376.0,},
+        {"$GMRInstance":"v4","%Name":"inst_56829197","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_56829197","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2240.0,"y":1024.0,},
+        {"$GMRInstance":"v4","%Name":"inst_2EEE7A94","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_2EEE7A94","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2592.0,"y":1088.0,},
+        {"$GMRInstance":"v4","%Name":"inst_22DC81BE","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_22DC81BE","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2240.0,"y":800.0,},
+        {"$GMRInstance":"v4","%Name":"inst_53FEE36C","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":true,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_53FEE36C","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":2528.0,"y":864.0,},
+        {"$GMRInstance":"v4","%Name":"inst_40F8F49B","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_40F8F49B","objectId":{"name":"oLight","path":"objects/oLight/oLight.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":1248.0,"y":1376.0,},
       ],"layers":[],"name":"Instances","properties":[],"resourceType":"GMRInstanceLayer","resourceVersion":"2.0","userdefinedDepth":false,"visible":true,},
     {"$GMREffectLayer":"","%Name":"Effect","depth":100,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"name":"Effect","properties":[],"resourceType":"GMREffectLayer","resourceVersion":"2.0","userdefinedDepth":false,"visible":true,},
     {"$GMRBackgroundLayer":"","%Name":"Background","animationFPS":15.0,"animationSpeedType":0,"colour":4294967295,"depth":200,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"hspeed":0.0,"htiled":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"name":"Background","properties":[],"resourceType":"GMRBackgroundLayer","resourceVersion":"2.0","spriteId":null,"stretch":false,"userdefinedAnimFPS":false,"userdefinedDepth":false,"visible":true,"vspeed":0.0,"vtiled":false,"x":0,"y":0,},

+ 23 - 4
sprites/sLightCookie/sLightCookie.yy

@@ -22,8 +22,27 @@
     {"$GMImageLayer":"","%Name":"fb9b7d7f-a6fc-47e9-b3a6-806f718c1c3d","blendMode":0,"displayName":"default","isLocked":false,"name":"fb9b7d7f-a6fc-47e9-b3a6-806f718c1c3d","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
   ],
   "name":"sLightCookie",
-  "nineSlice":null,
-  "origin":0,
+  "nineSlice":{
+    "$GMNineSliceData":"",
+    "bottom":0,
+    "enabled":false,
+    "guideColour":[4294902015,4294902015,4294902015,4294902015,],
+    "highlightColour":1728023040,
+    "highlightStyle":0,
+    "left":0,
+    "resourceType":"GMNineSliceData",
+    "resourceVersion":"2.0",
+    "right":0,
+    "tileMode":[
+      0,
+      0,
+      0,
+      0,
+      0,
+    ],
+    "top":0,
+  },
+  "origin":4,
   "parent":{
     "name":"ddmyx",
     "path":"ddmyx.yyp",
@@ -75,8 +94,8 @@
     ],
     "visibleRange":null,
     "volume":1.0,
-    "xorigin":0,
-    "yorigin":0,
+    "xorigin":256,
+    "yorigin":256,
   },
   "swatchColours":null,
   "swfPrecision":0.5,