Compare commits

...
263 Commits
Author SHA1 Message Date
Jiaqi Liu 8f540025b0 Disable multi-threaded rendering for iOS and Android 2023-03-14 19:31:35 -07:00
Jackie Liu d52ef620a7 v0.45 2023-03-14 19:27:27 -07:00
Jackie Liu 07039886ae Minor tweaks 2023-03-14 18:51:18 -07:00
Jiaqi Liu 401185a2cc Implement Paperweight + PaperweightDesk with bug fixes
also properly implement DoorObject for PAL3A
2023-03-14 18:26:07 -07:00
Jackie Liu 9439c01107 Fix an edge case of LiftingPlatformObject 2023-03-14 02:53:21 -07:00
Jackie Liu bc7a68b979 Proper implementation of RoadElevatorOrBlocker for PAL3A 2023-03-14 02:44:36 -07:00
Jackie Liu 2d0af700a2 Implement PAL3A WaterSurface 2023-03-14 02:23:25 -07:00
Jackie Liu 373810692d Minor fixes 2023-03-14 01:36:02 -07:00
Jackie Liu ff13300bcd Properly implement TrapObject for PAL3A 2023-03-14 01:26:25 -07:00
Jackie Liu 6590e58f0a Implement SectorBridge + DivineTreePortal for PAL3A 2023-03-14 01:10:29 -07:00
Jackie Liu b2517803b2 Implement MushroomBridge 2023-03-13 23:03:13 -07:00
Jackie Liu 46efff5a02 Use predefined variable in SCN config to handle times check for toggle and wuling switch 2023-03-13 02:22:18 -07:00
Jackie Liu 941f1924ec Fix a potential bug in MovableCarrierObject impl 2023-03-12 23:16:44 -07:00
Jackie Liu 0310a412f1 Properly implement ThreePhaseSwitchObject + ThreePhaseBridgeObject 2023-03-12 23:07:22 -07:00
Jackie Liu 2ec6399303 Init PAL3A ThreePhaseBridge + ThreePhaseSwitch 2023-03-12 03:15:07 -07:00
Jackie Liu 1a1c177969 Fix a bug in PolyModelRenderer where white texture should be used when texture name is null or empty 2023-03-12 01:36:01 -08:00
Jackie Liu a2254ea709 Fix few of the edge cases 2023-03-11 22:37:50 -08:00
Jackie Liu c237ce7f0a Implement PAL3A RetractableBlocker object 2023-03-11 20:33:29 -08:00
Jackie Liu b9445499e2 Move left virtual stick a bit to the right 2023-03-11 17:45:53 -08:00
Jackie Liu 3350680b5c Implement RotatingWall object 2023-03-11 17:35:04 -08:00
Jackie Liu ee2d8bef6e Minor tweaks 2023-03-10 22:37:09 -08:00
Jackie Liu d7ea45b595 Implement Teapot + PAL3A CMD 188/189 + Code refactoring 2023-03-10 19:48:16 -08:00
Jackie Liu 22f24f499c Update README.md 2023-03-10 02:37:47 -08:00
Jackie Liu 23c1921c2c Upgrade Unity version to 2022.2.10 2023-03-10 02:36:38 -08:00
Jackie Liu 0ba0a01908 Minor tweaks 2023-03-09 00:22:29 -08:00
Jackie Liu 7acf5061e3 Implement PAL3A ToggleSwitch, ElevatorFloorOrBlocker and WuLingSwitch 2023-03-09 00:05:20 -08:00
Jiaqi Liu 03c41461c1 Fix video player for some of the Android devices
Change depth stencil format for render texture used by video player to support some Android devices
2023-03-08 03:27:55 -08:00
Jackie Liu 7a87c4114c Implement activation logic for chained objects in PAL3A 2023-03-08 02:48:48 -08:00
Jackie Liu eb8233457a Add additional logic to handle Switch interaction for PAL3A 2023-03-08 02:03:55 -08:00
Jackie Liu b08158fd5a Update ProjectSettings.asset 2023-03-08 00:50:33 -08:00
Jackie Liu bdc24381a7 Minor tweaks and fixes 2023-03-08 00:49:24 -08:00
Jackie Liu 60a8edf481 Minor tweaks for PushableObject 2023-03-07 18:34:50 -08:00
Jackie Liu 1e63b244ec Minor fixes 2023-03-07 18:16:50 -08:00
Jackie Liu 9e4fdbb5f1 Fix the color(texture) issue of impulsive mechanism in M11-2 which uses _r.pol as the main model 2023-03-06 23:41:59 -08:00
Jackie Liu fb94533109 Properly handle switch and chest object in PAL3 scene m17-3 2023-03-06 22:57:03 -08:00
Jackie Liu 6d20996ccd Add mesh collider to chest objects 2023-03-06 21:02:11 -08:00
Jackie Liu 112f4beb4a Fixed data overflow issue 2023-03-06 20:42:56 -08:00
Jiaqi Liu be733ccf8b Code refactoring 2023-03-06 02:08:34 -08:00
Jiaqi Liu 6a5ac4d8e6 Minor fixes for PAL3A scene objects 2023-03-06 01:40:55 -08:00
Jackie Liu 874a68d7c7 Fix a bug where LongKui's mode is not correctly persisted across scenes 2023-03-05 21:45:44 -08:00
Jackie Liu 34286a8101 Properly implement Switch interaction logic for PAL3A 2023-03-05 15:43:56 -08:00
Jackie Liu 3f5755e553 Implement a special case for Door object interaction in PAL3A 2023-03-05 15:27:48 -08:00
Jackie Liu 1e938ee8f5 Better implementation for RareChest interaction 2023-03-05 15:27:17 -08:00
Jackie Liu 384c13c5ac Fix a bug where actor might spwan at invalid position 2023-03-05 15:25:48 -08:00
Jiaqi Liu 6af384649a Update README.md 2023-03-05 05:49:52 +08:00
Jackie Liu f22e037bb5 Upgrade Linux toolchain version 2023-03-04 00:48:16 -08:00
Jackie Liu 6bed3676a3 Bump Unity version 2023-03-04 00:35:08 -08:00
Jackie Liu 93af80f8a1 v0.40 2023-03-04 00:21:46 -08:00
Jackie Liu bccc36949c Minor fixes 2023-03-03 19:16:28 -08:00
Jackie Liu 1a03ef926c Implement FallableObstacle 2023-03-03 18:49:01 -08:00
Jackie Liu 73d2514176 Code refactoring 2023-03-02 19:33:53 -08:00
Jackie Liu 3e6dff1ae8 Update charset + font atlas 2023-03-02 19:10:04 -08:00
Jackie Liu bad8a177b7 Implement interaction logic for SwordBridge 2023-03-01 20:37:09 -08:00
Jackie Liu 6451f9cfd7 Properly implement PushableObject to support all scenarios 2023-03-01 19:08:29 -08:00
Jackie Liu a2c2c71617 Code refactoring 2023-02-28 19:28:05 -08:00
Jackie Liu cbe8d90eec Some general objects in specific scenes should block player
Some general objects in specific scenes should block player
2023-02-27 19:13:07 -08:00
Jackie Liu 14c48b006f Implement SlideWay object 2023-02-27 18:31:42 -08:00
Jackie Liu b854dc76ab Implement interaction logic for bi-directional boxes
Implement interaction logic for bi-directional boxes
2023-02-26 16:36:47 -08:00
Jackie Liu 066712e887 Fixed a bug in jump logic + upgrade Unity version 2023-02-18 05:47:59 -08:00
Jiaqi Liu 906a651140 Update Rider plugin version 2023-01-21 02:19:48 -08:00
Jiaqi Liu 9dad13af49 Upgrading editor version to 2022.2.2f1 2023-01-17 22:37:02 -08:00
Jackie Liu f4fd18ae5e Update year in the header 2023-01-03 19:03:54 -08:00
Jackie Liu 94b0710933 Bug fix 2022-12-22 18:51:41 -08:00
Jackie Liu 8949ea9991 Code refactoring 2022-12-21 01:57:27 -08:00
Jiaqi Liu e34529e4b5 Code refactoring to avoid GC 2022-12-14 21:41:35 -08:00
Jiaqi Liu b4ac446eb5 Implement jump indicator 2022-12-14 21:31:07 -08:00
Jackie Liu 9b306b8fdf Code refactoring 2022-12-13 05:26:36 -08:00
Jackie Liu 7d2afad6cf Code refactoring 2022-12-12 18:15:40 -08:00
Jiaqi Liu 7ba42aefdf Use pushable object forward direction instead of world direction 2022-12-11 17:00:51 -08:00
Jackie Liu 80fbfb6448 Pushable object WIP 2022-12-11 15:39:56 -08:00
Jackie Liu c3feba43d2 Implement climbable object interaction indicators 2022-12-11 03:28:19 -08:00
Jackie Liu 367cd5004f Minor tweaks and fixes 2022-12-09 19:11:17 -08:00
Jiaqi Liu 1922aaac3f Code refactoring 2022-12-09 03:26:51 -08:00
Jiaqi Liu 839d1736a5 Code refactoring and tweaks 2022-12-09 03:16:26 -08:00
Jackie Liu c8af1231e0 Implement Pushable and EyeBall 2022-12-09 02:14:13 -08:00
Jiaqi Liu 5eedfcbbd5 Destroy combat npc on collision enter 2022-12-08 00:32:19 -08:00
Jackie Liu 872d0d69ef Implement right click to jump 2022-12-07 23:16:43 -08:00
Jackie Liu fce22f30fb Jump logic tweaks 2022-12-07 09:41:26 -08:00
Jackie Liu bc09d55d42 Implement jump logic + bug fixes 2022-12-07 08:27:09 -08:00
Jackie Liu e8b801fe1f Implement switch interaction indicator 2022-12-07 04:11:18 -08:00
Jackie Liu 6581d032ba Init impl of RotatingBridge 2022-12-05 19:27:26 -08:00
Jackie Liu 6cefef4e22 Bug fixes 2022-12-04 23:55:06 -08:00
Jackie Liu 7b62c6b4d9 Bug fixes 2022-12-04 18:55:02 -08:00
Jackie Liu 44e2e1c0aa Fix build issue 2022-12-04 06:25:39 -08:00
Jackie Liu 52b447ba7c Implement MovableCarrier 2022-12-04 06:21:44 -08:00
Jackie Liu 9cce012684 Properly Implement DivineTreePortal 2022-12-04 05:25:21 -08:00
Jackie Liu 41de45dce7 Only focus on scene object if not in camera view 2022-12-04 04:43:45 -08:00
Jackie Liu 00275411e4 Code refactoring and bug fixes 2022-12-04 04:00:00 -08:00
Jackie Liu e4bca08f27 Code refactoring 2022-12-03 00:25:32 -08:00
Jackie Liu b5dfab6875 Implement DivineTreeFlower and DivineTreePortal 2022-12-02 23:16:06 -08:00
Jackie Liu 84226daca7 Bug fixes 2022-12-01 20:12:38 -08:00
Jackie Liu e2aee25f58 Code refactoring 2022-12-01 20:03:08 -08:00
Jackie Liu ed18f220f0 Minor fixes 2022-12-01 04:56:14 -08:00
Jackie Liu d6278f135e Better logic to handle objects moved by the script 2022-11-30 22:24:20 -08:00
Jackie Liu d7f08163aa Remove empty spaces 2022-11-30 21:39:15 -08:00
Jackie Liu ae9b524cf3 Code refactoring 2022-11-30 21:13:17 -08:00
Jackie Liu 2cc59b540f Implement logic to support movement between multiple standing platforms 2022-11-30 03:43:07 -08:00
Jackie Liu e6e27b922c Implement ElevatorPedal 2022-11-30 00:36:22 -08:00
Jackie Liu 00f9911127 Implement Elevator, update PAL3A known commands 2022-11-29 19:31:13 -08:00
Jackie Liu f271460fd1 Bug fixes 2022-11-29 03:02:21 -08:00
Jackie Liu ced2dac458 Bug fixes 2022-11-29 02:13:03 -08:00
Jackie Liu 15acc159e8 Inherent nav layer index when switching player actor 2022-11-29 01:57:47 -08:00
Jackie Liu 7d75e8d3e1 Properly safe actor states in archive 2022-11-29 01:25:06 -08:00
Jackie Liu a2a1dc0ec7 Fixed a bug in save/load logic 2022-11-28 20:04:17 -08:00
Jackie Liu b354049b89 Fix PAL3A compile issue 2022-11-28 18:59:52 -08:00
Jackie Liu 178bcb42a7 Fix Mv3/Cvd/Pol bounds calculation 2022-11-28 18:52:38 -08:00
Jackie Liu e0cc85ca7f Better player interaction logic + code refactoring 2022-11-28 18:31:21 -08:00
Jackie Liu 8b232aeffd Minor refactoring 2022-11-28 03:06:12 -08:00
Jackie Liu a937052472 Minor fixes 2022-11-28 02:20:53 -08:00
Jackie Liu 8c58d13146 Implement ImpulsiveMechanism 2022-11-27 21:56:45 -08:00
Jackie Liu eb5c88da9a Code refactoring 2022-11-27 04:24:24 -08:00
Jackie Liu 6926cd02cb Implement SwordBridgeObject and fix a bug where actor might walking into air 2022-11-27 03:34:13 -08:00
Jackie Liu 2f257d3f95 Implement SceneObjectDoNotLoadFromSaveStateCommand 2022-11-27 02:56:54 -08:00
Jackie Liu 67df0f51ca Implement PedalSwitch and fixed scene object activation saving bug 2022-11-27 00:17:10 -08:00
Jackie Liu 1e648cc3a1 Implement ElevatorDoor and fix Mv3 bounds calculation 2022-11-26 22:41:43 -08:00
Jackie Liu ca8501fcdb And safety check for colliders in movement controller 2022-11-26 21:03:21 -08:00
Jackie Liu b68a154497 Properly implement PiranhaFlower behaviour 2022-11-26 20:36:38 -08:00
Jackie Liu e6792484af Code refactoring 2022-11-26 18:32:08 -08:00
Jackie Liu 2d9d1d859c Prevent player from walking thru collider + SpecialMechanism tweaks 2022-11-26 18:06:04 -08:00
Jackie Liu 99459f6cf5 Special handling for PAL3 M09 scene with WaterSurfaceMechanism 2022-11-26 02:46:37 -08:00
Jackie Liu ecc6d48830 Implement Trap 2022-11-26 01:50:53 -08:00
Jackie Liu 5f44ad2656 Implement LiftingMechanism 2022-11-26 00:59:37 -08:00
Jackie Liu 83418f3635 Implement SpecialMechanism 2022-11-25 22:59:02 -08:00
Jackie Liu 0b570221fc Persist switch state and times count 2022-11-25 19:47:09 -08:00
Jackie Liu 172fb32ac8 Code refactoring 2022-11-25 16:13:21 -08:00
Jackie Liu e8a00488b4 Code refactoring 2022-11-25 14:28:04 -08:00
Jackie Liu 1392c41ccd Reset actor facing after dialogue 2022-11-25 13:59:36 -08:00
Jackie Liu 373e9f7383 Remove lightMap from scene hash 2022-11-25 13:38:00 -08:00
Jackie Liu 85aa452117 Disable rigidbody for HuaYing & TaoZi 2022-11-25 13:30:29 -08:00
Jackie Liu 04af153741 Bug fixes 2022-11-25 01:01:17 -08:00
Jackie Liu febee04ea5 Better actor interaction logic and behavior 2022-11-25 00:09:16 -08:00
Jackie Liu 959631c340 Implement Switch & WaterSurfaceMechanism 2022-11-24 22:51:20 -08:00
Jackie Liu 292663f572 Handle standing platform ray hit for portal command 2022-11-24 22:00:12 -08:00
Jackie Liu 0604b8a341 Implement GravityTrigger & SuspensionBridge 2022-11-24 20:35:25 -08:00
Jackie Liu 6560b2882d Code refactoring 2022-11-23 20:36:44 -08:00
Jackie Liu 755a79642e Code refactoring 2022-11-23 17:38:14 -08:00
Jackie Liu 10d7ff65af Code refactoring 2022-11-22 14:02:06 -08:00
Jackie Liu 5ae0dbbf3d Minor tweaks and bug fixes 2022-11-20 14:36:24 -08:00
Jackie Liu 86f48207b3 Better scene object/actor interaction trigger logic 2022-11-20 14:10:34 -08:00
Jackie Liu 0bd0894547 Implement fundamental logic to support mechanisms 2022-11-19 13:10:00 -08:00
Jackie Liu e3540daa19 Implement player actor switching logic 2022-11-17 15:34:02 -08:00
Jackie Liu 03bd7a962d Bug fix 2022-11-16 19:37:26 -08:00
Jackie Liu bf6e8497d1 Code refactoring 2022-11-16 19:09:48 -08:00
Jackie Liu 1cb60e6be1 Bug fixes and code refactoring 2022-11-16 17:52:12 -08:00
Jackie Liu ee59f14953 Bug fixes and code refactoring 2022-11-16 03:00:30 -08:00
Jackie Liu e293426c27 Respect NumberOfWaypoints 2022-11-15 07:12:23 -08:00
Jiaqi Liu 7238ad7cbb Resolve unknown fields for ScnNpcInfo 2022-11-15 06:27:42 -08:00
Jackie Liu 8938597acf Remove current SceneObjectDoNotLoadFromSaveState impl since it should be set on SceneManager level 2022-11-15 05:28:31 -08:00
Jackie Liu b283516cd0 Disable door animation for script controlled ones 2022-11-15 03:33:57 -08:00
Jackie Liu 42ffc74421 Code refactoring 2022-11-15 03:26:49 -08:00
Jackie Liu 4e2b031f05 Impl door interaction animation + PiranhaFlower logic + code refactoring + bug fixes 2022-11-15 02:30:32 -08:00
Jiaqi Liu 3ce8c93dcb Fix build error 2022-11-14 05:07:23 -08:00
Jackie Liu 68c6a1b1a6 Implement Shakeable object 2022-11-14 04:33:28 -08:00
Jackie Liu 28b9b93146 Imple UIDisplayNextCaptionCommand 2022-11-14 03:43:36 -08:00
Jackie Liu ffd73d5e74 Implement CollidableObject 2022-11-14 03:27:19 -08:00
Jackie Liu a83e863f58 Code refactoring and bug fixes 2022-11-13 10:32:23 -08:00
Jackie Liu ef4d9a7fdd Use speed value from ScnNpcInfo 2022-11-13 08:50:26 -08:00
Jackie Liu 642ead2f5a Fix ChangeTexture bug 2022-11-13 08:39:26 -08:00
Jackie Liu 67e7184f5a Persist scene object activation state 2022-11-13 06:52:39 -08:00
Jackie Liu 84f0eccd5b Added AvailableInConsoleAttribute to control command enablement in console 2022-11-12 23:11:13 -08:00
Jackie Liu f90537b9a5 Minor fixes 2022-11-12 22:26:57 -08:00
Jackie Liu d175fcb401 Implement chest interaction 2022-11-12 04:37:01 -08:00
Jackie Liu 608276b484 Save inventory state 2022-11-12 02:32:01 -08:00
Jackie Liu 3eeadc77fc InventoryManager WIP 2022-11-11 05:54:09 -08:00
Jackie Liu 003694d930 GdbFile WIP 2022-11-10 06:01:31 -08:00
Jackie Liu 2cdb5b08a4 Gdb file reader WIP 2022-11-10 05:49:56 -08:00
Jackie Liu 6ac412fad3 Smarter Pal3 menu options 2022-11-09 21:38:22 -08:00
Jackie Liu 22323a65b5 Remove unused logging 2022-11-08 18:26:55 -08:00
Jackie Liu 14f5e6775d Perf improvements 2022-11-08 18:24:53 -08:00
Jackie Liu 78678024d5 Add editor function to enable/disable lighting feature flag 2022-11-08 00:26:07 -08:00
Jackie Liu 1f9e2b10f9 Upgrade to Unity 2022.2.x 2022-11-08 00:04:46 -08:00
Jiaqi Liu 5944c664f1 Update QualitySettings.asset 2022-11-07 02:45:53 -08:00
Jiaqi Liu 72f77ff1a7 v0.31 2022-11-07 02:37:22 -08:00
Jiaqi Liu 41efbdce8e Use CascadedShadowMaps for tier 3 mobile devices 2022-11-07 02:36:42 -08:00
Jackie Liu d751d5ea2a Hide collectable and chests 2022-11-07 02:34:03 -08:00
Jackie Liu 12ef307fe6 VFX WIP 2022-11-07 02:09:22 -08:00
Jackie Liu bc672d6179 Fix CVD normal issue 2022-11-06 05:58:00 -08:00
Jackie Liu fbadf6766e Add GamePad deadzone processor & code refactoring 2022-11-06 04:42:47 -08:00
Jiaqi Liu 41502ddefb Lighting tweaks 2022-11-03 06:58:44 -07:00
Jackie Liu 61ca35b1b8 Code refactoring 2022-11-01 19:05:05 -07:00
Jiaqi Liu cbb4d5e575 Bug fixes 2022-11-01 05:12:40 -07:00
Jiaqi Liu b37ac428d2 Minor fixes 2022-11-01 01:13:40 -07:00
Jiaqi Liu f9d17a9896 Disable automatic graphics API on Android 2022-11-01 01:00:29 -07:00
Jackie Liu 65d4fefd6f Update QualitySettings.asset 2022-10-31 21:16:12 -07:00
Jackie Liu 5e746c7922 v0.30 2022-10-31 21:06:31 -07:00
Jackie Liu 3c31cb1787 Lighting tweaks 2022-10-31 20:30:16 -07:00
Jackie Liu b0ea2f8638 Effect sprite rendering issue fixes
Also fixed portal base sprite rotation issue
2022-10-31 05:06:44 -07:00
Jackie Liu e38ffc9a40 Distortion code refactoring 2022-10-31 02:56:04 -07:00
Jiaqi Liu 96e2d151f9 Update QualitySettings.asset 2022-10-31 02:46:49 -07:00
yunyouandJackie Liu 23fa70496b 使用官方 PostProcessing ,扩展出来了一个 Distortion 的后处理 (#9)
* +extend PostProcessing , integrate Water wave Distortion into the game. Test it with "EffectSetScreenEffect 0"

Co-authored-by: Jackie Liu <jackil@microsoft.com>
2022-10-31 16:54:42 +08:00
Jackie Liu b3f67d3683 Lighting tweaks 2022-10-31 01:32:49 -07:00
Jackie Liu 84e44d7eec Lighting tweaks 2022-10-30 01:38:27 -07:00
Jackie Liu 661d2ce1c0 Nav mesh fixes 2022-10-30 00:58:46 -07:00
Jackie Liu be695cc353 Lighting tweaks 2022-10-29 19:56:27 -07:00
Jackie Liu 6aa8da32ea Code refactoring and bug fixes 2022-10-29 19:01:45 -07:00
Jackie Liu 2de4bce9e1 Tweak camera nearClipPlane value 2022-10-28 19:07:08 -07:00
Jackie Liu 56ec4d81ad Fix poly and cvd normal issues 2022-10-28 18:49:40 -07:00
Jackie Liu 261ad74a74 Fix mv3 normal issue by splitting the vertices & fix nav mesh facing issue 2022-10-28 17:45:04 -07:00
Jiaqi Liu 654ade106e Update screenshots 2022-10-28 06:01:59 -07:00
Jiaqi Liu 15970562d7 Bump Unity version 2022-10-27 22:31:47 -07:00
Jackie Liu c3fe8198d4 Fix build error 2022-10-27 11:09:10 -07:00
Jackie Liu 593e915dcd Calculate MV3 normals in Mv3FileReader 2022-10-27 01:58:02 -07:00
Jackie Liu 6d6f195aad Enable Ambient Occlusion on desktop devices 2022-10-26 19:03:46 -07:00
Jackie Liu 17814972f4 Tweak fire effect light source location 2022-10-26 18:39:47 -07:00
Jackie Liu a898c69b79 Fix mv3 normals with code refactoring 2022-10-26 18:24:58 -07:00
Jackie Liu 4d473bf69b Reduce shadowResolution 2022-10-26 01:08:23 -07:00
Jackie Liu 9eb091ead6 Temp workaround for mv3 normals 2022-10-26 00:07:52 -07:00
Jackie Liu 49f25b255e Add ToonMaterialFactory, temp fix for normals 2022-10-26 00:07:05 -07:00
Jackie Liu 820c3f1795 Code refactoring 2022-10-25 19:16:25 -07:00
Jackie Liu dac1505886 Move shaders to resource folder 2022-10-25 10:56:50 -07:00
Jackie Liu 2f12c317c4 Lighting tweaks 2022-10-25 00:58:25 -07:00
Jackie Liu 421aeb4c3f Minor tweaks 2022-10-25 00:41:18 -07:00
Jackie Liu 7dfdd4396f All about normals 2022-10-24 18:55:08 -07:00
Jackie Liu 4cf4890693 Light color tweaks 2022-10-24 04:35:13 -07:00
Jiaqi Liu dbeef96411 Update QualitySettings.asset 2022-10-24 04:14:44 -07:00
Jiaqi Liu c47f5b8edb Update SettingsManager.cs 2022-10-24 03:31:05 -07:00
Jackie Liu 173c95c70d Typo fix 2022-10-24 03:20:20 -07:00
Jiaqi Liu 993b5e7653 Experimental (#8)
* Experimental feature
2022-10-24 18:12:03 +08:00
Jiaqi Liu bbeca7a6c6 PostProcessManager code refactoring 2022-10-22 23:19:01 -07:00
Jackie Liu 845f7e8fd5 Fix fire sprite and implement CPK extractor feature in GameResourceViewer 2022-10-21 22:14:33 -07:00
Jackie Liu f2fe362d53 Add bloom effect for VFX with code refactoring 2022-10-21 20:44:19 -07:00
Jackie Liu 53efd23d0f Fix default weapon model for ZiXuan 2022-10-21 01:26:59 -07:00
Jackie Liu 8730c457c2 v0.29 2022-10-21 00:52:32 -07:00
Jackie Liu 1e2e080657 Implement portal ray effect 2022-10-21 00:50:51 -07:00
Jackie Liu a14be2670b VFX WIP: Adding bridge effect 2022-10-21 00:08:50 -07:00
Jackie Liu 766fe2c430 VFX WIP 2022-10-20 02:18:16 -07:00
Jiaqi Liu f7c0aa8e71 Delete 262.prefab.meta 2022-10-19 21:18:52 -07:00
Jackie Liu 18563a5063 Preload VFX prefab 2022-10-19 18:52:40 -07:00
Jackie Liu 5a12990ce1 VFX WIP 2022-10-19 00:27:21 -07:00
Jackie Liu 4c31d56b78 Code refactoring for VFX gameobject 2022-10-18 19:01:33 -07:00
Jackie Liu 9de0e3f9cb Update gitignore 2022-10-18 18:47:21 -07:00
Jackie Liu 8ff5685ed8 VFX init 2022-10-18 18:16:11 -07:00
Jiaqi Liu 4ac04f9e06 Added missing shaders in build bundle 2022-10-17 20:10:38 -07:00
Jiaqi Liu f7c993ef22 Minor tweaks and fixes 2022-10-17 10:15:23 -07:00
Jackie Liu ba68240d77 Minor tweaks 2022-10-17 03:06:59 -07:00
Jackie Liu 76f1b1f551 Fix quaternion calculation for the light source 2022-10-17 02:17:06 -07:00
Jackie Liu dc8b9f6423 Minor fix 2022-10-16 22:40:40 -07:00
Jackie Liu 94b26e15c3 Read Lgt file and create light source objects in editor 2022-10-16 22:27:22 -07:00
yunyouandJiaqi Liu 7ff9146b5e +water using indie material. apply water shadow texture on it (#7)
* +water using indie material. apply water shadow texture on it

* +modify Pal3Water.shader default blend parameter

* Uses first pixel's alpha as water surface opacity

Uses first pixel's alpha as water surface opacity and code refactoring

* Minor tweaks with exposure amount

* Remove empty line

Co-authored-by: Jiaqi Liu <jackil@microsoft.com>
2022-10-16 12:12:57 -07:00
Jackie Liu 2e5421146b EffectDefinition WIP 2022-10-15 17:38:18 -07:00
Jiaqi Liu 780041ec27 Merge pull request #6 from yunyou730/render_order
* Introduce MaterialFactory to manage the creation of materials.
* Fixed semi-transparent object and actor rendering order issue by implementing corresponding shaders with correct render pass.
* Proper implementation of PAL3 sprite shader.
2022-10-15 13:28:43 -07:00
Jackie Liu 8d13753246 Format refactorings 2022-10-15 13:25:38 -07:00
Jackie Liu 1a865a32c0 Code refactoring 2022-10-15 13:03:12 -07:00
Jackie Liu 59d7af002b Fixed a bug where PAL3A portal effect is not rendered correctly 2022-10-15 12:45:18 -07:00
Jackie Liu 9d62fc637a Code refactoring 2022-10-15 12:13:29 -07:00
yunyou da132bdf91 +clean material code 2022-10-15 23:57:00 +08:00
yunyou 0ca80340bc + sync comment with code 2022-10-15 23:43:14 +08:00
yunyou 93228511c3 +fix BlendFlag = 2, additive blend performance issue 2022-10-15 23:33:49 +08:00
miaoyunlong 63b5ca8393 +fix water not perform uv anim issue. 2022-10-15 16:08:29 +08:00
miaoyunlong 9003dbe3fc +3 shaders add _TintColor back (Pal3_Opaque, Pal3_Transparent, Pal3_TransparentOpaquePart) 2022-10-15 14:55:40 +08:00
Jackie Liu d8181e8dd8 Update Mv3ModelRenderer.cs 2022-10-14 20:53:31 -07:00
miaoyunlong 60519b39ef +调整渲染顺序为:Opaque -> SkyBox -> Transparent. 半透明物体会拆成 Opaque 和 Transparent 两部分绘制 2022-10-14 03:26:12 +08:00
miaoyunlong 23d3809cb7 +modify paremters 2022-10-13 22:47:07 +08:00
Jackie Liu 6622b3737c Should only record camera last transform when in gameplay state 2022-10-12 20:45:43 -07:00
miaoyunlong e00eb972a2 +fix transparent material alpha color bug 2022-10-13 01:51:25 +08:00
miaoyunlong e71a244ca6 +fix render order issue 2022-10-13 01:14:42 +08:00
Jiaqi Liu 3b6730b60a Fixed issue with Virtual Joystick UI not showing on some of the Android devices 2022-10-10 06:42:24 -07:00
Jackie Liu 97272bbf0f v0.28 2022-10-10 03:38:48 -07:00
Jackie Liu 4a68472423 Remember last scene state for camera 2022-10-10 03:35:25 -07:00
Jackie Liu 51a5163fc1 Bug fix 2022-10-09 15:12:22 -07:00
Jackie Liu fd3e89c23b Fixed a racing condition when PlayMusicCommand is queued at start of the scene 2022-10-09 14:09:32 -07:00
Jackie Liu 170a78a0bf Use monitor's refresh rate as target frame rate in GameResourceViewer 2022-10-09 12:38:49 -07:00
Jackie Liu 5b69fd1c7f Fixed a bug where player actor might be accidentally activated 2022-10-08 22:31:00 -07:00
616 changed files with 43277 additions and 24750 deletions

No files matched your search

+14
View File
@@ -70,3 +70,17 @@ crashlytics-build.properties
# Unity StreamingAssets folder
/Assets/StreamingAssets
# 3rd party plugin/assets
/Assets/Hovl Studio
/Assets/Hovl Studio.meta
/Assets/RealToon
/Assets/RealToon.meta
# VFX prefabs that are using 3rd party assets
/Assets/Resources/Prefabs/VFX/PAL3/*.prefab
/Assets/Resources/Prefabs/VFX/PAL3/*.meta
/Assets/Resources/Prefabs/VFX/PAL3A/*.prefab
/Assets/Resources/Prefabs/VFX/PAL3A/*.meta
# Materials that are using 3rd party assets
/Assets/Resources/Materials/
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~·—‘’“”…、。《》【】一丁七万丈三上下不与丐丑专且世丘丙业丛东丝丢两严丧个丫中丰串临丸丹为主丽举乃久么义之乌乍乎乏乐乔乖乘乙九乞也习乡书乩买乱乳乾了予争事二于亏云互五井亚些亡交亥亦产亨亩享京亭亮亲人亿什仁仃仅仆仇今介仍从仑仓仔仕他仗付仙仞代令以仪们仰仲仵件价任份仿企伉伍伎伏伐休众优伙会伟传伤伦伪伯估伴伶伸伺似但位低住佐佑体何佘余佛作你佣佩佬佯佳佼使侄侈例侍供依侠侣侥侧侬侮侯侵便促俊俏俐俗保俞信俨俩俪俭修俯俱俸俺倍倏們倒倔倘候倚倜借倦倩倪债值倾假偌偏偕做停健偶偷偿傀傅傍傥储催傲傻像僧僵僻儒儡儿允元兄充兆先光克免兑兔党兢入全八公六兮兰共关兴兵其具典兹养兼兽冀内冈册再冒冕写军农冠冢冤冥冬冯冰冲决况冶冷冻净凄准凉凋凌减凑凛凝几凡凤凭凰凶出击函凿刀刁刃分切刎刑划列刘则刚创初判刨利别刮到制刹刺刻剁剂剃削剌前剐剑剔剖剥剧剩剪副割剿劈力劝办功加务劣动助努劫励劲劳劾势勇勉勘募勤勺勾勿匀包匆匕化北匙匠匪匹区医匾匿十千升午卉半华协卑卒卓单卖南博卜卞占卡卢卦卧卫卯印危即却卵卷卸卿厂厄厅历厉压厌厕厘厚原厢厥厨厮去县叁参又及友双反发叔取受变叛叟口古句另叨叩只叫召叮可台史右叵叶号司叹叽吁吃各吆合吉吊同名后吏吐向吓吕吖吗君吝吞吟否吧吩含听吭启吴吵吸吹吼吾呀呃呆呈告呐呔呕呗员呜呢呦周呱味呵呶呸呻呼命咄咋和咎咏咐咒咔咕咙咦咧咪咬咱咳咶咸咻咽咿哀品哄哇哈哉响哎哑哗哟哥哦哨哩哪哭哮哲哼唆唇唉唐唔唠唤唧唬售唯唱唾啃商啊啥啦啧啬啰啸啼啾喀喂喃善喉喊喋喏喔喘喙喜喝喧喳喵喷喻喽嗅嗓嗔嗖嗜嗟嗤嗦嗨嗬嗯嗳嗽嘀嘉嘎嘘嘛嘞嘟嘱嘲嘴嘻嘿噎噗噜噢噤器噩噪噬噱嚎嚏嚣嚷嚼囊囔囚四回因团园困围固国图圃圆圈土圣在地场圾均坊坍坎坏坐坑块坚坛坝坟坠坡坤坦坪坷垂垃型垒垢垣垫垮埃埋城域埠埤培基堂堆堇堕堡堤堪堰堵塌塑塔塘塞填塾境墓墙墚增墟墨壁壑壤士壬壮声壳壶壹处备复夏夕外夙多夜够大天太夫夭央失头夷夸夹夺奇奈奉奋奎奏契奔奖套奠奢奥女奴奶奸她好如妃妄妆妇妈妍妒妓妖妙妞妥妨妹妻妾姊始姐姑姓委姗姚姜姥姨姬姻姿威娃娄娇娘娜娟娥娲娴娶娼婆婉婕婚婢婪婴婵婶婷婿媒媚媳媵嫁嫂嫉嫌嫔嫖嫡嫣嫦嫩嬉嬷子孑孓孔孕字存孙孚孝孟季孤学孩孪孬孰孵孺孽宁它宅宇守安宋完宏宗官宙定宜宝实宠客宣室宦宫宰害宴宵家容宽宾宿寂寄寅密寇富寐寒寝寞察寡寤寨寰寸对寺寻导寿封射将尊小少尔尖尘尚尝尤尬就尴尸尹尺尼尽尾尿局屁层居屈屋屎屏屐屑展属屠屡山屹岁岂岄岌岑岔岖岗岚岛岩岭岱岳岸峙峡峨峭峰峻崇崎崔崖崩崽嵯嶂巍川州巡巢工左巧巨巫差己已巳巴巷巽巾币市布帅师希帐帔帕帖帚帜帝带席帮帷常帼帽幄幅幌幕幢干平年并幸幺幻幼幽广庄庆庇床序庐库应底店庙庚府庞废度座庭庶康庸廉廊廖延廷建廻廿开异弃弄弊式弑弓引弛弟张弥弦弭弯弱弹强归当录彝形彤彦彩彪彭彰影役彻彼往征径待徇很律徐徒徕得徙御循微德心必忆忌忍忒志忘忙忠忡忧快念忽怀态怄怅怎怒怕怖怜思怠急怦性怨怪怯总恃恋恍恐恒恕恙恢恤恨恩恭息恰恳恶恻恼悄悉悍悔悟悠患悦您悬悯悲悴情惆惊惋惑惕惚惜惟惠惦惧惨惩惬惭惮惯想惶惹惺愁愈意愚感愣愤愧愫愿慈慌慎慑慕慢慧慨慰慷憎憾懂懈懒懦懵戈戊戌戎戏成我戒或战戚戟截戮戴户戾房所扁扇扈扉手才扎扑扒打扔托扛扣执扩扫扬扭扮扯扰扳扶批找承技抄把抑抓投抖抗折抚抛抟抢护报披抬抱抵抹押抽拂担拆拈拉拋拍拎拐拒拓拔拖拘拙招拜拟拢拣拥拦拧拨择括拯拳拷拼拽拾拿持挂指按挑挖挟挠挡挣挤挥挨挪挫振挺挽捅捆捉捌捎捏捐捕捞损捡换捣捧据捶捷掀掂授掉掌掏掐排掘掙掠探接控推掩措掳掷掺揉揍描提插揖握揣揪揭援搁搂搅搏搓搔搜搞搬搭携摄摆摇摈摊摔摘摧摩摸撇撑撒撕撞撤播撰擂擅操擎擒擦攀攒攫支收攸改攻放政故效敌敏救教敛敝敞敢散敬数敲整敷文斋斐斑斗料斛斜斟斤斥斧斩断斯新方於施旁旅旋族旗无既日旦旧旨早旬旭旱时旷旺昂昆昊昌明昏易昔昕昙星映春昧昨昭是昴昼显晃晋晌晒晓晕晖晚晦晧晨普景晰晴晶智晾暂暄暇暑暖暗暮暴曜曦曰曲曳更曹曾替最月有朋服朔朗望朝期木未末本术朱朴朵机朽杀杂权杆杈杉李杏材村杖杜杞束杠条来杨杭杯杰杳杵松板极构枉枕林枚果枝枢枣枪枫枯架枷柄柏某Line truncated
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~·—‘’“”…、。《》【】!(),:;?~+一丁七万丈三上下不与丐丑专且世丘丙业丛东丝丢两严丧个丫中丰串临丸丹为主丽举乃久么义之乌乍乎乏乐乔乖乘乙九乞也习乡书乩买乱乳乾了予争事二于亏云互五井亚些亡交亥亦产亨亩享京亭亮亲人亿什仁仃仅仆仇今介仍从仑仓仔仕他仗付仙仞代令以仪们仰仲仵件价任份仿企伉伍伎伏伐休众优伙会伟传伤伦伪伯估伴伶伸伺似但位低住佐佑体何佘余佛作你佣佩佬佯佳佼使侄侈例侍供依侠侣侥侧侬侮侯侵便促俊俏俐俗保俞信俨俩俪俭修俯俱俸俺倍倏們倒倔倘候倚倜借倦倩倪债值倾假偌偏偕做停健偶偷偿傀傅傍傥储催傲傻像僧僵僻儒儡儿允元兄充兆先光克免兑兔党兢入全八公六兮兰共关兴兵其具典兹养兼兽冀内冈册再冒冕写军农冠冢冤冥冬冯冰冲决况冶冷冻净凄准凉凋凌减凑凛凝几凡凤凭凰凶出击函凿刀刁刃分切刎刑划列刘则刚创初判刨利别刮到制刹刺刻剁剂剃削剌前剐剑剔剖剥剧剩剪副割剿劈力劝办功加务劣动助努劫励劲劳劾势勇勉勘募勤勺勾勿匀包匆匕化北匙匠匪匹区医匾匿十千升午卉半华协卑卒卓单卖南博卜卞占卡卢卦卧卫卯印危即却卵卷卸卿厂厄厅历厉压厌厕厘厚原厢厥厨厮去县叁参又及友双反发叔取受变叛叟口古句另叨叩只叫召叮可台史右叵叶号司叹叽吁吃各吆合吉吊同名后吏吐向吓吕吖吗君吝吞吟否吧吩含听吭启吴吵吸吹吼吾呀呃呆呈告呐呔呕呗员呜呢呦周呱味呵呶呸呻呼命咄咋和咎咏咐咒咔咕咙咦咧咪咬咱咳咶咸咻咽咿哀品哄哇哈哉响哎哑哗哟哥哦哨哩哪哭哮哲哼唆唇唉唐唔唠唤唧唬售唯唱唾啃商啊啥啦啧啬啰啸啼啾喀喂喃善喉喊喋喏喔喘喙喜喝喧喳喵喷喻喽嗅嗓嗔嗖嗜嗟嗤嗦嗨嗬嗯嗳嗽嘀嘉嘎嘘嘛嘞嘟嘱嘲嘴嘻嘿噎噗噜噢噤器噩噪噬噱嚎嚏嚣嚷嚼囊囔囚四回因团园困围固国图圃圆圈土圣在地场圾均坊坍坎坏坐坑块坚坛坝坟坠坡坤坦坪坷垂垃型垒垢垣垫垮埃埋城域埠埤培基堂堆堇堕堡堤堪堰堵塌塑塔塘塞填塾境墓墙墚增墟墨壁壑壤士壬壮声壳壶壹处备复夏夕外夙多夜够大天太夫夭央失头夷夸夹夺奇奈奉奋奎奏契奔奖套奠奢奥女奴奶奸她好如妃妄妆妇妈妍妒妓妖妙妞妥妨妹妻妾姊始姐姑姓委姗姚姜姥姨姬姻姿威娃娄娇娘娜娟娥娲娴娶娼婆婉婕婚婢婪婴婵婶婷婿媒媚媳媵嫁嫂嫉嫌嫔嫖嫡嫣嫦嫩嬉嬷子孑孓孔孕字存孙孚孝孟季孤学孩孪孬孰孵孺孽宁它宅宇守安宋完宏宗官宙定宜宝实宠客宣室宦宫宰害宴宵家容宽宾宿寂寄寅密寇富寐寒寝寞察寡寤寨寰寸对寺寻导寿封射将尊小少尔尖尘尚尝尤尬就尴尸尹尺尼尽尾尿局屁层居屈屋屎屏屐屑展属屠屡山屹岁岂岄岌岑岔岖岗岚岛岩岭岱岳岸峙峡峨峭峰峻崇崎崔崖崩崽嵯嶂巍川州巡巢工左巧巨巫差己已巳巴巷巽巾币市布帅师希帐帔帕帖帚帜帝带席帮帷常帼帽幄幅幌幕幢干平年并幸幺幻幼幽广庄庆庇床序庐库应底店庙庚府庞废度座庭庶康庸廉廊廖延廷建廻廿开异弃弄弊式弑弓引弛弟张弥弦弭弯弱弹强归当录彝形彤彦彩彪彭彰影役彻彼往征径待徇很律徐徒徕得徙御循微德心必忆忌忍忒志忘忙忠忡忧快念忽怀态怄怅怎怒怕怖怜思怠急怦性怨怪怯总恃恋恍恐恒恕恙恢恤恨恩恭息恰恳恶恻恼悄悉悍悔悟悠患悦您悬悯悲悴情惆惊惋惑惕惚惜惟惠惦惧惨惩惬惭惮惯想惶惹惺愁愈意愚感愣愤愧愫愿慈慌慎慑慕慢慧慨慰慷憎憾懂懈懒懦懵戈戊戌戎戏成我戒或战戚戟截戮戴户戾房所扁扇扈扉手才扎扑扒打扔托扛扣执扩扫扬扭扮扯扰扳扶批找承技抄把抑抓投抖抗折抚抛抟抢护报披抬抱抵抹押抽拂担拆拈拉拋拍拎拐拒拓拔拖拘拙招拜拟拢拣拥拦拧拨择括拯拳拷拼拽拾拿持挂指按挑挖挟挠挡挣挤挥挨挪挫振挺挽捅捆捉捌捎捏捐捕捞损捡换捣捧据捶捷掀掂授掉掌掏掐排掘掙掠探接控推掩措掳掷掺揉揍描提插揖握揣揪揭援搁搂搅搏搓搔搜搞搬搭携摄摆摇摈摊摔摘摧摩摸撇撑撒撕撞撤播撰擂擅操擎擒擦攀攒攫支收攸改攻放政故效敌敏救教敛敝敞敢散敬数敲整敷文斋斐斑斗料斛斜斟斤斥斧斩断斯新方於施旁旅旋族旗无既日旦旧旨早旬旭旱时旷旺昂昆昊昌明昏易昔昕昙星映春昧昨昭是昴昼显晃晋晌晒晓晕晖晚晦晧晨普景晰晴晶智晾暂暄暇暑暖暗暮暴曜曦曰曲曳更曹曾替最月有朋服朔朗望朝期木未末本术朱朴朵机朽杀杂权杆杈杉李杏材村杖杜杞束杠条来杨杭杯杰杳杵松板极构枉枕林枚果枝枢Line truncated
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b0b27c9e5e4d2e4fbc9b6584f828f7b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File renamed without changes.
@@ -0,0 +1,54 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
/*
reference: https://www.shadertoy.com/view/MsKXDh
*/
Shader "Pal3/PostEffectDistortion"
{
Properties
{
_TimeScale ("Time Scale",float) = 4.0
_XFactor ("X Factor",float) = 15.0
_YFactor("Y Factor",float) = 10.0
}
HLSLINCLUDE
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
float _TimeScale;
float _XFactor;
float _YFactor;
float4 Frag(VaryingsDefault i) : SV_Target
{
float2 uv = i.texcoord;
const float time = _Time.y;
uv.x += sin(uv.y * _XFactor + time * _TimeScale) / 400.0;
uv.y += cos(uv.x * _YFactor + time * _TimeScale) / 450.0;
uv.x += sin((uv.y+uv.x) * _XFactor + time * _TimeScale) / (180.0 + (_TimeScale * sin(time)));
uv.y += cos((uv.y+uv.x) * _YFactor + time * _TimeScale) / (200.0 + (_TimeScale * sin(time)));
float4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv);
return col;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0b8bcccc572f924448668c94cfa547b4
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -44,6 +44,105 @@ MonoBehaviour:
opacity:
overrideState: 0
value: 1
--- !u!114 &-8365138130595697379
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bb4ad18ac69b12845a429aba13929a07, type: 3}
m_Name: Distortion
m_EditorClassIdentifier:
active: 0
enabled:
overrideState: 1
value: 1
timeScale:
overrideState: 0
value: 4
xFactor:
overrideState: 0
value: 15
yFactor:
overrideState: 0
value: 10
--- !u!114 &-806185241644601601
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bb4ad18ac69b12845a429aba13929a07, type: 3}
m_Name: Distortion
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
timeScale:
overrideState: 0
value: 4
xFactor:
overrideState: 0
value: 15
yFactor:
overrideState: 0
value: 10
--- !u!114 &-804113543285745465
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1cb7e9e120078f43bce4f0b1be547a7, type: 3}
m_Name: AmbientOcclusion
m_EditorClassIdentifier:
active: 0
enabled:
overrideState: 1
value: 1
mode:
overrideState: 1
value: 1
intensity:
overrideState: 1
value: 0.25
color:
overrideState: 0
value: {r: 0, g: 0, b: 0, a: 1}
ambientOnly:
overrideState: 0
value: 1
noiseFilterTolerance:
overrideState: 0
value: 0
blurTolerance:
overrideState: 0
value: -4.6
upsampleTolerance:
overrideState: 0
value: -12
thicknessModifier:
overrideState: 0
value: 1
directLightingStrength:
overrideState: 0
value: 0
radius:
overrideState: 0
value: 0.25
quality:
overrideState: 0
value: 2
--- !u!114 &-118557119588518591
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -1370,3 +1469,78 @@ MonoBehaviour:
settings:
- {fileID: -118557119588518591}
- {fileID: -8887095760420704611}
- {fileID: 455792505896753558}
- {fileID: -804113543285745465}
- {fileID: -8365138130595697379}
--- !u!114 &455792505896753558
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48a79b01ea5641d4aa6daa2e23605641, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 0
enabled:
overrideState: 1
value: 1
intensity:
overrideState: 1
value: 5
threshold:
overrideState: 1
value: 1.3
softKnee:
overrideState: 1
value: 0.5
clamp:
overrideState: 0
value: 65472
diffusion:
overrideState: 0
value: 7
anamorphicRatio:
overrideState: 0
value: 0
color:
overrideState: 0
value: {r: 1, g: 1, b: 1, a: 1}
fastMode:
overrideState: 1
value: 1
dirtTexture:
overrideState: 0
value: {fileID: 0}
defaultState: 1
dirtIntensity:
overrideState: 0
value: 0
--- !u!114 &954549172052332416
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bb4ad18ac69b12845a429aba13929a07, type: 3}
m_Name: Distortion
m_EditorClassIdentifier:
active: 0
enabled:
overrideState: 1
value: 1
timeScale:
overrideState: 0
value: 4
xFactor:
overrideState: 0
value: 15
yFactor:
overrideState: 0
value: 10
+57 -8
View File
@@ -203,9 +203,17 @@ Camera:
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -220,7 +228,7 @@ Camera:
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 55
m_Bits: 63
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
@@ -343,7 +351,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 311849590}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
@@ -351,7 +359,7 @@ MonoBehaviour:
volumeTrigger: {fileID: 311849593}
volumeLayer:
serializedVersion: 2
m_Bits: 55
m_Bits: 136
stopNaNPropagation: 0
finalBlitToCameraTarget: 0
antialiasingMode: 0
@@ -363,7 +371,7 @@ MonoBehaviour:
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
fastMode: 1
keepAlpha: 0
fog:
enabled: 1
@@ -395,7 +403,9 @@ MonoBehaviour:
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeStackBundles: []
m_AfterStackBundles: []
m_AfterStackBundles:
- assemblyQualifiedName: Pal3.Effect.PostProcessing.Distortion, Pal3, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!1 &768200630232143376
GameObject:
m_ObjectHideFlags: 0
@@ -457,6 +467,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 9999
m_TargetDisplay: 0
@@ -951,7 +962,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 160, y: 160}
m_AnchoredPosition: {x: 180, y: 160}
m_SizeDelta: {x: 160, y: 160}
m_Pivot: {x: 0, y: 0}
--- !u!222 &1806521128227818516
@@ -1005,7 +1016,28 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_MovementRange: 90
m_DynamicOriginRange: 100
m_ControlPath: <Joystick>/stick
m_Behaviour: 0
m_UseIsolatedInputActions: 0
m_PointerDownAction:
m_Name:
m_Type: 0
m_ExpectedControlType:
m_Id:
m_Processors:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
m_PointerMoveAction:
m_Name:
m_Type: 0
m_ExpectedControlType:
m_Id:
m_Processors:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
--- !u!1 &1497448014832900950
GameObject:
m_ObjectHideFlags: 0
@@ -1223,6 +1255,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -1611,6 +1644,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -1714,6 +1748,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 999
m_TargetDisplay: 0
@@ -1828,6 +1863,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 1000
m_TargetDisplay: 0
@@ -1956,6 +1992,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 1000
m_TargetDisplay: 0
@@ -2314,6 +2351,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -2755,7 +2793,7 @@ GameObject:
m_Component:
- component: {fileID: 5491488055271105370}
- component: {fileID: 8346885185333560231}
m_Layer: 0
m_Layer: 3
m_Name: PostProcessVolume
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -3225,6 +3263,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10001
m_TargetDisplay: 0
@@ -3422,6 +3461,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 1000
m_TargetDisplay: 0
@@ -3557,6 +3597,7 @@ VideoPlayer:
m_RenderMode: 2
m_AspectRatio: 2
m_DataSource: 0
m_TimeUpdateMode: 2
m_PlaybackSpeed: 1
m_AudioOutputMode: 2
m_TargetAudioSources:
@@ -3635,6 +3676,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 10000
m_TargetDisplay: 0
@@ -3736,6 +3778,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -3836,6 +3879,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -4305,6 +4349,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -4313,6 +4358,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 8627381932629902483}
m_Modifications:
- target: {fileID: 2675203688159455099, guid: 3ef1d32c83f86744286e2067bc5f73e4, type: 3}
@@ -4592,6 +4638,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3ef1d32c83f86744286e2067bc5f73e4, type: 3}
--- !u!224 &9166793672834059380 stripped
RectTransform:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2eaeb845461401e488e4640caf779ddf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b93923849ec63ad4ea52f79bf5bc9cb6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,45 @@
因为当前特效的实现方式使用了第三方插件和素材,所以此文件夹内的所有prefab均添加进了gitignore里。
请联系作者了解插件获取方式和特效prefab的获取方式。
0 => 传送法阵特效
15 => 单人传送特效
98 => 重楼施法帮龙葵恢复肉身时的特效
175 => 邪剑仙迷倒众人的特效
224 => 丁小侠剧情狼妖受击特效
251 => 邪剑仙变身特效
252 => 邪剑仙传送离开时的特效
254 => 重楼传送法术特效
255 => 龙葵穿衣服的特效
256 => 龙葵治疗他人特效
257 => 治疗咒施法特效
259 => 大型传送法施法前奏特效
260 => 大型传送法阵特效收尾
261 => 大型传送法阵特效开始
262 => 重楼当剑的时候剑插入地面的火光特效
263 => 火鬼王消失特效
264 => 古藤精施法特效
265 => 人物受到法术作用时候的特效
266 => 邪剑仙施法特效
270 => 天鬼皇复活后灵魂出窍特效
275 => 重楼创建的用来禁锢雪见/龙葵的法阵特效
276 => 迴魂施法结束特效
277 => 迴魂施法完全结束特效
278 => 迴魂施法特效
290 => 雪见传送出现时特效
295 => 重楼施法治疗特效
297 => 紫萱施法召唤水灵特效
337 => 古藤精风系法术特效
341 => 邪剑仙给镇妖剑施法特效
368 => 雷击单体施法特效
369 => 雷击范围施法特效
376 => 紫萱的土系法术特效
389 => 紫萱给江姑娘施法特效
452 => 花楹治疗他人特效
453 => 人物施法蓄力时的特效
454 => 龙葵施法让众人御剑飞行的特效
456 => 老婆婆施法特效
457 => 夕瑶给景天施法时的特效
458 => 灵力溢出特效
467 => 邪剑仙灰飞烟灭特效
468 => 蓝龙葵变红龙葵的特效
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 815b64a4a03e7b949bd85e1e5c19deb3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a637ebcead3359c4f849f936d41707ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
因为当前特效的实现方式使用了第三方插件和素材,所以此文件夹内的所有prefab均添加进了gitignore里。
请联系作者了解插件获取方式和特效prefab的获取方式。
0 => 传送法阵特效
9 => 茅山道士封印法术特效
40 => 单体风咒特效
50 => 单体雷咒特效
91 => 封印法术特效
157 => 角色传送出现特效
164 => 南宫煌变身狼形态时的特效
170 => 王蓬絮变身特效
171 => 人物施法特效
172 => 人物受到法术作用时候的特效
173 => 人物受到法术作用时候的特效
174 => 治疗特效
175 => 茅山术士打乱三杯盏特效
176 => 南宫煌打乱三杯盏特效
177 => 角色传送消失时的特效
178 => 南宫煌使关桃子的笼子消失的特效
179 => 南宫煌变出法桌的特效
181 => 南宫煌变出小东西的特效
182 => 南宫煌变出大东西的特效
186 => 大石块砸下后的尘土特效
189 => 地脉石门封印打开时的特效
198 => 南宫煌变出东西的特效
201 => 魁妖变小特效
205 => 照妖镜发光的特效
209 => 五灵轮特效
211 => 洒金笺特效
230 => 重楼施法消灭怪物的特效
254 => 重楼传送特效
257 => 隔空取物特效
258 => 迴魂传送特效
259 => 大型传送法施法前奏特效
260 => 大型传送法阵特效收尾
261 => 大型传送法阵特效开始
281 => 角色传送消失时的特效
282 => 雷咒特效
283 => 物品消失时的特效
285 => 南宫煌施法特效
287 => 土灵珠特效
289 => 血魂姬施法特效
290 => 回复法阵特效
292 => 五灵轮发光特效
299 => 重楼传送众人特效
314 => 倾国银弹波特效
315 => 南宫煌切换为人形态特效
316 => 魔物出现特效
318 => 千凝魔艮特效
320 => 幽娘变身特效
322 => 幽娘吸收怨气特效
323 => 幽娘收集怨气特效
325 => 陆北亭变身特效
328 => 风雅颂开心的特效
333 => 感月出现特效
355 => 王蓬絮治疗特效
359 => 蝎魃消失特效
360 => 星璇给南宫煌输入内力时的特效
367 => 五毒珠治疗特效
388 => 迴魂传送特效
389 => 迴魂传送特效
397 => 燎日变身特效
401 => 魔尊帮星璇灵肉合一的特效
404 => 思堂消失特效
408 => 星璇燎日变换时特效
424 => 王蓬絮对南宫煌施法特效
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f1d950c46b3119043a1919074fdc27c5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4f33d244048b1054a8753633da7ffe28
guid: fcd2231fc0b299247b47f42991d73ab5
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -10,14 +10,16 @@ Shader "Pal3/Dev"
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
SubShader
{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
@@ -63,4 +65,4 @@ Shader "Pal3/Dev"
ENDCG
}
}
}
}
@@ -0,0 +1,81 @@
Shader "Pal3/Opaque"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_TintColor ("Tint color", Color) = (1.0, 1.0, 1.0, 1.0)
_HasShadowTex ("Has Shadow Texture", Range(0, 1)) = 0.0
_ShadowTex ("Shadow Texture", 2D) = "white" {}
_Exposure("Exposure Amount", Range(0.1, 1.0)) = 0.4
}
SubShader
{
Lighting Off
Tags { "QUEUE" = "Geometry" }
Pass
{
Tags{ "Qeueue" = "Geometry" }
Blend Off
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float2 shadowcoord : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
float2 shadowcoord : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _TintColor;
float _HasShadowTex;
sampler2D _ShadowTex;
float4 _ShadowTex_ST;
float _Exposure;
v2f vert(appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.shadowcoord = TRANSFORM_TEX(v.shadowcoord, _ShadowTex);
return o;
}
half4 frag(v2f i) : SV_Target
{
half4 color = tex2D(_MainTex, i.texcoord);
if(_HasShadowTex > 0.5f)
{
color *= tex2D(_ShadowTex, i.shadowcoord) / (1 - _Exposure);
}
color *= _TintColor;
return color;
}
ENDCG
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a83b1b6f4822140d58c7bad4e3b39932
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,55 @@
Shader "Pal3/Sprite"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "Queue" = "Transparent" }
LOD 100
Pass
{
Blend SrcAlpha One
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
col.a = 1.0f; // force alpha to 1 to avoid transparency
return col;
}
ENDCG
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6122fb5a4bad8433982c0407309f8dbf
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -1,34 +1,38 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
Shader "Pal3/Standard"
Shader "Pal3/Transparent"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_ShadowTex ("Shadow map (RGB)", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.0
_Exposure("Exposure Amount", Range(0.1,1.0)) = 0.4
_IsOpaque("Is Material Opaque", Range(0,1)) = 1.0
_TintColor ("Tint color", Color) = (1.0, 1.0, 1.0, 1.0)
_Threshold ("Transparent Threshold", Range(0, 1)) = 1.0
_HasShadowTex ("Has Shadow Texture", Range(0, 1)) = 0.0
_ShadowTex ("Shadow Texture", 2D) = "white" {}
_Exposure("Exposure Amount", Range(0.1, 1.0)) = 0.4
[Enum(UnityEngine.Rendering.BlendMode)]
_BlendSrcFactor("Source Blend Factor", int) = 5 // BlendMode.SrcAlpha as Default
[Enum(UnityEngine.Rendering.BlendMode)]
_BlendDstFactor("Dest Blend Factor", int) = 10 // BlendMode.OneMinusSrcAlpha as Default
}
SubShader
{
Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="TransparentCutout" }
LOD 100
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
Tags { "Queue" = "Transparent" }
// Pass 2 ,transparent part
Pass
{
Blend [_BlendSrcFactor] [_BlendDstFactor]
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata_t
@@ -44,18 +48,21 @@ Shader "Pal3/Standard"
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
float2 shadowcoord : TEXCOORD1;
UNITY_FOG_COORDS(2)
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Threshold;
float _HasShadowTex;
sampler2D _ShadowTex;
float4 _ShadowTex_ST;
fixed _Cutoff;
float _Exposure;
float _IsOpaque;
float4 _TintColor;
v2f vert(appdata_t v)
{
v2f o;
@@ -64,32 +71,24 @@ Shader "Pal3/Standard"
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.shadowcoord = TRANSFORM_TEX(v.shadowcoord, _ShadowTex);
UNITY_TRANSFER_FOG(o, o.vertex);
return o;
}
half4 frag(v2f i) : SV_Target
{
half4 color = tex2D(_MainTex, i.texcoord);
const half alpha = color.a;
// Cutout
clip(color.a - _Cutoff);
// Shadow
color *= tex2D(_ShadowTex, i.shadowcoord) / (1 - _Exposure);
// Preserve alpha or not
if (_IsOpaque == 1.0)
const float alpha = color.a;
if(color.a >= _Threshold)
{
color.a = 1.0;
discard;
}
else
if(_HasShadowTex > 0.5f)
{
color *= tex2D(_ShadowTex, i.shadowcoord) / (1 - _Exposure);
color.a = alpha;
}
UNITY_APPLY_FOG(i.fogCoord, color);
color *= _TintColor;
return color;
}
ENDCG
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9a73f8d5b84814e63a97995e839fdabb
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -1,32 +1,31 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
Shader "Pal3/StandardNoShadow"
Shader "Pal3/TransparentOpaquePart"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.0
_TintColor ("Tint color", Color) = (1.0, 1.0, 1.0, 1.0)
_IsOpaque("Is Material Opaque", Range(0,1)) = 1.0
_Threshold ("Transparent Threshold", Range(0, 1)) = 1.0
_HasShadowTex ("Has Shadow Texture", Range(0, 1)) = 0.0
_ShadowTex ("Shadow Texture", 2D) = "white" {}
_Exposure("Exposure Amount", Range(0.1, 1.0)) = 0.4
}
SubShader
{
Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="TransparentCutout" }
LOD 100
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
Tags { "Qeueue" = "Geometry" }
// pass 1 , opaque part
Pass
{
Blend Off
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_fog
#include "UnityCG.cginc"
@@ -34,6 +33,7 @@ Shader "Pal3/StandardNoShadow"
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float2 shadowcoord : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
@@ -41,15 +41,21 @@ Shader "Pal3/StandardNoShadow"
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float2 shadowcoord : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed _Cutoff;
half4 _TintColor;
float _IsOpaque;
float _Threshold;
float _HasShadowTex;
sampler2D _ShadowTex;
float4 _ShadowTex_ST;
float _Exposure;
float4 _TintColor;
v2f vert(appdata_t v)
{
@@ -58,32 +64,21 @@ Shader "Pal3/StandardNoShadow"
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o, o.vertex);
o.shadowcoord = TRANSFORM_TEX(v.shadowcoord, _ShadowTex);
return o;
}
half4 frag(v2f i) : SV_Target
{
half4 color = tex2D(_MainTex, i.texcoord);
const half alpha = color.a;
// Cutout
clip(color.a - _Cutoff);
// Tint color
color *= _TintColor;
// Preserve alpha or not
if (_IsOpaque == 1.0)
{
color.a = 1.0;
}
else
{
color.a = alpha;
}
clip(color.a - _Threshold);
UNITY_APPLY_FOG(i.fogCoord, color);
if(_HasShadowTex > 0.5f)
{
color *= tex2D(_ShadowTex, i.shadowcoord) / (1 - _Exposure);
}
color *= _TintColor;
return color;
}
ENDCG
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 784c49f60e0c64f6595ed503bd3a3a69
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
+91
View File
@@ -0,0 +1,91 @@
Shader "Pal3/Water"
{
Properties
{
// main texture
_MainTex ("Main texture", 2D) = "white" {}
// alpha value
_Alpha ("Alpha",Range(0, 1)) = 0.5
_Exposure("Exposure Amount", Range(0.1, 1.0)) = 0.3
// pre baked shadow texture
_ShadowTex ("Shadow texture", 2D) = "white" {}
_HasShadowTex ("Has Shadow Texture", Range(0, 1)) = 0.0
[Enum(UnityEngine.Rendering.BlendMode)]
_BlendSrcFactor("Source Blend Factor", int) = 5 // BlendMode.SrcAlpha as Default
[Enum(UnityEngine.Rendering.BlendMode)]
_BlendDstFactor("Dest Blend Factor", int) = 10 // BlendMode.OneMinusSrcAlpha as Default
}
SubShader
{
Lighting Off
Tags { "QUEUE" = "Transparent-1" } // -1 to fix sorting order issue with semi-transparent trees etc.
Pass
{
Blend [_BlendSrcFactor] [_BlendDstFactor]
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float2 texcoord2 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
float2 texcoord2 : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Alpha;
float _Exposure;
float _HasShadowTex;
sampler2D _ShadowTex;
float4 _ShadowTex_ST;
v2f vert(appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.texcoord2 = TRANSFORM_TEX(v.texcoord2, _ShadowTex);
return o;
}
half4 frag(v2f i) : SV_Target
{
const half4 color = tex2D(_MainTex, i.texcoord);
const half4 colorShadow = tex2D(_ShadowTex, i.texcoord2);
half4 mixedColor = color * colorShadow / (1 - _Exposure);
mixedColor.a = _Alpha; // use global alpha
return mixedColor;
}
ENDCG
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 54296b5ef906d4d219289838c47b2f01
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -18,7 +18,7 @@ RenderTexture:
m_Height: 448
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 94
m_DepthStencilFormat: 90
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
+3 -3
View File
@@ -24,7 +24,7 @@ RenderSettings:
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1.3
m_AmbientMode: 0
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
@@ -97,8 +97,8 @@ LightmapSettings:
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 112000000, guid: c9e1768594f6afd479e0380c47ec2784, type: 2}
m_LightingSettings: {fileID: 4890085278179872738, guid: c3e8b810b348ed54ba97c7a4ee44d9eb, type: 2}
m_LightingDataAsset: {fileID: 112000000, guid: b024d577cdecd974eab12c932a37f51b, type: 2}
m_LightingSettings: {fileID: 4890085278179872738, guid: b0ad69fd7711b6842b5f287b194ede35, type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -29,7 +29,7 @@ namespace Build.Editor
#elif PAL3A
string plistPath = pathToBuiltProject + "/PAL3A/Info.plist";
#endif
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -282,8 +282,8 @@ namespace Core.Algorithm.PathFinding
int x1 = end.X;
int y1 = end.Y;
int dx = Math.Abs(x1 - x0);
int dy = Math.Abs(y1 - y0);
int dx = Mathf.Abs(x1 - x0);
int dy = Mathf.Abs(y1 - y0);
int sx = x0 < x1 ? 1 : -1;
int sy = y0 < y1 ? 1 : -1;
int err = dx - dy;
@@ -339,7 +339,7 @@
public TItem First => _nodes[1];
/// <summary>
/// This method must be called on a node every time its priority changes while it is in the queue.
/// This method must be called on a node every time its priority changes while it is in the queue.
/// <b>Forgetting to call this method will result in a corrupted queue!</b>
/// Calling this method on a node not in the queue results in undefined behavior
/// O(log n)
@@ -369,7 +369,7 @@
}
/// <summary>
/// Removes a node from the queue. The node does not need to be the head of the queue.
/// Removes a node from the queue. The node does not need to be the head of the queue.
/// If the node is not in the queue, the result is undefined. If unsure, check Contains() first
/// O(log n)
/// </summary>
@@ -33,12 +33,12 @@
bool Contains(TItem node);
/// <summary>
/// Removes a node from the queue. The node does not need to be the head of the queue.
/// Removes a node from the queue. The node does not need to be the head of the queue.
/// </summary>
void Remove(TItem node);
/// <summary>
/// Call this method to change the priority of a node.
/// Call this method to change the priority of a node.
/// </summary>
void UpdatePriority(TItem node, TPriority priority);
@@ -48,7 +48,7 @@
public SimplePriorityQueue(Comparison<TPriority> priorityComparer) : this(priorityComparer, EqualityComparer<TItem>.Default) { }
/// <summary>
/// Instantiate a new Priority Queue
/// Instantiate a new Priority Queue
/// </summary>
/// <param name="itemEquality">The equality comparison function to use to compare TItem values</param>
public SimplePriorityQueue(IEqualityComparer<TItem> itemEquality) : this(Comparer<TPriority>.Default, itemEquality) { }
@@ -309,9 +309,9 @@
}
/// <summary>
/// Removes an item from the queue. The item does not need to be the head of the queue.
/// Removes an item from the queue. The item does not need to be the head of the queue.
/// If the item is not in the queue, an exception is thrown. If unsure, check Contains() first.
/// If multiple copies of the item are enqueued, only the first one is removed.
/// If multiple copies of the item are enqueued, only the first one is removed.
/// O(log n)
/// </summary>
public void Remove(TItem item)
@@ -432,16 +432,16 @@
}
}
}
first = default(TItem);
return false;
}
/// <summary>
/// Attempts to remove an item from the queue. The item does not need to be the head of the queue.
/// Attempts to remove an item from the queue. The item does not need to be the head of the queue.
/// Useful for multi-threading, where the queue may become empty between calls to Contains() and Remove()
/// Returns true if the item was successfully removed, false if it wasn't in the queue.
/// If multiple copies of the item are enqueued, only the first one is removed.
/// If multiple copies of the item are enqueued, only the first one is removed.
/// O(log n)
/// </summary>
public bool TryRemove(TItem item)
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -32,7 +32,7 @@ namespace Core.Animation
};
}
public static IEnumerator EnumerateValue(float from,
public static IEnumerator EnumerateValueAsync(float from,
float to,
float duration,
AnimationCurveType curveType,
@@ -57,12 +57,12 @@ namespace Core.Animation
if (!cancellationToken.IsCancellationRequested)
{
onValueChanged?.Invoke(to);
onValueChanged?.Invoke(to);
}
yield return null;
}
public static IEnumerator MoveTransform(Transform target,
public static IEnumerator MoveTransformAsync(Transform target,
Vector3 toPosition,
float duration,
AnimationCurveType curveType = AnimationCurveType.Linear,
@@ -83,7 +83,7 @@ namespace Core.Animation
yield return null;
}
public static IEnumerator ShakeTransform(Transform target,
public static IEnumerator ShakeTransformAsync(Transform target,
float duration,
float amplitude,
bool shakeOnXAxis,
@@ -107,7 +107,7 @@ namespace Core.Animation
yield return null;
}
public static IEnumerator OrbitTransformAroundCenterPoint(Transform target,
public static IEnumerator OrbitTransformAroundCenterPointAsync(Transform target,
Quaternion toRotation,
Vector3 centerPoint,
float duration,
@@ -139,11 +139,11 @@ namespace Core.Animation
target.rotation = toRotation;
target.position = centerPoint + (toRotation * Vector3.forward).normalized * -(distance + distanceDelta);
}
yield return null;
}
public static IEnumerator RotateTransform(Transform target,
public static IEnumerator RotateTransformAsync(Transform target,
Quaternion toRotation,
float duration,
AnimationCurveType curveType,
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -17,9 +17,10 @@ namespace Core.DataLoader
/// </summary>
/// <param name="filePath">Audio file path</param>
/// <param name="audioType">Audio type</param>
/// <param name="streamAudio">Create streaming AudioClip</param>
/// <param name="callback">AudioClip callback invoker</param>
/// <returns>IEnumerator</returns>
public static IEnumerator LoadAudioClip(string filePath, AudioType audioType, Action<AudioClip> callback)
public static IEnumerator LoadAudioClipAsync(string filePath, AudioType audioType, bool streamAudio, Action<AudioClip> callback)
{
if (filePath.StartsWith("/")) filePath = filePath[1..];
@@ -36,6 +37,10 @@ namespace Core.DataLoader
{
try
{
// Stream audio to avoid loading the entire AudioClip into memory at once,
// which can cause frame drops and stuttering during gameplay.
((DownloadHandlerAudioClip) request.downloadHandler).streamAudio = streamAudio;
AudioClip audioClip = DownloadHandlerAudioClip.GetContent(request);
callback?.Invoke(audioClip);
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -32,7 +32,6 @@ namespace Core.DataLoader
DxtHeader header = DxtHeader.ReadHeader(reader);
var format = header.DxtPixelFormat.Format;
hasAlphaChannel = true;
_width = header.Width;
_height = header.Height;
@@ -40,9 +39,11 @@ namespace Core.DataLoader
switch (format)
{
case "DXT1":
hasAlphaChannel = false;
LoadDxt1Texture(data);
break;
case "DXT3":
hasAlphaChannel = true;
LoadDxt3Texture(data);
break;
case "DXT5":
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -13,9 +13,9 @@ namespace Core.DataLoader
public interface ITextureResourceProvider
{
string GetTexturePath(string name);
Texture2D GetTexture(string name);
Texture2D GetTexture(string name, out bool hasAlphaChannel);
}
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -11,6 +11,7 @@ namespace Core.DataReader.Cpk
using System.Runtime.InteropServices;
using System.Text;
using Lzo;
using UnityEngine;
using Utils;
/// <summary>
@@ -32,7 +33,7 @@ namespace Core.DataReader.Cpk
private readonly Dictionary<uint, byte[]> _fileNameMap = new ();
private readonly Dictionary<uint, uint> _crcToTableIndexMap = new ();
private readonly Dictionary<uint, HashSet<uint>> _fatherCrcToChildCrcTableIndexMap = new ();
private bool _archiveInMemory;
private byte[] _archiveData;
@@ -94,6 +95,33 @@ namespace Core.DataReader.Cpk
BuildCrcIndexMap();
}
/// <summary>
/// Extract the complete archive to the specified destination
/// </summary>
public void ExtractTo(string outputFolder)
{
ExtractToInternal(outputFolder, GetRootEntries());
}
private void ExtractToInternal(string outputFolder, IEnumerable<CpkEntry> nodes)
{
foreach (CpkEntry node in nodes)
{
var relativePath = node.VirtualPath.Replace(
CpkConstants.DirectorySeparator, Path.DirectorySeparatorChar);
if (node.IsDirectory)
{
new DirectoryInfo(outputFolder + relativePath).Create();
ExtractToInternal(outputFolder, node.Children);
}
else
{
File.WriteAllBytes(outputFolder + relativePath, ReadAllBytes(node.VirtualPath));
}
}
}
/// <summary>
/// Check if file exists inside the archive.
/// </summary>
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+20 -32
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -25,17 +25,11 @@ namespace Core.DataReader.Cpk
for (uint i = 0; i < CRC_TABLE_MAX; i++)
{
var crcAccum = i << 24;
for (var j = 0; j < 8; j++)
{
if ((crcAccum & 0x80000000L) != 0)
{
crcAccum = (crcAccum << 1) ^ POLYNOMIAL;
}
else
{
crcAccum = (crcAccum << 1);
}
crcAccum = (crcAccum & 0x80000000L) != 0 ?
(crcAccum << 1) ^ POLYNOMIAL :
crcAccum << 1;
}
CrcTable[i] = crcAccum;
}
@@ -51,35 +45,29 @@ namespace Core.DataReader.Cpk
private unsafe uint ComputeCrc32HashInternal(byte[] data)
{
if (!_initialized) throw new Exception("CrcHash not initialized yet.");
if (!_initialized) throw new InvalidOperationException("CrcHash not initialized yet.");
var length = data.Length;
if (length == 0 || data[0] == 0) return 0;
var index = 0;
fixed (byte* srcStart = &data[0])
if (data == null || data.Length == 0 || data[0] == 0)
{
var p = srcStart;
uint result = (uint)(*(p + index++) << 24);
if (index < length && *(p + index) != 0)
{
result |= (uint)(*(p + index++) << 16);
return 0;
}
if(index < length && *(p + index) != 0)
{
result |= (uint)(*(p + index++) << 8);
if (index < length && *(p + index) != 0)
{
result |= *(p + index++);
}
}
fixed (byte* srcStart = data)
{
byte* ptr = srcStart;
uint result = (uint)(*ptr++ << 24);
for (int i = 1; i < 4 && i < data.Length; i++)
{
if (*ptr == 0) break;
result |= (uint)(*ptr++ << (24 - 8 * i));
}
result = ~result;
while (index < length && *(p + index) != 0)
for (int i = 4; i < data.Length && *ptr != 0; i++, ptr++)
{
result = (result << 8 | *(p + index)) ^ CrcTable[result >> 24];
index++;
result = (result << 8 | *ptr) ^ CrcTable[result >> 24];
}
return ~result;
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -152,7 +152,7 @@ namespace Core.DataReader.Cvd
{
public CvdVertex[][] FrameVertices;
public int[] Triangles;
public byte BlendFlag;
public GameBoxBlendFlag BlendFlag;
public GameBoxMaterial Material;
public string TextureName;
public float[] AnimationTimeKeys;
@@ -173,12 +173,12 @@ namespace Core.DataReader.Cvd
public class CvdAnimationScaleKeyFrame : CvdAnimationKeyFrame
{
public Vector3 Scale { get; set; }
public GameBoxQuaternion Rotation { get; set; }
public Quaternion Rotation { get; set; }
}
public class CvdAnimationRotationKeyFrame : CvdAnimationKeyFrame
{
public GameBoxQuaternion Rotation { get; set; }
public Quaternion Rotation { get; set; }
}
/// <summary>
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -193,7 +193,7 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = positionKey.TcbKey.AnimationKey.Time,
Position = positionKey.Value,
Position = GameBoxInterpreter.CvdPositionToUnityPosition(positionKey.Value),
};
break;
}
@@ -204,7 +204,7 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = positionKey.AnimationKey.Time,
Position = positionKey.Value,
Position = GameBoxInterpreter.CvdPositionToUnityPosition(positionKey.Value),
};
break;
}
@@ -215,7 +215,7 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = positionKey.AnimationKey.Time,
Position = positionKey.Value,
Position = GameBoxInterpreter.CvdPositionToUnityPosition(positionKey.Value),
};
break;
}
@@ -248,13 +248,13 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = rotationKey.TcbKey.AnimationKey.Time,
Rotation = new GameBoxQuaternion()
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(new GameBoxQuaternion()
{
X = quaternion.x,
Y = quaternion.y,
Z = quaternion.z,
W = quaternion.w,
}
})
};
break;
}
@@ -265,7 +265,7 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = rotationKey.AnimationKey.Time,
Rotation = rotationKey.Value
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(rotationKey.Value)
};
break;
}
@@ -276,7 +276,7 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = rotationKey.AnimationKey.Time,
Rotation = rotationKey.Value
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(rotationKey.Value)
};
break;
}
@@ -308,8 +308,8 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = scaleKey.TcbKey.AnimationKey.Time,
Scale = scaleKey.Value,
Rotation = scaleKey.Rotation
Scale = GameBoxInterpreter.CvdScaleToUnityScale(scaleKey.Value),
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(scaleKey.Rotation)
};
break;
}
@@ -320,8 +320,8 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = scaleKey.AnimationKey.Time,
Scale = scaleKey.Value,
Rotation = scaleKey.Rotation
Scale = GameBoxInterpreter.CvdScaleToUnityScale(scaleKey.Value),
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(scaleKey.Rotation)
};
break;
}
@@ -332,8 +332,8 @@ namespace Core.DataReader.Cvd
{
KeyType = type,
Time = scaleKey.AnimationKey.Time,
Scale = scaleKey.Value,
Rotation = scaleKey.Rotation
Scale = GameBoxInterpreter.CvdScaleToUnityScale(scaleKey.Value),
Rotation = GameBoxInterpreter.CvdQuaternionToUnityQuaternion(scaleKey.Rotation)
};
break;
}
@@ -352,9 +352,6 @@ namespace Core.DataReader.Cvd
var numberOfFrames = reader.ReadInt32();
var numberOfVertices = reader.ReadInt32();
//var vertexType = GameBoxVertexType.XYZ | GameBoxVertexType.Normal | GameBoxVertexType.UV0;
//var vertexSize = GameBoxVertex.GetSize((uint)vertexType);
var frameVertices = new CvdVertex[numberOfFrames][];
for (var i = 0; i < numberOfFrames; i++)
{
@@ -362,8 +359,11 @@ namespace Core.DataReader.Cvd
for (var j = 0; j < numberOfVertices; j++)
{
Vector2 uv = reader.ReadVector2();
Vector3 normal = reader.ReadVector3();
Vector3 position = reader.ReadVector3();
Vector3 normal = GameBoxInterpreter.ToUnityNormal(reader.ReadVector3());
Vector3 position = GameBoxInterpreter.CvdPositionToUnityPosition(reader.ReadVector3());
// Quick fix for the missing/wrong normals
if (normal == Vector3.zero) normal = Vector3.up;
vertices[j] = new CvdVertex()
{
@@ -407,7 +407,7 @@ namespace Core.DataReader.Cvd
int codepage)
#endif
{
var blendFlag = reader.ReadByte();
var blendFlag = (GameBoxBlendFlag)reader.ReadByte();
var material = new GameBoxMaterial()
{
@@ -422,12 +422,12 @@ namespace Core.DataReader.Cvd
var numberOfIndices = reader.ReadInt32();
var indices = new (short x, short y, short z)[numberOfIndices];
var indices = new (ushort x, ushort y, ushort z)[numberOfIndices];
for (var i = 0; i < numberOfIndices; i++)
{
var x = reader.ReadInt16();
var y = reader.ReadInt16();
var z = reader.ReadInt16();
var x = reader.ReadUInt16();
var y = reader.ReadUInt16();
var z = reader.ReadUInt16();
indices[i] = (x, y, z);
}
@@ -458,10 +458,10 @@ namespace Core.DataReader.Cvd
}
var frameVertices = new CvdVertex[allFrameVertices.Length][];
List<int> triangles;
List<int> indexBuffer;
(triangles, indexBuffer) = CalculateTriangles(indices);
(List<int> triangles, List<int> indexBuffer) = CalculateTriangles(indices);
GameBoxInterpreter.ToUnityTriangles(triangles);
for (var i = 0; i < allFrameVertices.Length; i++)
{
@@ -489,11 +489,11 @@ namespace Core.DataReader.Cvd
}
private static (List<int> triangles, List<int> indexBuffer) CalculateTriangles(
(short x, short y, short z)[] allIndices)
(ushort x, ushort y, ushort z)[] allIndices)
{
var indexBuffer = new List<int>();
var triangles = new List<int>();
var indexMap = new Dictionary<int, int>();
var index = 0;
for (var j = 0; j < allIndices.Length; j++)
{
@@ -506,17 +506,8 @@ namespace Core.DataReader.Cvd
for (var k = 0; k < 3; k++)
{
if (indexMap.ContainsKey(indices[k]))
{
triangles.Add(indexMap[indices[k]]);
}
else
{
var index = indexBuffer.Count;
indexBuffer.Add(indices[k]);
indexMap[indices[k]] = index;
triangles.Add(index);
}
indexBuffer.Add(indices[k]);
triangles.Add(index++);
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6277e4ab422e47bdadc0826e97a1dbe3
timeCreated: 1665782936
@@ -0,0 +1,129 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Data
{
//using System.Runtime.InteropServices;
//[StructLayout(LayoutKind.Explicit)]
public struct EffectDefinition
{
//[FieldOffset(0)]
public uint ClassNameCrc;
//[FieldOffset(4)]
//[MarshalAs (UnmanagedType.ByValArray, SizeConst = 30)]
public string TypeName;
//[FieldOffset(36)]
public uint TypeNameCrc;
//[FieldOffset(40)]
//[MarshalAs (UnmanagedType.ByValArray, SizeConst = 128)]
// Union
public string TextureName;
public string ParticleFileName;
public string SfxFileNamePrefix;
public string VideoFileNamePrefix;
//[FieldOffset(168)]
public int FramesPerRow;
//[FieldOffset(172)]
public int FramesPerColumn;
//[FieldOffset(176)]
public int FrameCount;
//[FieldOffset(180)]
public float FramePerSecond;
//[FieldOffset(184)]
public float InitXPosition;
//[FieldOffset(188)]
public float InitYPosition;
//[FieldOffset(192)]
public float InitZPosition;
//[FieldOffset(196)]
// Union
public float InitYRotation;
public float InitAngle;
//[FieldOffset(200)]
public int InitSize;
//[FieldOffset(204)]
public uint InitColor;
//[FieldOffset(208)]
public int MaxQuadCount;
//[FieldOffset(212)]
public bool IsValid;
//[FieldOffset(213)]
public bool IsAdditiveBlend;
//[FieldOffset(214)]
public bool IsBillboard;
//[FieldOffset(215)]
public bool IsZTestIgnored;
//[FieldOffset(216)]
public float InitXRotation;
//[FieldOffset(220)]
public float InitZRotation;
//[FieldOffset(224)]
public float RotationAngle;
//[FieldOffset(228)]
public float Width;
//[FieldOffset(232)]
public float DivisionCount;
//[FieldOffset(236)]
public float TopShrink;
//[FieldOffset(240)]
public float BottomShrink;
//[FieldOffset(244)]
public float TopRadius;
//[FieldOffset(248)]
public float BottomRadius;
//[FieldOffset(252)]
public float TopRadiusIncreaseSpeed;
//[FieldOffset(256)]
public float BottomRadiusIncreaseSpeed;
//[FieldOffset(260)]
public float TopRiseSpeed;
//[FieldOffset(264)]
public float BottomRiseSpeed;
//[FieldOffset(268)]
public float TextureRepeat;
//[FieldOffset(272)]
//[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
public float[] Param;
}
public class EffectDefinitionFile
{
public EffectDefinition[] EffectDefinitions;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3c47b38acef943118e9374c4113e7b5e
timeCreated: 1665782973
@@ -0,0 +1,107 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
//#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Data
{
using System.IO;
using Extensions;
using Utils;
public static class EffectDefinitionFileReader
{
private const int NUM_OF_EFFECTS = 1324;
public static void Read(byte[] data, int codepage)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var effectDefinitions = new EffectDefinition[NUM_OF_EFFECTS];
for (var i = 0; i < NUM_OF_EFFECTS; i++)
{
effectDefinitions[i] = ReadEffectDefinition(reader, codepage);
}
}
#if USE_UNSAFE_BINARY_READER
private static EffectDefinition ReadEffectDefinition(UnsafeBinaryReader reader, int codepage)
#else
private static EffectDefinition ReadEffectDefinition(BinaryReader reader, int codepage)
#endif
{
var effectDefinition = new EffectDefinition();
effectDefinition.ClassNameCrc = reader.ReadUInt32();
effectDefinition.TypeName = reader.ReadString(32, 936);
effectDefinition.TypeNameCrc = reader.ReadUInt32();
// union
{
var unionStr = reader.ReadString(128, 936);
effectDefinition.TextureName = unionStr;
effectDefinition.ParticleFileName = unionStr;
effectDefinition.SfxFileNamePrefix = unionStr;
effectDefinition.VideoFileNamePrefix = unionStr;
}
effectDefinition.FramesPerRow = reader.ReadInt32();
effectDefinition.FramesPerColumn = reader.ReadInt32();
effectDefinition.FrameCount = reader.ReadInt32();
effectDefinition.FramePerSecond = reader.ReadSingle();
effectDefinition.InitXPosition = reader.ReadSingle();
effectDefinition.InitYPosition = reader.ReadSingle();
effectDefinition.InitZPosition = reader.ReadSingle();
// union
{
var unionFloat = reader.ReadSingle();
effectDefinition.InitYRotation = unionFloat;
effectDefinition.InitAngle = unionFloat;
}
effectDefinition.InitSize = reader.ReadInt32();
effectDefinition.InitColor = reader.ReadUInt32();
effectDefinition.MaxQuadCount = reader.ReadInt32();
effectDefinition.IsValid = reader.ReadBoolean();
effectDefinition.IsAdditiveBlend = reader.ReadBoolean();
effectDefinition.IsBillboard = reader.ReadBoolean();
effectDefinition.IsZTestIgnored = reader.ReadBoolean();
effectDefinition.InitXRotation = reader.ReadSingle();
effectDefinition.InitZRotation = reader.ReadSingle();
effectDefinition.RotationAngle = reader.ReadSingle();
effectDefinition.Width = reader.ReadSingle();
effectDefinition.DivisionCount = reader.ReadSingle();
effectDefinition.TopShrink = reader.ReadSingle();
effectDefinition.BottomShrink = reader.ReadSingle();
effectDefinition.TopRadius = reader.ReadSingle();
effectDefinition.BottomRadius = reader.ReadSingle();
effectDefinition.TopRadiusIncreaseSpeed = reader.ReadSingle();
effectDefinition.BottomRadiusIncreaseSpeed = reader.ReadSingle();
effectDefinition.TopRiseSpeed = reader.ReadSingle();
effectDefinition.BottomRiseSpeed = reader.ReadSingle();
effectDefinition.TextureRepeat = reader.ReadSingle();
effectDefinition.Param = new[]
{
reader.ReadSingle(),
reader.ReadSingle(),
};
return effectDefinition;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a324f42c7b6346dc8c98a2c6c377c9d6
timeCreated: 1665784313
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4dd4c4efb70347a2ba8cc981e6ffc018
timeCreated: 1668071055
@@ -0,0 +1,154 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Gdb
{
using System.Collections.Generic;
public enum WuLingType
{
Water, // 水
Fire, // 火
Wind, // 风
Thunder, // 雷
Earth, // 土
}
public enum ItemType
{
None = 0,
Healing, // 治疗
Throwable, // 投掷
Treasure, // 仙宝
Antique, // 古董
Ore, // 矿石
Plot, // 剧情
Cloth, // 衣服
Hat, // 帽子
Shoes, // 鞋子
Wearable, // 饰品
Weapon, // 武器
Corpse, // 尸块
Blueprint, // 蓝图(梦溪杂录,美食方)
}
public enum WeaponType
{
None = 0,
Spear, // 长矛
Sword, // 剑
Staff, // 杖
Machete, // 刀
Bow, // 弓
Spine, // 刺
Sickle, // 镰刀
}
public enum SpecialType
{
None = 0,
Poison, // 随机中毒
Flee, // 100%逃跑
Navigation, // 引路蜂类
LevelUp, // 升级类(等级提高1)
}
public enum TargetRangeType
{
None = 0,
FirstParty, // 我方单体
FirstPartyAll, // 我方全体
EnemyParty, // 敌方单体
EnemyPartyAll, // 敌方全体
}
public enum PlaceOfUseType
{
None = 0,
Combat, // 战斗中
OutOfCombat, // 非战斗中
Anywhere, // 任何地方
}
public enum ActorAttributeType
{
Hp, // 精
Qi, // 气
Mp, // 神
Attack, // 攻击
Defense, // 防御
Speed, // 速度
Luck, // 幸运
Water, // 水
Fire, // 火
Wind, // 风
Thunder, // 雷
Earth, // 土
}
public struct GameItem
{
public uint Id; // 物品ID
public string Name; // 物品名称
public string ModelName; // 物品模型名称
public string IconName; // 物品图标名称
public string Description; // 物品描述
public int Price; // 物品价格
public ItemType Type; // 物品类型
public WeaponType WeaponType; // 武器类型(只有物品为武器的时候有意义)
public byte[] MainActorCanUse; // 主角可使用信息
public byte[] WuLing; // 五灵属性
public int AncientValue; // 古董价值
public SpecialType SpecialType; // 特殊类型
public TargetRangeType TargetRangeType; // 目标范围类型
public PlaceOfUseType PlaceOfUseType; // 使用地点类型
public byte[] AttributeImpactType; // 角色属性影响类型 (0绝对值,1百分比值,2恢复到上限,3增加上限值)
// Empty byte between the memory addresses to align the data in memory.
// SpecialType, TargetRangeType and PlaceOfUseType take 3 bytes in memory, thus we need to add 1 byte here
// to align the data in memory (4 bytes).
// Note: The padding byte is added after AttributeImpactType instead of before based on observation.
internal byte PaddingByte;
public short[] AttributeImpactValue; // 角色属性影响值
public byte[] FightStateImpactType; // 战斗状态影响类型(0不影响,1增加,2解除)
public short[] FightStateImpactValue; // 战斗状态值
public int ComboCount; // 连击次数
// 装备属性
public short QiSavingPercentage; // 气消耗减少百分比
public short MpSavingPercentage; // 神消耗减少百分比
public short CriticalAttackAmplifyPercentage; // 暴击伤害增加百分比
public short SpecialSkillSuccessRate; // 特技成功率增加百分比
// 尸块属性
public uint OreId; // 矿石ID
public uint ProductId; // 炼制出的物品ID
public int ProductPrice; // 炼制出的物品价格
// 合成属性
public uint[] SynthesisMaterialIds; // 两种合成材料的ID
public uint SynthesisProductId; // 合成出的物品ID
}
// Pal3 Game Database file
public class GdbFile
{
public Dictionary<int, GameItem> GameItems { get; } // Game item Id -> Game item
public GdbFile(Dictionary<int, GameItem> gameItems)
{
GameItems = gameItems;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f266e43f10ee4eb1b95cfd541c518a39
timeCreated: 1668071064
@@ -0,0 +1,80 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Gdb
{
using System.Collections.Generic;
using System.IO;
using Extensions;
public static class GdbFileReader
{
public static GdbFile Read(byte[] data, int codepage)
{
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
_ = reader.ReadString(128, codepage); // header string
uint actorDataOffset = reader.ReadUInt32();
int numOfActors = reader.ReadInt32();
uint skillDataOffset = reader.ReadUInt32();
int numOfSkills = reader.ReadInt32();
uint itemDataOffset = reader.ReadUInt32();
int numOfItems = reader.ReadInt32();
uint comboSkillDataOffset = reader.ReadUInt32();
int numOfComboSkills = reader.ReadInt32();
reader.BaseStream.Seek(itemDataOffset, SeekOrigin.Begin);
var gameItems = new Dictionary<int, GameItem>();
for (var i = 0; i < numOfItems; i++)
{
GameItem item = ReadGameItem(reader, codepage);
gameItems[(int) item.Id] = item;
}
return new GdbFile(gameItems);
}
private static GameItem ReadGameItem(BinaryReader reader, int codepage)
{
return new GameItem
{
Id = reader.ReadUInt32(),
Name = reader.ReadString(32, codepage),
ModelName = reader.ReadString(30, codepage),
IconName = reader.ReadString(30, codepage),
Description = reader.ReadString(512, codepage),
Price = reader.ReadInt32(),
Type = (ItemType) reader.ReadByte(),
WeaponType = (WeaponType) reader.ReadByte(),
MainActorCanUse = reader.ReadBytes(5),
WuLing = reader.ReadBytes(5),
AncientValue = reader.ReadInt32(),
SpecialType = (SpecialType) reader.ReadByte(), // ----------------| 1
TargetRangeType = (TargetRangeType) reader.ReadByte(), // --------| 2
PlaceOfUseType = (PlaceOfUseType) reader.ReadByte(), // ----------| 3
AttributeImpactType = reader.ReadBytes(12),
PaddingByte = reader.ReadByte(), // ------------------------------| ^ to complete 4-byte alignment
AttributeImpactValue = reader.ReadInt16Array(12),
FightStateImpactType = reader.ReadBytes(32),
FightStateImpactValue = reader.ReadInt16Array(32),
ComboCount = reader.ReadInt32(),
QiSavingPercentage = reader.ReadInt16(),
MpSavingPercentage = reader.ReadInt16(),
CriticalAttackAmplifyPercentage = reader.ReadInt16(),
SpecialSkillSuccessRate = reader.ReadInt16(),
OreId = reader.ReadUInt32(),
ProductId = reader.ReadUInt32(),
ProductPrice = reader.ReadInt32(),
SynthesisMaterialIds = reader.ReadUInt32Array(2),
SynthesisProductId = reader.ReadUInt32()
};
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1575b1b777f8491b9b6fbc051b936b47
timeCreated: 1668071081
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7033622484af4557882d201a3784de14
timeCreated: 1665907414
@@ -0,0 +1,44 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Lgt
{
using GameBox;
using UnityEngine;
[System.Serializable]
public struct LightNode
{
public Matrix4x4 WorldMatrix;
public GameBoxLightType LightType;
public Color LightColor;
public Color AmbientColor;
public bool UseDiffuse;
public bool UseSpecular;
public float NearStart;
public float NearEnd;
public float FarStart;
public float FarEnd;
public GameBoxLightDecayType LightDecayType;
public float DecayRadius;
public GameBoxLightShapeType LightShapeType;
public float Size;
public float Falloff;
public float AspectRatio;
}
public class LgtFile
{
public LightNode[] LightNodes { get; }
public LgtFile(LightNode[] lightNodes)
{
LightNodes = lightNodes;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 25179e1de24d41698cd68a919c3d0990
timeCreated: 1665907430
@@ -0,0 +1,83 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Lgt
{
using System;
using System.Collections.Generic;
using System.IO;
using Extensions;
using GameBox;
using Utils;
public static class LgtFileReader
{
public static LgtFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var numOfLightNodes = reader.ReadInt32();
var lightNodes = new List<LightNode>();
for (var i = 0; i < numOfLightNodes; i++)
{
var lightNode = ReadLightNode(reader);
if (Enum.IsDefined(typeof(GameBoxLightType), lightNode.LightType) &&
Enum.IsDefined(typeof(GameBoxLightShapeType), lightNode.LightShapeType))
{
lightNodes.Add(lightNode);
}
}
return new LgtFile(lightNodes.ToArray());
}
#if USE_UNSAFE_BINARY_READER
private static LightNode ReadLightNode(UnsafeBinaryReader reader)
#else
private static LightNode ReadLightNode(BinaryReader reader)
#endif
{
var transformMatrix = new GameBoxMatrix4X4()
{
Xx = reader.ReadSingle(), Xy = reader.ReadSingle(), Xz = reader.ReadSingle(), Xw = reader.ReadSingle(),
Yx = reader.ReadSingle(), Yy = reader.ReadSingle(), Yz = reader.ReadSingle(), Yw = reader.ReadSingle(),
Zx = reader.ReadSingle(), Zy = reader.ReadSingle(), Zz = reader.ReadSingle(), Zw = reader.ReadSingle(),
Tx = reader.ReadSingle(), Ty = reader.ReadSingle(), Tz = reader.ReadSingle(), Tw = reader.ReadSingle()
};
transformMatrix.Tw = 1f;
var lightNode = new LightNode
{
WorldMatrix = GameBoxInterpreter.ToUnityMatrix4x4(transformMatrix),
LightType = (GameBoxLightType)reader.ReadInt32(),
LightColor = Utility.ToColor(reader.ReadSingleArray(4)),
AmbientColor = Utility.ToColor(reader.ReadSingleArray(4)),
UseDiffuse = reader.ReadBoolean(),
UseSpecular = reader.ReadBoolean(),
NearStart = reader.ReadSingle(),
NearEnd = reader.ReadSingle(),
FarStart = reader.ReadSingle(),
FarEnd = reader.ReadSingle(),
LightDecayType = (GameBoxLightDecayType)reader.ReadInt32(),
DecayRadius = reader.ReadSingle(),
LightShapeType = (GameBoxLightShapeType)reader.ReadInt32(),
Size = reader.ReadSingle(),
Falloff = reader.ReadSingle(),
AspectRatio = reader.ReadSingle()
};
return lightNode;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f29568c4d19d4fcca931e8bf250ccc01
timeCreated: 1665907439
+7 -11
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -77,19 +77,18 @@ namespace Core.DataReader.Mv3
public struct Mv3Mesh
{
public string Name; // 64 chars max
public GameBoxAABBox BoundBox;
public Bounds Bounds;
public Mv3Attribute[] Attributes;
public Mv3VertFrame[] Frames;
public Vector2[] TexCoords;
public Vector3[] Normals;
public int[] Triangles;
public Vector2[] Uvs;
public VertexAnimationKeyFrame[] KeyFrames;
}
public struct VertexAnimationKeyFrame
{
public uint Tick;
public Vector3[] Vertices;
public Vector3[] Normals;
public int[] Triangles;
public Vector2[] Uv;
}
/// <summary>
@@ -103,15 +102,13 @@ namespace Core.DataReader.Mv3
public Mv3TagNode[] TagNodes { get; }
public Mv3Material[] Materials { get; }
public Mv3Mesh[] Meshes { get; }
public VertexAnimationKeyFrame[][] MeshKeyFrames { get; }
public Mv3File(int version,
uint duration,
Mv3AnimationEvent[] animationEvents,
Mv3TagNode[] tagNodes,
Mv3Material[] materials,
Mv3Mesh[] meshes,
VertexAnimationKeyFrame[][] meshKeyFrames)
Mv3Mesh[] meshes)
{
Version = version;
Duration = duration;
@@ -119,7 +116,6 @@ namespace Core.DataReader.Mv3
TagNodes = tagNodes;
Materials = materials;
Meshes = meshes;
MeshKeyFrames = meshKeyFrames;
}
}
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -28,7 +28,7 @@ namespace Core.DataReader.Mv3
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
if (headerStr != "MV3")
{
throw new InvalidDataException("Invalid MV3(.mv3) file: header != MV3");
@@ -70,12 +70,9 @@ namespace Core.DataReader.Mv3
}
var meshes = new Mv3Mesh[numberOfMeshes];
var meshKeyFrames = new VertexAnimationKeyFrame[numberOfMeshes][];
for (var i = 0; i < numberOfMeshes; i++)
{
Mv3Mesh mesh = ReadMesh(reader, codepage);
meshes[i] = mesh;
meshKeyFrames[i] = CalculateKeyFrameVertices(mesh);
meshes[i] = ReadMesh(reader, codepage);
}
return new Mv3File(version,
@@ -83,8 +80,7 @@ namespace Core.DataReader.Mv3
animationEvents,
tagNodes,
materials,
meshes,
meshKeyFrames);
meshes);
}
#if USE_UNSAFE_BINARY_READER
@@ -95,11 +91,12 @@ namespace Core.DataReader.Mv3
{
var name = reader.ReadString(64, codepage);
var numberOfVertices = reader.ReadInt32();
var boundBox = new GameBoxAABBox()
{
Min = reader.ReadVector3(),
Max = reader.ReadVector3()
};
var bounds = new Bounds();
bounds.SetMinMax(
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()),
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()));
var numberOfFrames = reader.ReadInt32();
var frames = new Mv3VertFrame[numberOfFrames];
for (var i = 0; i < numberOfFrames; i++)
@@ -127,7 +124,7 @@ namespace Core.DataReader.Mv3
Vector2[] texCoords;
if (numberOfTexCoords == 0)
{
texCoords = new Vector2[] {new (0f, 0f)};
texCoords = new Vector2[] { new (0f, 0f) };
Debug.LogWarning("numberOfTexCoords == 0");
}
else
@@ -171,70 +168,65 @@ namespace Core.DataReader.Mv3
};
}
return new Mv3Mesh()
{
Name = name,
BoundBox = boundBox,
Attributes = attributes,
Frames = frames,
TexCoords = texCoords,
};
return GetMv3Mesh(name, bounds, attributes, frames, texCoords);
}
private static VertexAnimationKeyFrame[] CalculateKeyFrameVertices(Mv3Mesh mv3Mesh)
private static Mv3Mesh GetMv3Mesh(string name,
Bounds bounds,
Mv3Attribute[] attributes,
Mv3VertFrame[] vertFrames,
Vector2[] texCoords)
{
var triangles = new List<int>();
var texCoords = mv3Mesh.TexCoords;
var indexMap = new Dictionary<int, int>();
var keyFrameInfo = new List<(Vector3 vertex, Vector2 uv)>[mv3Mesh.Frames.Length]
.Select(item=>new List<(Vector3 vertex, Vector2 uv)>()).ToArray();
var triangles = new int[attributes[0].IndexBuffers.Length * 3];
var keyFrameVertices = new List<Vector3>[vertFrames.Length]
.Select(item=>new List<Vector3>()).ToArray();
var uvs = new Vector2[attributes[0].IndexBuffers.Length * 3];
for (var i = 0; i < mv3Mesh.Attributes[0].IndexBuffers.Length; i++)
var triangleIndex = 0;
for (var i = 0; i < attributes[0].IndexBuffers.Length; i++)
{
Mv3IndexBuffer indexBuffer = mv3Mesh.Attributes[0].IndexBuffers[i];
Mv3IndexBuffer indexBuffer = attributes[0].IndexBuffers[i];
for (var j = 0; j < 3; j++)
{
var hash = indexBuffer.TriangleIndex[j] * texCoords.Length + indexBuffer.TexCoordIndex[j];
if (indexMap.ContainsKey(hash))
for (var k = 0; k < vertFrames.Length; k++)
{
triangles.Add(indexMap[hash]);
Mv3VertFrame frame = vertFrames[k];
Mv3Vert vertex = frame.Vertices[indexBuffer.TriangleIndex[j]];
keyFrameVertices[k].Add((GameBoxInterpreter
.ToUnityVertex(new Vector3(vertex.X, vertex.Y, vertex.Z),
GameBoxInterpreter.GameBoxMv3UnitToUnityUnit)));
}
else
{
var index = indexMap.Keys.Count;
for (var k = 0; k < mv3Mesh.Frames.Length; k++)
{
Mv3VertFrame frame = mv3Mesh.Frames[k];
Mv3Vert vertex = frame.Vertices[indexBuffer.TriangleIndex[j]];
keyFrameInfo[k].Add((GameBoxInterpreter
.ToUnityVertex(new Vector3(vertex.X, vertex.Y, vertex.Z),
GameBoxInterpreter.GameBoxMv3UnitToUnityUnit),
texCoords[indexBuffer.TexCoordIndex[j]]));
}
indexMap[hash] = index;
triangles.Add(index);
}
uvs[triangleIndex] = texCoords[indexBuffer.TexCoordIndex[j]];
triangles[triangleIndex] = triangleIndex;
triangleIndex++;
}
}
GameBoxInterpreter.ToUnityTriangles(triangles);
var animationKeyFrames = new VertexAnimationKeyFrame[mv3Mesh.Frames.Length];
var animationKeyFrames = new VertexAnimationKeyFrame[vertFrames.Length];
for (var i = 0; i < animationKeyFrames.Length; i++)
{
animationKeyFrames[i] = new VertexAnimationKeyFrame()
{
Tick = mv3Mesh.Frames[i].Tick,
Vertices = keyFrameInfo[i].Select(f => f.vertex).ToArray(),
Triangles = triangles.ToArray(),
Uv = keyFrameInfo[i].Select(f => f.uv).ToArray(),
Tick = vertFrames[i].Tick,
Vertices = keyFrameVertices[i].ToArray(),
};
}
return animationKeyFrames;
return new Mv3Mesh
{
Name = name,
Bounds = bounds,
Attributes = attributes,
Triangles = triangles,
Uvs = uvs,
Normals = Utility.CalculateNormals(animationKeyFrames[0].Vertices, triangles),
KeyFrames = animationKeyFrames,
};
}
#if USE_UNSAFE_BINARY_READER
@@ -270,13 +262,13 @@ namespace Core.DataReader.Mv3
var tick = reader.ReadUInt32();
Vector3 position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3());
var rotation = new GameBoxQuaternion()
var rotation = GameBoxInterpreter.Mv3QuaternionToUnityQuaternion(new GameBoxQuaternion()
{
X = reader.ReadSingle(),
Y = reader.ReadSingle(),
Z = reader.ReadSingle(),
W = reader.ReadSingle(),
};
});
var scale = new []
{
@@ -289,7 +281,7 @@ namespace Core.DataReader.Mv3
{
Tick = tick,
Position = position,
Rotation = GameBoxInterpreter.Mv3QuaternionToUnityQuaternion(rotation),
Rotation = rotation,
Scale = scale,
};
}
+15 -13
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -48,23 +48,25 @@ namespace Core.DataReader.Nav
public struct NavTile
{
public float Y; // 格子地板高度
public ushort Distance; // 格子距离周边障碍物的距离 (0最小-7最大)
public NavFloorKind FloorKind; // 格子地板类型:0~128索引普通地面属性(土草雪等),128~255索引机关序号
public float GameBoxYPosition; // 格子地板高度(原GameBox引擎下的Y坐标单位)
public byte DistanceToNearestObstacle; // 格子距离周边障碍物的距离 (0最小-7最大)
public NavFloorKind FloorKind; // 格子地板类型:0~128索引普通地面属性(土草雪等),128~255索引机关序号
public bool IsObstacle; // 是否为障碍物
public bool IsWalkable()
{
return Distance > 0;
return !IsObstacle && DistanceToNearestObstacle > 0 && FloorKind != NavFloorKind.Jumpable;
}
}
public struct NavLayerNode
{
public GameBoxAABBox BoundBox;
public Vector3[] Triangles;
public int Level; // 0: root, child level = parent level + 1
public NavLayerNode[] Children; // 4
}
// public struct NavLayerNode
// {
// public GameBoxAABBox BoundBox;
// public Vector3[] Triangles;
// public int Level; // 0: root, child level = parent level + 1
// public NavLayerNode[] Children; // 4
// }
public struct NavTileLayer
{
@@ -80,7 +82,7 @@ namespace Core.DataReader.Nav
{
public Vector3[] Vertices;
public int[] Triangles;
public NavLayerNode[] Nodes;
//public NavLayerNode[] Nodes;
}
/// <summary>
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -7,9 +7,11 @@ namespace Core.DataReader.Nav
{
using System;
using System.IO;
using System.Linq;
using Extensions;
using GameBox;
using UnityEngine;
using Utils;
public static class NavFileReader
{
@@ -41,7 +43,7 @@ namespace Core.DataReader.Nav
var faceLayers = new NavFaceLayer[numberOfLayers];
for (var i = 0; i < numberOfLayers; i++)
{
faceLayers[i] = ReadFaceLayer(reader, version);
faceLayers[i] = ReadFaceLayer(reader);
}
return new NavFile(tileLayers, faceLayers);
@@ -50,6 +52,7 @@ namespace Core.DataReader.Nav
private static NavTileLayer ReadTileLayer(BinaryReader reader, byte version)
{
var portals = Array.Empty<GameBoxRect>();
if (version == 2)
{
portals = new GameBoxRect[8];
@@ -82,10 +85,11 @@ namespace Core.DataReader.Nav
{
tiles[i] = new NavTile
{
Y = reader.ReadSingle(),
Distance = reader.ReadUInt16(),
FloorKind = (NavFloorKind) reader.ReadUInt16()
GameBoxYPosition = reader.ReadSingle(),
DistanceToNearestObstacle = reader.ReadByte(), //---| 1
FloorKind = (NavFloorKind) reader.ReadByte() //----| 2
};
_ = reader.ReadBytes(2); //-----------------------------| ^ to complete 4-byte alignment
}
return new NavTileLayer()
@@ -99,14 +103,14 @@ namespace Core.DataReader.Nav
};
}
private static NavFaceLayer ReadFaceLayer(BinaryReader reader, byte version)
private static NavFaceLayer ReadFaceLayer(BinaryReader reader)
{
var numberOfVertices = reader.ReadUInt16();
var numberOfFaces = reader.ReadUInt16();
var vertices = new Vector3[numberOfVertices];
for (var i = 0; i < numberOfVertices; i++)
{
vertices[i] = reader.ReadVector3();
vertices[i] = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3());
}
var triangles = new int[numberOfFaces * 3];
@@ -118,6 +122,27 @@ namespace Core.DataReader.Nav
triangles[index + 2] = reader.ReadUInt16();
}
// Some of the nav meshes in the original game are upside down (don't know why),
// so we need to flip them if that's the case. You might argue that we can just
// make the mesh double sided, but that would cause some other issues (trust me).
{
Vector3[] normals = Utility.CalculateNormals(vertices, triangles);
for (var i = 0; i < numberOfFaces; i++)
{
var index = i * 3;
// Determine if the face is pointing downwards.
if (normals[triangles[index]].y +
normals[triangles[index + 1]].y +
normals[triangles[index + 2]].y < 0)
{
// Change the winding order of the face to make it point upwards.
(triangles[index], triangles[index + 1]) = (triangles[index + 1], triangles[index]);
}
}
}
return new NavFaceLayer()
{
Vertices = vertices,
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -28,7 +28,6 @@ namespace Core.DataReader.Pol
{
public Vector3[] Positions;
public Vector3[] Normals;
public float[] Radii;
public Color32[] DiffuseColors;
public Color32[] SpecularColors;
public Vector2[][] Uvs;
@@ -36,7 +35,7 @@ namespace Core.DataReader.Pol
public struct PolMesh
{
public GameBoxAABBox BoundBox;
public Bounds Bounds;
public uint VertexFvfFlag;
public PolVertexInfo VertexInfo;
public PolTexture[] Textures;
@@ -44,11 +43,11 @@ namespace Core.DataReader.Pol
public struct PolTexture
{
public uint BlendFlag; // 0--opaque, 1--alpha blend, 2--invert color blend, 3--add
public GameBoxBlendFlag BlendFlag;
public GameBoxMaterial Material;
public string[] TextureNames;
public int VertStart;
public int VertEnd;
public uint VertStart;
public uint VertEnd;
public int[] Triangles;
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -121,11 +121,11 @@ namespace Core.DataReader.Pol
private static PolMesh ReadMeshData(BinaryReader reader, int version, int codepage)
#endif
{
var boundBox = new GameBoxAABBox()
{
Min = reader.ReadVector3(),
Max = reader.ReadVector3(),
};
var bounds = new Bounds();
bounds.SetMinMax(
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()),
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()));
var vertexTypeFlag = reader.ReadUInt32();
var numberOfVertices = reader.ReadInt32();
@@ -137,7 +137,6 @@ namespace Core.DataReader.Pol
var positions = new Vector3[numberOfVertices];
var normals = new Vector3[numberOfVertices];
var diffuseColors = new Color32[numberOfVertices];
var radii = new float[numberOfVertices];
var specularColors = new Color32[numberOfVertices];
var uvs = new Vector2[4][];
@@ -163,9 +162,7 @@ namespace Core.DataReader.Pol
}
if ((vertexTypeFlag & GameBoxVertexType.Normal) != 0)
{
normals[i] = GameBoxInterpreter
.ToUnityVertex(reader.ReadVector3(),
GameBoxInterpreter.GameBoxUnitToUnityUnit);
normals[i] = GameBoxInterpreter.ToUnityNormal(reader.ReadVector3());
}
if ((vertexTypeFlag & GameBoxVertexType.Diffuse) != 0)
{
@@ -199,6 +196,9 @@ namespace Core.DataReader.Pol
var y = reader.ReadSingle();
uvs[3][i] = new Vector2(x, y);
}
// Quick fix for the missing/wrong normals
if (normals[i] == Vector3.zero) normals[i] = Vector3.up;
}
var vertexInfo = new PolVertexInfo()
@@ -206,7 +206,6 @@ namespace Core.DataReader.Pol
Positions = positions,
Normals = normals,
DiffuseColors = diffuseColors,
Radii = radii,
SpecularColors = specularColors,
Uvs = uvs,
};
@@ -222,7 +221,7 @@ namespace Core.DataReader.Pol
return new PolMesh
{
BoundBox = boundBox,
Bounds = bounds,
VertexFvfFlag = vertexTypeFlag,
VertexInfo = vertexInfo,
Textures = textureInfos
@@ -235,7 +234,7 @@ namespace Core.DataReader.Pol
private static PolTexture ReadTextureInfo(BinaryReader reader, int version, int codepage)
#endif
{
var blendFlag = reader.ReadUInt32();
var blendFlag = (GameBoxBlendFlag)reader.ReadUInt32();
var material = new GameBoxMaterial()
{
@@ -259,24 +258,22 @@ namespace Core.DataReader.Pol
textureNames[i] = textureName;
}
var indexBits = reader.ReadInt32();
if (indexBits != 16) throw new Exception($"IndexBits is invalid: {indexBits}");
var vertStart = reader.ReadInt32();
var vertEnd = reader.ReadInt32();
_ = reader.ReadInt32();
var vertStart = reader.ReadUInt32();
var vertEnd = reader.ReadUInt32();
var numberOfFaces = reader.ReadInt32();
var triangles = new int[numberOfFaces * 3];
for (var i = 0; i < numberOfFaces; i++)
{
var index = i * 3;
var x = reader.ReadInt16();
var y = reader.ReadInt16();
var z = reader.ReadInt16();
(triangles[index], triangles[index + 1], triangles[index + 2]) =
GameBoxInterpreter.ToUnityTriangle((x, y, z));
triangles[index] = reader.ReadUInt16();
triangles[index + 1] = reader.ReadUInt16();
triangles[index + 2] = reader.ReadUInt16();
}
GameBoxInterpreter.ToUnityTriangles(triangles);
return new PolTexture()
{
BlendFlag = blendFlag,
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+158 -89
View File
@@ -1,10 +1,11 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Scn
{
using System;
using GameBox;
using Newtonsoft.Json;
using UnityEngine;
@@ -41,9 +42,9 @@ namespace Core.DataReader.Scn
[System.Serializable]
public enum ScnSceneType
{
StoryA = 0, // 情节关城市村镇
StoryB, // 情节关建筑内部
Maze, // 战斗(迷宫)场景
OutDoor = 0, // 情节关城市村镇
InDoor, // 情节关建筑内部
Maze, // 迷宫场景
}
[System.Serializable]
@@ -51,65 +52,74 @@ namespace Core.DataReader.Scn
{
AutoTrigger = 0, // 自动触发点
Shakeable = 1, // 碰到后摇晃的物品
Knockdownable = 2, // 碰到后翻倒的物品
Arrow = 3, // 飞箭类 (JG06霹雳堂总舵飞剑)
#if PAL3
Collidable = 2, // 碰到后翻倒的物品(仙三独有)
#elif PAL3A
WuLingSwitch = 2, // 五灵开关 (可触发其他机关,外传独有)
#endif
Arrow = 3, // 飞箭类 (霹雳堂总舵飞剑)
FallableWeapon = 4, // 落下的伤害物体 (冰棱)
MovableCarrier = 5, // 移动浮板 (固定速度和路线往复移动,可载人)
Trap = 6, // 陷阱 (调用脚本切换场景)
RotatingStoneBeam = 7, // 旋传石梁 (一字型)
RotatingWall = 8, // 旋转墙 (折尺型,JG13)
RotatingBridge = 7, // 旋传石梁 (仙三独有)
Teapot = 8, // 茶壶 (外传独有)
PreciseTrigger = 9, // 精确触发点
WindBlower = 10, // 风口
Pushable = 11, // 推箱子
SpecialMechanism = 12, // 主角特技机关
ImpulsiveMechanism = 13, // 冲撞
Door = 14, // 门,场景切换点
Pushable = 11, // 推箱子(仙三独有)
SpecialSwitch = 12, // 主角特技机关(仙三独有)
Impulsive = 13, // 冲撞类机关(仙三独有)
Door = 14, // 门,场景切换点
Climbable = 15, // 藤蔓或梯子 (可爬物)
InvestigationTriggerObject = 16, // 调查触发物体
InvestigationTrigger = 16, // 调查触发物体
StaticOrAnimated = 17, // 死物体或者随机动画播放(通用参数[0]:对应的地面是否可通过)
Billboard = 18, // 公告板
SuspensionBridge = 19, // 吊桥 (壁山)
SuspensionBridge = 19, // 吊桥 (仙三独有)
VirtualInvestigationTrigger = 20, // 虚拟BOX调查触发
EyeBall = 21, // 锁妖塔:眼球
LiftingMechanism = 22, // 锁妖塔:升降铁链或平台
EyeBall = 21, // 锁妖塔:眼球(仙三独有)
LiftingPlatform = 22, // 锁妖塔:升降铁链或平台
// 通用参数[0]:为升起后的高度,需要用其他开关间接触发
// 通用参数[1]:升起后到高层
// 通用参数[2]:平台上的其他物件编号
// 通用参数[3]:初始为可通过?)
Switch = 23, // 开关 (可触发其他机关)
Switch = 23, // 普通开关 (可触发其他机关,仙三独有)
Collectable = 24, // 可以拣起的道具 (通用参数[0]:得到物品的数据库ID)
General = 25, // 普通物品
RareChest = 26, // 迷宫大宝箱
WishPool = 27, // 许愿池
#if PAL3
WishPool = 27, // 许愿池(仙三独有)
#elif PAL3A
ToggleSwitch = 27, // 普通开关的变种(可触发其他机关,外传独有)
#endif
ColdWeapon = 28, // (M24)剑或锤
GravityTrigger = 29, // 重力机关
ElevatorSwitch = 30, // 升降机关门
WaterSurfaceMechanism = 31, // 水面机关
GravitySwitch = 29, // 重力机关(乌龟,仙三独有)
ElevatorDoor = 30, // 升降机关门(仙三独有)
WaterSurfaceRoadBlocker = 31, // 水面机关/路障(仙三独有)
PiranhaFlower = 32, // 食人花
PedalSwitch = 33, // 踏板开关
SwordBridge = 34, // (m24)剑桥(触发后向前伸)
SwordBridge = 34, // 剑桥(触发后向前伸,仙三独有)
SlideWay = 35, // 滑道
FallableObstacle = 36, // 坠落的障碍物
DivineTreeFlower = 37, // (神树)花
DivineTreePortal = 38, // (神树)传送点
Elevator = 39, // (神魔之井)电梯
ElevatorPedal = 40, // 上下传送板
FallableObstacle = 36, // 坠落的障碍物(仙三独有)
DivineTreeFlower = 37, // 神树花(仙三独有)
DivineTreePortal = 38, // 神树传送点
Elevator = 39, // 神魔之井电梯(仙三独有)
ElevatorPedal = 40, // 上下传送板(仙三独有)
Chest = 41, // 小宝箱
SavingPoint = 42, // 存盘点
SceneSfx = 43, // 场景音效
JumpableArea = 44, // 可跳跃区域
// PAL3A new scene objects
UnknownObj47 = 47, // PAL3A m19 8
UnknownObj48 = 48, // PAL3A m19 8
UnknownObj49 = 49, // PAL3A m05 3, m06 2, m17 2, m17 3, m17 4, m18 1, m18 2
UnknownObj51 = 51, // PAL3A m10 2
UnknownObj52 = 52, // PAL3A m01 1
UnknownObj53 = 53, // PAL3A m17 1, m17 2, m17 3, m17 4
UnknownObj54 = 54, // PAL3A m13 1, m13 2, m13 3, m13 4
UnknownObj55 = 55, // PAL3A m13 1, m13 2, m13 3, m13 4
UnknownObj56 = 56, // PAL3A m15 1
UnknownObj59 = 59, // PAL3A m15 2
// 以下所有均为仙三外传中新增的场景物件类型
PaperweightDesk = 47, // 镇尺桌
Paperweight = 48, // 镇尺
RoadElevatorOrBlocker = 49, // 可升降路面或者是阻挡物
RetractableBlocker = 51, // 可收回路障
RotatingWall = 52, // T形旋转石门
WaterSurface = 53, // 升降水面
ThreePhaseBridge = 54, // 三相桥
ThreePhaseSwitch = 55, // 三相开关
MushroomBridge = 56, // 蘑菇桥
SectorBridge = 59, // 扇型桥
}
// SCN (.scn) file header
@@ -127,18 +137,71 @@ namespace Core.DataReader.Scn
public struct ScnPath
{
public int NumberOfWaypoints;
public Vector3[] Waypoints; // Max of 16 waypoints
public Vector3[] GameBoxWaypoints; // 原GameBox引擎坐标系下的路径点(X, Y, Z)数组。固定数组长度为16.
}
public struct ScnSceneInfo
{
public string CityName; // char[32] 关名称
public string Name; // char[32] 区块名称
public string Model; // char[32]
public string CityName; // char[32] 关卡/区块名称
public string SceneName; // char[32] 场景名称
public string Model; // char[32] 模型名称
public ScnSceneType SceneType;
public int LightMap; // 0日景灯光, 1夜景灯光, -1不知道是什么意思(比如M01)
public int LightMap; // 0日景灯光, 1夜景灯光, -1无灯光?(比如M01)
public uint SkyBox;
public uint[] Reserved; // 6 DWORDs
/// <summary>
/// Check if two scene share the same model.
/// </summary>
/// <param name="sceneInfo">ScnSceneInfo</param>
/// <returns>True if two scene share the same model</returns>
public bool ModelEquals(ScnSceneInfo sceneInfo)
{
#if PAL3
return string.Equals(CityName, sceneInfo.CityName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(Model, sceneInfo.Model, StringComparison.OrdinalIgnoreCase);
#elif PAL3A
var modelAName = Model;
if (modelAName.EndsWith("y", StringComparison.OrdinalIgnoreCase))
{
modelAName = modelAName[..^1];
}
var modelBName = sceneInfo.Model;
if (modelBName.EndsWith("y", StringComparison.OrdinalIgnoreCase))
{
modelBName = modelBName[..^1];
}
return string.Equals(CityName, sceneInfo.CityName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(modelAName, modelBName, StringComparison.OrdinalIgnoreCase);
#endif
}
public bool Is(string cityName, string sceneName)
{
return IsCity(cityName) && IsScene(sceneName);
}
public bool IsCity(string cityName)
{
return string.Equals(CityName, cityName, StringComparison.OrdinalIgnoreCase);
}
private bool IsScene(string sceneName)
{
return string.Equals(SceneName, sceneName, StringComparison.OrdinalIgnoreCase);
}
public override string ToString()
{
return $"City: {CityName.ToLower()}, " +
$"Scene: {SceneName.ToLower()}, " +
$"Model: {Model.ToLower()}, " +
$"Type: {SceneType}, " +
$"LightMap: {LightMap}, " +
$"SkyBox: {SkyBox}";
}
}
[System.Serializable]
@@ -158,23 +221,18 @@ namespace Core.DataReader.Scn
// char[32] Npc名字
public string Name;
// char[32] 贴图编号
// char[34] 贴图编号 (无用)
public string Texture;
// 2 bytes unknown data
public byte[] Unknown1;
// 人物初始朝向
public float FacingDirection;
public byte OnLayer;
// 初始地层
public int LayerIndex;
// 3 bytes unknown data
public byte[] Unknown2;
// 初始位置
public float PositionX;
public float PositionZ;
// 原GameBox引擎下的初始位置(X,Z)
public float GameBoxXPosition;
public float GameBoxZPosition;
// 初始是否可见
public int InitActive;
@@ -186,8 +244,9 @@ namespace Core.DataReader.Scn
public uint ScriptId;
// 初始Y坐标,只有在 InitBehaviour == Hold
// 的时候 PositionY 和 InitAction 才有用
public float PositionY;
// 的时候 GameBoxYPosition 和 InitAction 才有用
public float GameBoxYPosition; // 原GameBox引擎下的Y坐标
// chars[16] 初始动作
public string InitAction;
@@ -214,29 +273,29 @@ namespace Core.DataReader.Scn
// 一关中唯一的编号
public byte Id;
// 是否激活 (不激活相当于没这个物体)
public byte Active;
// 初始是否激活 (不激活相当于没这个物体)
public byte InitActive;
// 可触发次数 (0表示不可触发,0xFF表示无限触发)
// 可触发次数 (0表示不可触发,1表示只能触发一次(收集类道具),0xFF表示无限触发)
public byte Times;
// 开关状态 (0代表关, 1代表开)
public byte Switch;
public byte SwitchState;
// char[32] 物品名称,对应美术模型,带扩展名
public string Name;
// 触发标志,0x01地砖自动触发,0x02模型OBB调查触发
public ushort TriggerType;
// 触发类型,1地砖自动触发,2模型调查触发
public byte TriggerType;
// 是否产生阻挡
public ushort NonBlocking;
public byte IsNonBlocking;
// 模型位置
public Vector3 Position;
// 原GameBox引擎下的模型位置
public Vector3 GameBoxPosition;
// 渲染模型的时候转动多少角度(绕Y轴)
public float YRotation;
public float GameBoxYRotation;
// 触发范围(TileMap区域)
public GameBoxRect TileMapTriggerRect;
@@ -248,9 +307,9 @@ namespace Core.DataReader.Scn
public byte SaveState;
// 在哪个地层
public byte OnLayer;
public byte LayerIndex;
// 五灵属性,0~5代表,用于大宝箱
// 五灵属性,0~5代表,用于大宝箱和三外中具有五灵属性的机关
public byte WuLing;
/*
@@ -270,44 +329,54 @@ namespace Core.DataReader.Scn
24 以拣起的道具
[0]:得到物品的数据库ID
*/
#if PAL3
public int[] Parameters;
#elif PAL3A
public float[] Parameters;
#if PAL3A
public uint NotUsed; // always 0
#endif
// 触发条件
public ushort NeedSpecialAction; // 对应特殊行走技能,0xFF为无此条件
public ushort NeedItem; // 需要物品,0xFF为无此条件
public ushort NeedGold; // 需要金钱值
public ushort NeedLv; // 需要等级数
public ushort NeedWu; // 需要武力值 (如果无此限制,则设成最小值)
public ushort NeedAllOpen; // 场景中所有需检测的机关都为开
public string FailedMessage; // char[16] 失败提示字符串名称
public byte RequireSpecialAction; // 对应特殊行走技能,0xFF为无此条件
public ushort RequireItem; // 需要物品,0xFF为无此条件
public ushort RequireMoney; // 需要金钱值
public ushort RequireLevel; // 需要等级数
public ushort RequireAttackValue; // 需要武力值 (如果无此限制,则设成最小值)
public byte RequireAllMechanismsSolved; // 场景中所有需检测的机关都为开
public string FailedMessage; // char[16] 失败提示字符串名称
#if PAL3A
public uint Unknown; // TODO
#endif
public uint ScriptId;
public ScnPath Path;
// 触发结果
public ushort LinkedObject; // 触发其它机关的编号;
public ushort LinkedObjectId; // 触发其它机关的编号;
// 与场景的某个开关相关
public string DependentSceneName; // char[32]
public ushort DependentId;
public byte DependentObjectId;
public Bounds Bounds;
public float GameBoxXRotation; // 绕X轴旋转
#if PAL3A
public float GameBoxZRotation; // 绕Z轴旋转
#endif
public string SfxName; // 音效文件名
public GameBoxAABBox BoundBox;
public float XRotation; // 绕X轴旋转
public float ZRotation; // 绕Z轴旋转
public string SfxName; // char[8] 特效参数
public uint EffectModelType;
public uint ScriptChangeActive;
public uint ScriptActivated;
public uint ScriptMoved;
public uint[] Reserved; // 52 DWORDs
public byte[] Unknown1;
public byte[] Unknown2;
#if PAL3A
public uint CanOnlyBeTriggeredOnce;
#endif
public uint[] Reserved; // PAL3: 52 DWORDs PAL3A: 44 DWORDs
}
/// <summary>
@@ -1,11 +1,13 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Scn
{
using System;
using System.IO;
using System.Linq;
using Extensions;
using GameBox;
using UnityEngine;
@@ -33,7 +35,7 @@ namespace Core.DataReader.Scn
var sceneInfo = new ScnSceneInfo()
{
CityName = reader.ReadString(32, codepage),
Name = reader.ReadString(32, codepage),
SceneName = reader.ReadString(32, codepage),
Model = reader.ReadString(32, codepage),
SceneType = (ScnSceneType) reader.ReadInt32(),
LightMap = reader.ReadInt32(),
@@ -45,16 +47,7 @@ namespace Core.DataReader.Scn
var npcInfos = new ScnNpcInfo[numberOfNpc];
for (var i = 0; i < numberOfNpc; i++)
{
ScnNpcInfo npcInfo = ReadNpcInfo(reader, codepage);
if (npcInfo.Unknown1[0] != 0 ||
npcInfo.Unknown1[1] != 0 ||
npcInfo.Unknown2[0] != 0 ||
npcInfo.Unknown2[1] != 0 ||
npcInfo.Unknown2[2] != 0)
{
Debug.LogError($"Unknown byte has value for ActorId: {npcInfo.Id} Name: {npcInfo.Name}");
}
npcInfos[i] = npcInfo;
npcInfos[i] = ReadNpcInfo(reader, codepage);
}
reader.BaseStream.Seek(objectDataOffset, SeekOrigin.Begin);
@@ -75,17 +68,15 @@ namespace Core.DataReader.Scn
Id = reader.ReadByte(),
Kind = (ScnActorKind)reader.ReadByte(),
Name = reader.ReadString(32, codepage),
Texture = reader.ReadString(32, codepage),
Unknown1 = reader.ReadBytes(2),
Texture = reader.ReadString(34, codepage),
FacingDirection = reader.ReadSingle(),
OnLayer = reader.ReadByte(),
Unknown2 = reader.ReadBytes(3),
PositionX = reader.ReadSingle(),
PositionZ = reader.ReadSingle(),
LayerIndex = reader.ReadInt32(),
GameBoxXPosition = reader.ReadSingle(),
GameBoxZPosition = reader.ReadSingle(),
InitActive = reader.ReadInt32(),
InitBehaviour = (ScnActorBehaviour) reader.ReadInt32(),
ScriptId = reader.ReadUInt32(),
PositionY = reader.ReadSingle(),
GameBoxYPosition = reader.ReadSingle(),
InitAction = reader.ReadString(16, codepage),
MonsterId = reader.ReadUInt32Array(3),
MonsterNumber = reader.ReadUInt16(),
@@ -93,7 +84,7 @@ namespace Core.DataReader.Scn
Path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
Waypoints = reader.ReadVector3Array(16)
GameBoxWaypoints = reader.ReadVector3Array(16)
},
NoTurn = reader.ReadUInt32(),
LoopAction = reader.ReadUInt32(),
@@ -104,140 +95,168 @@ namespace Core.DataReader.Scn
private static ScnObjectInfo ReadObjectInfo(BinaryReader reader, int codepage)
{
var id = reader.ReadByte();
var initActive = reader.ReadByte();
var times = reader.ReadByte();
var switchState = reader.ReadByte();
var name = reader.ReadString(32, codepage);
var triggerType = reader.ReadByte();
var isNonBlocking = reader.ReadByte();
_ = reader.ReadBytes(2); // Empty padding bytes to complete 4-byte alignment
var gameBoxPosition = reader.ReadVector3();
var yRotation = reader.ReadSingle();
var tileMapTriggerRect = new GameBoxRect()
{
Left = reader.ReadInt32(),
Top = reader.ReadInt32(),
Right = reader.ReadInt32(),
Bottom = reader.ReadInt32(),
};
var type = (ScnSceneObjectType) reader.ReadByte();
var saveState = reader.ReadByte();
var layerIndex = reader.ReadByte();
var wuLing = reader.ReadByte();
#if PAL3
return new ScnObjectInfo()
{
Id = reader.ReadByte(),
Active = reader.ReadByte(),
Times = reader.ReadByte(),
Switch = reader.ReadByte(),
Name = reader.ReadString(32, codepage),
TriggerType = reader.ReadUInt16(),
NonBlocking = reader.ReadUInt16(),
Position = reader.ReadVector3(),
YRotation = reader.ReadSingle(),
TileMapTriggerRect = new GameBoxRect()
{
Left = reader.ReadInt32(),
Top = reader.ReadInt32(),
Right = reader.ReadInt32(),
Bottom = reader.ReadInt32(),
},
Type = (ScnSceneObjectType) reader.ReadByte(),
SaveState = reader.ReadByte(),
OnLayer = reader.ReadByte(),
WuLing = reader.ReadByte(),
Parameters = reader.ReadInt32Array(6),
NeedSpecialAction = reader.ReadUInt16(),
NeedItem = reader.ReadUInt16(),
NeedGold = reader.ReadUInt16(),
NeedLv = reader.ReadUInt16(),
NeedWu = reader.ReadUInt16(),
NeedAllOpen = reader.ReadUInt16(),
FailedMessage = reader.ReadString(16, codepage),
ScriptId = reader.ReadUInt32(),
Path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
Waypoints = reader.ReadVector3Array(16)
},
LinkedObject = reader.ReadUInt16(),
DependentSceneName = reader.ReadString(32, codepage),
DependentId = reader.ReadUInt16(),
BoundBox = new GameBoxAABBox()
{
Min = reader.ReadVector3(),
Max = reader.ReadVector3()
},
XRotation = reader.ReadSingle(),
SfxName = reader.ReadString(8, codepage),
EffectModelType = reader.ReadUInt32(),
ScriptChangeActive = reader.ReadUInt32(),
ScriptMoved = reader.ReadUInt32(),
Reserved = reader.ReadUInt32Array(52)
};
var parameters = reader.ReadInt32Array(6);
#elif PAL3A
var parameters = Array.ConvertAll(reader.ReadSingleArray(6), Convert.ToInt32);
#endif
#if PAL3A
var notUsed = reader.ReadUInt32();
#endif
var requireSpecialAction = reader.ReadByte();
var requireItem = reader.ReadUInt16();
_ = reader.ReadByte(); // Empty padding byte to complete 4-byte alignment
var requireMoney = reader.ReadUInt16();
var requireLevel = reader.ReadUInt16();
var requireAttackValue = reader.ReadUInt16();
var requireAllMechanismsSolved = reader.ReadByte();
var failedMessage = reader.ReadString(16, codepage);
_ = reader.ReadByte(); // Empty padding byte to complete 4-byte alignment
#if PAL3A
var unknown = reader.ReadUInt32(); // TODO
#endif
var scriptId = reader.ReadUInt32();
var path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
GameBoxWaypoints = reader.ReadVector3Array(16)
};
var linkedObjectId = reader.ReadUInt16();
var dependentSceneName = reader.ReadString(32, codepage);
var dependentObjectId = reader.ReadByte();
_ = reader.ReadByte(); // Empty padding byte to complete 4-byte alignment
var bounds = new Bounds();
bounds.SetMinMax(
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()),
GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()));
var xRotation = reader.ReadSingle();
#if PAL3A
var zRotation = reader.ReadSingle();
#endif
var sfxName = reader.ReadString(8, codepage);
var effectModelType = reader.ReadUInt32();
var scriptActivated = reader.ReadUInt32();
var scriptMoved = reader.ReadUInt32();
#if PAL3A
var canOnlyBeTriggeredOnce = reader.ReadUInt32();
#endif
#if PAL3
var reserved = reader.ReadUInt32Array(52);
#elif PAL3A
var reserved = reader.ReadUInt32Array(44);
#endif
return new ScnObjectInfo()
{
Id = reader.ReadByte(),
Active = reader.ReadByte(),
Times = reader.ReadByte(),
Switch = reader.ReadByte(),
Id = id,
InitActive = initActive,
Times = times,
SwitchState = switchState,
Name = reader.ReadString(32, codepage),
TriggerType = reader.ReadUInt16(),
NonBlocking = reader.ReadUInt16(),
Name = name,
Position = reader.ReadVector3(),
YRotation = reader.ReadSingle(),
TileMapTriggerRect = new GameBoxRect()
{
Left = reader.ReadInt32(),
Top = reader.ReadInt32(),
Right = reader.ReadInt32(),
Bottom = reader.ReadInt32(),
},
TriggerType = triggerType,
IsNonBlocking = isNonBlocking,
Type = (ScnSceneObjectType) reader.ReadByte(),
SaveState = reader.ReadByte(),
OnLayer = reader.ReadByte(),
WuLing = reader.ReadByte(),
Parameters = reader.ReadSingleArray(6),
// TODO
Unknown1 = reader.ReadBytes(4),
GameBoxPosition = gameBoxPosition,
GameBoxYRotation = yRotation,
TileMapTriggerRect = tileMapTriggerRect,
NeedSpecialAction = reader.ReadUInt16(),
NeedItem = reader.ReadUInt16(),
NeedGold = reader.ReadUInt16(),
NeedLv = reader.ReadUInt16(),
NeedWu = reader.ReadUInt16(),
NeedAllOpen = reader.ReadUInt16(),
FailedMessage = reader.ReadString(16, codepage),
Type = type,
SaveState = saveState,
LayerIndex = layerIndex,
WuLing = wuLing,
// TODO
Unknown2 = reader.ReadBytes(4),
ScriptId = reader.ReadUInt32(),
Parameters = parameters,
Path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
Waypoints = reader.ReadVector3Array(16)
},
#if PAL3A
NotUsed = notUsed,
#endif
LinkedObject = reader.ReadUInt16(),
DependentSceneName = reader.ReadString(32, codepage),
DependentId = reader.ReadUInt16(),
RequireSpecialAction = requireSpecialAction,
RequireItem = requireItem,
RequireMoney = requireMoney,
RequireLevel = requireLevel,
RequireAttackValue = requireAttackValue,
RequireAllMechanismsSolved = requireAllMechanismsSolved,
BoundBox = new GameBoxAABBox()
{
Min = reader.ReadVector3(),
Max = reader.ReadVector3()
},
FailedMessage = failedMessage,
XRotation = reader.ReadSingle(),
ZRotation = reader.ReadSingle(),
SfxName = reader.ReadString(8, codepage),
EffectModelType = reader.ReadUInt32(),
#if PAL3A
Unknown = unknown, // TODO
#endif
ScriptChangeActive = reader.ReadUInt32(),
ScriptMoved = reader.ReadUInt32(),
ScriptId = scriptId,
Reserved = reader.ReadUInt32Array(45)
Path = path,
LinkedObjectId = linkedObjectId,
DependentSceneName = dependentSceneName,
DependentObjectId = dependentObjectId,
Bounds = bounds,
GameBoxXRotation = xRotation,
#if PAL3A
GameBoxZRotation = zRotation,
#endif
SfxName = sfxName,
EffectModelType = effectModelType,
ScriptActivated = scriptActivated,
ScriptMoved = scriptMoved,
#if PAL3A
CanOnlyBeTriggeredOnce = canOnlyBeTriggeredOnce,
#endif
Reserved = reserved,
};
#endif
}
}
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -68,7 +68,17 @@ namespace Core.Extensions
}
return integers;
}
public static short[] ReadInt16Array(this BinaryReader binaryReader, int count)
{
var integers = new short[count];
for (var i = 0; i < count; i++)
{
integers[i] = binaryReader.ReadInt16();
}
return integers;
}
public static ushort[] ReadUInt16Array(this BinaryReader binaryReader, int count)
{
var integers = new ushort[count];
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -29,7 +29,7 @@ namespace Core.FileSystem
{
rootPath = !string.IsNullOrEmpty(rootPath) ? rootPath : throw new ArgumentNullException(nameof(rootPath));
crcHash = crcHash ?? throw new ArgumentNullException(nameof(crcHash));
if (!rootPath.EndsWith(Path.DirectorySeparatorChar))
{
rootPath += Path.DirectorySeparatorChar;
@@ -72,7 +72,7 @@ namespace Core.FileSystem
cpkArchive.Init();
_cpkArchives[cpkFileName] = cpkArchive;
}
/// <summary>
/// Check if file exists in any of the segmented archives using virtual path.
/// </summary>
@@ -88,7 +88,7 @@ namespace Core.FileSystem
segmentedArchiveName = null;
return false;
}
// Check if the file exists in any of the segmented cpk archives.
foreach (var subCpkPath in _cpkArchives.Keys
.Where(_ => _.StartsWith(cpkFileName[..^CpkConstants.FileExtension.Length] + '_', StringComparison.OrdinalIgnoreCase)))
@@ -141,10 +141,10 @@ namespace Core.FileSystem
public byte[] ReadAllBytes(string fileVirtualPath)
{
ParseFileVirtualPath(fileVirtualPath, out var cpkFileName, out var relativeVirtualPath);
if (_cpkArchives.ContainsKey(cpkFileName))
{
return _cpkArchives[cpkFileName].ReadAllBytes(relativeVirtualPath);
return _cpkArchives[cpkFileName].ReadAllBytes(relativeVirtualPath);
}
// Find and read the file content in segmented cpk archives.
@@ -154,7 +154,7 @@ namespace Core.FileSystem
var relativePathInSubCpk = relativeVirtualPath.Replace(cpkFileName, subCpkPath);
if (_cpkArchives[subCpkPath].FileExists(relativePathInSubCpk))
{
return _cpkArchives[subCpkPath].ReadAllBytes(relativePathInSubCpk);
return _cpkArchives[subCpkPath].ReadAllBytes(relativePathInSubCpk);
}
}
@@ -204,6 +204,25 @@ namespace Core.FileSystem
}
}
/// <summary>
/// Extract all archives to the specified destination
/// </summary>
public void ExtractTo(string outputFolder)
{
foreach ((string cpkFileName, CpkArchive cpkArchive) in _cpkArchives)
{
var outputDir = outputFolder + cpkFileName + Path.DirectorySeparatorChar;
if (!Directory.Exists(outputDir))
{
Directory.CreateDirectory(outputDir);
}
cpkArchive.ExtractTo(outputDir);
Debug.Log($"{cpkFileName} extracted to {outputDir}");
}
}
/// <summary>
/// Search files using keyword.
/// </summary>
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -33,7 +33,7 @@ namespace Core.FileSystem
/// <param name="segmentedArchiveName">Name of the segmented archive if exists</param>
/// <returns>True if file exists in segmented archive</returns>
public bool FileExistsInSegmentedArchive(string fileVirtualPath, out string segmentedArchiveName);
/// <summary>
/// Check if file exists in the archive using virtual path.
/// </summary>
@@ -64,6 +64,11 @@ namespace Core.FileSystem
/// </summary>
public void DisposeAllInMemoryArchives();
/// <summary>
/// Extract all archives to the specified destination
/// </summary>
public void ExtractTo(string outputFolder);
/// <summary>
/// Search files using keyword.
/// </summary>
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -10,17 +10,14 @@ namespace Core.GameBox
using UnityEngine;
/// <summary>
/// Used to convert GameBox specific rendering related metadata to Unity standard.
/// Interpreter/convertor to convert GameBox specific rendering related metrics to Unity standard units that fits
/// well with the engine and editor.
/// </summary>
public static class GameBoxInterpreter
{
public const float GameBoxUnitToUnityUnit = 20f;
public const float GameBoxCvdUnitToUnityUnit = 20f;
public const float GameBoxMv3UnitToUnityUnit = 1270f;
// Since GameBox's rendering pipeline uses different internal axis system.
// Here we are flipping the x here to minor it back to the Unity axis.
// Also we want to scale it to proper unity unit.
public static Vector3 ToUnityVertex(Vector3 vertex, float scale)
{
return ToUnityVector3(vertex, scale);
@@ -31,6 +28,49 @@ namespace Core.GameBox
return ToUnityVector3(position, scale);
}
public static float ToUnityDistance(float gameBoxDistance)
{
return gameBoxDistance / GameBoxUnitToUnityUnit;
}
public static float ToUnityXPosition(float gameBoxXPosition)
{
return -gameBoxXPosition / GameBoxUnitToUnityUnit;
}
public static float ToUnityYPosition(float gameBoxYPosition)
{
return gameBoxYPosition / GameBoxUnitToUnityUnit;
}
public static float ToUnityZPosition(float gameBoxZPosition)
{
return gameBoxZPosition / GameBoxUnitToUnityUnit;
}
public static float ToGameBoxXRotation(float eulerAnglesX)
{
return eulerAnglesX;
}
public static float ToGameBoxYRotation(float eulerAnglesY)
{
return -eulerAnglesY;
}
public static float ToGameBoxZRotation(float eulerAnglesZ)
{
return eulerAnglesZ;
}
public static Quaternion ToUnityRotation(Vector3 gameBoxEulerAngles)
{
return Quaternion.Euler(
gameBoxEulerAngles.x,
-gameBoxEulerAngles.y,
gameBoxEulerAngles.z);
}
public static Vector3 ToGameBoxPosition(Vector3 position, float scale = GameBoxUnitToUnityUnit)
{
return new Vector3(
@@ -39,7 +79,7 @@ namespace Core.GameBox
position.z * scale);
}
public static Vector3 CvdPositionToUnityPosition(Vector3 cvdPosition, float scale = GameBoxCvdUnitToUnityUnit)
public static Vector3 CvdPositionToUnityPosition(Vector3 cvdPosition, float scale = GameBoxUnitToUnityUnit)
{
return new Vector3(
-cvdPosition.x / scale,
@@ -55,6 +95,14 @@ namespace Core.GameBox
scale.y);
}
public static Vector3 ToUnityNormal(Vector3 normal)
{
return new Vector3(
-normal.x,
normal.y,
normal.z);
}
public static Quaternion CvdQuaternionToUnityQuaternion(GameBoxQuaternion quaternion)
{
return new Quaternion(-quaternion.X, quaternion.Z, -quaternion.Y, quaternion.W);
@@ -65,11 +113,23 @@ namespace Core.GameBox
return new Quaternion(-quaternion.X, quaternion.Y, quaternion.Z, quaternion.W);
}
public static Quaternion LgtQuaternionToUnityQuaternion(GameBoxQuaternion quaternion)
{
var rotation = new Quaternion(quaternion.X, quaternion.Y, -quaternion.Z, quaternion.W);
rotation.eulerAngles = new Vector3(rotation.eulerAngles.x + 90f,
-rotation.eulerAngles.y,
rotation.eulerAngles.z);
return rotation;
}
public static Quaternion ToUnityRotation(float pitch, float yaw, float roll)
{
return Quaternion.Euler(pitch - 180, yaw, roll -180);
}
// Since GameBox engine uses different internal axis system.
// Here we are flipping the x here to minor it back to the Unity axis.
// Also we want to scale it to proper unity unit.
private static Vector3 ToUnityVector3(Vector3 vector3, float scale)
{
return new Vector3(
@@ -78,40 +138,22 @@ namespace Core.GameBox
vector3.z / scale);
}
// Since GameBox's rendering pipeline uses different internal axis system
// Here we are switching x and y index to minor it back to the Unity axis
// for triangles
public static (short x, short y, short z) ToUnityTriangle((short x, short y, short z) triangle)
{
return (triangle.y, triangle.x, triangle.z);
}
public static void ToUnityTriangles(List<int> triangles)
{
for (var i = 0; i < triangles.Count; i += 3)
{
(triangles[i], triangles[i + 1]) = (triangles[i + 1], triangles[i]);
}
triangles.Reverse();
}
public static int[] ToUnityTriangles(ReadOnlySpan<int> triangles)
public static void ToUnityTriangles(int[] triangles)
{
var indices = new int[triangles.Length];
for (var i = 0; i < triangles.Length; i += 3)
{
indices[i] = triangles[i + 1];
indices[i + 1] = triangles[i];
indices[i + 2] = triangles[i + 2];
}
return indices;
Array.Reverse(triangles);
}
public static bool IsPositionInsideRect(GameBoxRect rect, Vector2Int position)
public static bool IsPointInsideRect(GameBoxRect rect, Vector2Int point)
{
return position.x >= rect.Left &&
position.x <= rect.Right &&
position.y >= rect.Top &&
position.y <= rect.Bottom;
return point.x >= rect.Left &&
point.x <= rect.Right &&
point.y >= rect.Top &&
point.y <= rect.Bottom;
}
public static Matrix4x4 ToUnityMatrix4x4(GameBoxMatrix4X4 matrix)
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -39,14 +39,6 @@ namespace Core.GameBox
public float W;
}
// GameBox axis-aligned bounding box
[System.Serializable]
public struct GameBoxAABBox
{
public Vector3 Min;
public Vector3 Max;
}
[System.Serializable]
public struct GameBoxRect
{
@@ -54,6 +46,11 @@ namespace Core.GameBox
public int Top;
public int Right;
public int Bottom;
public bool IsEmpty => Left == 0 &&
Top == 0 &&
Right == 0 &&
Bottom == 0;
}
public static class GameBoxVertexType
@@ -72,6 +69,34 @@ namespace Core.GameBox
public const int FlagMask = (1 << 31);
}
public enum GameBoxBlendFlag
{
Opaque, // opaque
AlphaBlend, // src.alpha, 1-src.alpha, +
InvertColorBlend, // srcAlpha, One , +
AdditiveBlend, //
}
public enum GameBoxLightType
{
Omni, // point light
Spot, // spot light
Directional, // directional light
}
public enum GameBoxLightDecayType
{
None,
Distance,
Square,
}
public enum GameBoxLightShapeType
{
Cone,
Square,
}
public static class GameBoxVertex
{
public static int GetSize(uint vertexType)
@@ -1,18 +1,23 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.Renderer
{
using System.Collections;
using System.Threading;
using UnityEngine;
public class AnimatedBillboardRenderer : MonoBehaviour
{
private Sprite[] _sprites;
private WaitForSeconds _spriteAnimationFrameWaiter;
private bool _initialized;
private StaticBillboardRenderer _billboardRenderer;
private SpriteRenderer _spriteRenderer;
private bool _isPlaying;
private CancellationTokenSource _animationCts = new ();
public void OnEnable()
{
@@ -22,40 +27,77 @@ namespace Core.Renderer
private void OnDisable()
{
_isPlaying = false;
_animationCts.Cancel();
Destroy(_billboardRenderer);
Destroy(_spriteRenderer);
}
public IEnumerator PlaySpriteAnimation(Sprite[] sprites,
public void Init(Sprite[] sprites,
float fps,
int loopCount)
Material material = default)
{
_isPlaying = true;
_sprites = sprites;
if (material != default)
{
_spriteRenderer.material = material;
}
_spriteAnimationFrameWaiter = new WaitForSeconds(1 / fps);
_initialized = true;
}
public void StartAnimation(int loopCount = -1)
{
StartCoroutine(PlayAnimationAsync(loopCount));
}
public IEnumerator PlayAnimationAsync(int loopCount)
{
if (!_initialized) yield break;
_animationCts.Cancel();
_animationCts = new CancellationTokenSource();
var cancellationToken = _animationCts.Token;
_spriteRenderer.enabled = true;
if (loopCount == -1)
{
while (_isPlaying)
while (!cancellationToken.IsCancellationRequested)
{
yield return PlaySpriteAnimationInternal(sprites, fps);
yield return PlaySpriteAnimationInternalAsync(cancellationToken);
}
}
else
{
while (--loopCount >= 0 && _isPlaying)
while (--loopCount >= 0 && !cancellationToken.IsCancellationRequested)
{
yield return PlaySpriteAnimationInternal(sprites, fps);
}
yield return PlaySpriteAnimationInternalAsync(cancellationToken);
}
}
}
private IEnumerator PlaySpriteAnimationInternal(Sprite[] sprites, float fps)
public void StopAnimation()
{
foreach (Sprite sprite in sprites)
if (_initialized && !_animationCts.IsCancellationRequested)
{
if (!_isPlaying) yield break;
_animationCts.Cancel();
_spriteRenderer.enabled = false;
}
}
private IEnumerator PlaySpriteAnimationInternalAsync(CancellationToken cancellationToken)
{
foreach (Sprite sprite in _sprites)
{
if (cancellationToken.IsCancellationRequested)
{
yield break;
}
_spriteRenderer.sprite = sprite;
yield return new WaitForSeconds(1 / fps);
yield return _spriteAnimationFrameWaiter;
}
}
}
+14 -7
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -12,6 +12,13 @@ namespace Core.Renderer
{
private Skybox _skybox;
private static readonly int RightTexturePropertyID = Shader.PropertyToID("_RightTex");
private static readonly int BackTexturePropertyID = Shader.PropertyToID("_BackTex");
private static readonly int LeftTexturePropertyID = Shader.PropertyToID("_LeftTex");
private static readonly int FrontTexturePropertyID = Shader.PropertyToID("_FrontTex");
private static readonly int UpTexturePropertyID = Shader.PropertyToID("_UpTex");
private static readonly int DownTexturePropertyID = Shader.PropertyToID("_DownTex");
public void Render(Texture2D[] textures)
{
var mainCamera = GetComponent<Camera>();
@@ -32,12 +39,12 @@ namespace Core.Renderer
private static Material CreateSkyboxMaterial(Texture2D[] textures)
{
var material = new Material(Shader.Find("Skybox/6 Sided"));
material.SetTexture("_RightTex", textures[0]);
material.SetTexture("_BackTex", textures[1]);
material.SetTexture("_LeftTex", textures[2]);
material.SetTexture("_FrontTex", textures[3]);
material.SetTexture("_UpTex", textures[4]);
material.SetTexture("_DownTex", textures[5]);
material.SetTexture(RightTexturePropertyID, textures[0]);
material.SetTexture(BackTexturePropertyID, textures[1]);
material.SetTexture(LeftTexturePropertyID, textures[2]);
material.SetTexture(FrontTexturePropertyID, textures[3]);
material.SetTexture(UpTexturePropertyID, textures[4]);
material.SetTexture(DownTexturePropertyID, textures[5]);
return material;
}
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,14 +1,14 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.Renderer
{
using System;
using UnityEngine;
using UnityEngine.Rendering;
public sealed class StaticMeshRenderer : MonoBehaviour
public sealed class StaticMeshRenderer : MonoBehaviour, IDisposable
{
private MeshRenderer _meshRenderer;
private MeshFilter _meshFilter;
@@ -16,58 +16,15 @@ namespace Core.Renderer
public Mesh Render(ref Vector3[] vertices,
ref int[] triangles,
ref Vector3[] normals,
ref Vector2[] uv,
ref Material material,
ref Vector2[] mainTextureUvs,
ref Vector2[] secondaryTextureUvs,
ref Material[] materials,
bool isDynamic)
{
Dispose();
_meshRenderer = gameObject.AddComponent<MeshRenderer>();
//_meshRenderer.receiveShadows = false;
//_meshRenderer.lightProbeUsage = LightProbeUsage.Off;
_meshRenderer.sharedMaterial = material;
_meshFilter = gameObject.AddComponent<MeshFilter>();
var mesh = new Mesh();
if (isDynamic)
{
mesh.MarkDynamic();
}
mesh.SetVertices(vertices);
mesh.SetTriangles(triangles, 0);
mesh.SetNormals(normals);
mesh.SetUVs(0, uv);
if (triangles.Length == 0)
{
// https://docs.unity3d.com/ScriptReference/Mesh.RecalculateBounds.html
// After modifying vertices you should call this function to ensure the
// bounding volume is correct. Assigning triangles automatically
// recalculates the bounding volume.
mesh.RecalculateBounds();
}
_meshFilter.sharedMesh = mesh;
return mesh;
}
public Mesh Render(ref Vector3[] vertices,
ref int[] triangles,
ref Vector3[] normals,
ref Vector2[] mainTextureUv,
ref Vector2[] secondaryTextureUv,
ref Material material,
bool isDynamic)
{
Dispose();
_meshRenderer = gameObject.AddComponent<MeshRenderer>();
//_meshRenderer.receiveShadows = false;
//_meshRenderer.lightProbeUsage = LightProbeUsage.Off;
_meshRenderer.sharedMaterial = material;
_meshRenderer.sharedMaterials = materials;
_meshFilter = gameObject.AddComponent<MeshFilter>();
var mesh = new Mesh();
@@ -79,8 +36,8 @@ namespace Core.Renderer
mesh.SetVertices(vertices);
mesh.SetTriangles(triangles, 0);
mesh.SetNormals(normals);
mesh.SetUVs(0, mainTextureUv);
mesh.SetUVs(1, secondaryTextureUv);
mesh.SetUVs(0, mainTextureUvs);
mesh.SetUVs(1, secondaryTextureUvs);
if (triangles.Length == 0)
{
@@ -121,7 +78,7 @@ namespace Core.Renderer
Dispose();
}
private void Dispose()
public void Dispose()
{
if (_meshFilter != null)
{
@@ -131,7 +88,11 @@ namespace Core.Renderer
if (_meshRenderer != null)
{
Destroy(_meshRenderer.sharedMaterial);
foreach (Material material in _meshRenderer.sharedMaterials)
{
Destroy(material);
}
Destroy(_meshRenderer);
}
}
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
Loaded 100 of 616 files, more files were not shown because too many files have changed in this diff. Show more