zemu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/zemu/config.rb +312 -0
- data/lib/zemu/instance.rb +179 -0
- data/lib/zemu.rb +172 -0
- data/src/debug.c +118 -0
- data/src/debug.h +30 -0
- data/src/external/Z/API/Z/ABIs/generic/allocator.h +36 -0
- data/src/external/Z/API/Z/ABIs/generic/cipher.h +47 -0
- data/src/external/Z/API/Z/ABIs/generic/data codec.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/emulation.h +103 -0
- data/src/external/Z/API/Z/ABIs/generic/hash function.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/module.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/wave codec.h +40 -0
- data/src/external/Z/API/Z/classes/base/InitializerList.hpp +34 -0
- data/src/external/Z/API/Z/classes/base/OpaqueFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/OpaqueMemberFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/Pair.hpp +46 -0
- data/src/external/Z/API/Z/classes/base/Range.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/SizedString.hpp +66 -0
- data/src/external/Z/API/Z/classes/base/Status.hpp +89 -0
- data/src/external/Z/API/Z/classes/base/Symbol.hpp +39 -0
- data/src/external/Z/API/Z/classes/base/Tuple.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/Value2D.hpp +389 -0
- data/src/external/Z/API/Z/classes/base/Value3D.hpp +368 -0
- data/src/external/Z/API/Z/classes/buffering/RingBuffer.hpp +93 -0
- data/src/external/Z/API/Z/classes/buffering/TripleBuffer.hpp +68 -0
- data/src/external/Z/API/Z/classes/functional/Functor.hpp +265 -0
- data/src/external/Z/API/Z/classes/functional/MemberFunction.hpp +98 -0
- data/src/external/Z/API/Z/classes/functional/ObjectMemberFunction.hpp +172 -0
- data/src/external/Z/API/Z/classes/functional/ObjectSelector.hpp +219 -0
- data/src/external/Z/API/Z/classes/functional/Selector.hpp +146 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABB.hpp +81 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABR.hpp +685 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Box.hpp +219 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Circle.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line2D.hpp +93 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line3D.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Rectangle.hpp +675 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Sphere.hpp +0 -0
- data/src/external/Z/API/Z/classes/memory/Shared.hpp +90 -0
- data/src/external/Z/API/Z/constants/base.h +35 -0
- data/src/external/Z/API/Z/constants/chemical elements.h +6385 -0
- data/src/external/Z/API/Z/constants/numbers.h +963 -0
- data/src/external/Z/API/Z/constants/version.h +15 -0
- data/src/external/Z/API/Z/formats/character set/ASCII.h +158 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP437.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP737.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP775.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP850.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP852.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP855.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP857.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP858.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP860.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP861.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP862.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP863.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP864.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP865.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP866.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP869.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP872.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP874.h +159 -0
- data/src/external/Z/API/Z/formats/character set/Unicode.h +30119 -0
- data/src/external/Z/API/Z/formats/data model/I16LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/IP16L32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LLP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/SILP64.h +19 -0
- data/src/external/Z/API/Z/formats/file system/FAT12.h +61 -0
- data/src/external/Z/API/Z/formats/floating-point/IEEE 754.h +141 -0
- data/src/external/Z/API/Z/formats/floating-point/x87.h +74 -0
- data/src/external/Z/API/Z/formats/image/ICNS.h +39 -0
- data/src/external/Z/API/Z/formats/keymap/Mac OS.h +284 -0
- data/src/external/Z/API/Z/formats/keymap/Z.h +141 -0
- data/src/external/Z/API/Z/formats/multimedia/Creative Voice.h +106 -0
- data/src/external/Z/API/Z/formats/multimedia/Microsoft Wave.h +49 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ACH.h +44 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/FRZ.h +54 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/PRG.h +33 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SEM.h +46 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SIT.h +34 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNA.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNP.h +37 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SP.h +62 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/Z80.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX.h +56 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX82.h +70 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/UNIF.h +26 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/iNES.h +76 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TAP.h +25 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TZX.h +1185 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/Warajevo TAP.h +32 -0
- data/src/external/Z/API/Z/formats/storage medium image/floppy disk/FDI.h +45 -0
- data/src/external/Z/API/Z/functions/base/Z2D.h +583 -0
- data/src/external/Z/API/Z/functions/base/Z3D.h +712 -0
- data/src/external/Z/API/Z/functions/base/ZRange.h +137 -0
- data/src/external/Z/API/Z/functions/base/all.h +16 -0
- data/src/external/Z/API/Z/functions/base/casting.hpp +37 -0
- data/src/external/Z/API/Z/functions/base/character.h +38 -0
- data/src/external/Z/API/Z/functions/base/constructors.h +326 -0
- data/src/external/Z/API/Z/functions/base/structure.hpp +26 -0
- data/src/external/Z/API/Z/functions/base/type.hpp +60 -0
- data/src/external/Z/API/Z/functions/base/value.h +1901 -0
- data/src/external/Z/API/Z/functions/base/value.hpp +112 -0
- data/src/external/Z/API/Z/functions/buffering/ZRingBuffer.h +85 -0
- data/src/external/Z/API/Z/functions/buffering/ZTripleBuffer.h +65 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z2DLine.h +179 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z3DLine.h +168 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABB.h +361 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABR.h +1081 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZBox.h +340 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZCircle.h +142 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZRectangle.h +1267 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZSphere.h +156 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/all.h +18 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/constructors.h +620 -0
- data/src/external/Z/API/Z/functions/time/date.h +29 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/6502.h +90 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/Z80.h +245 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/i4004.h +37 -0
- data/src/external/Z/API/Z/hardware/PSG/General Instrument/AY-3-891x.h +180 -0
- data/src/external/Z/API/Z/hardware/VDC/Ricoh/RP2C0x.h +625 -0
- data/src/external/Z/API/Z/hardware/bus/AGP.h +24 -0
- data/src/external/Z/API/Z/hardware/bus/USB.h +510 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Inves Spectrum +.h +47 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Pentagon.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Scorpion.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum + 128K.h +158 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +.h +82 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2A.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +3.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum.h +109 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (NTSC).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (PAL).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/platform/computer/ZX Spectrum.h +405 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Game Boy.h +49 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Nintendo Entertainment System.h +350 -0
- data/src/external/Z/API/Z/hardware/storage medium/ROM cartridge/SNES Game Pak.h +238 -0
- data/src/external/Z/API/Z/inspection/C/completion.h +178 -0
- data/src/external/Z/API/Z/inspection/C/modules/C11.h +41 -0
- data/src/external/Z/API/Z/inspection/C/modules/C18.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C89.h +19 -0
- data/src/external/Z/API/Z/inspection/C/modules/C90.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C94.h +15 -0
- data/src/external/Z/API/Z/inspection/C/modules/C99.h +29 -0
- data/src/external/Z/API/Z/inspection/C/modules/KR C.h +19 -0
- data/src/external/Z/API/Z/inspection/C++/completion.h +512 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++03.h +15 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++11.h +80 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++14.h +26 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++17.h +55 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++85.h +11 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++89.h +13 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++98.h +17 -0
- data/src/external/Z/API/Z/inspection/C++.h +78 -0
- data/src/external/Z/API/Z/inspection/C.h +79 -0
- data/src/external/Z/API/Z/inspection/CPU/completion.h +56 -0
- data/src/external/Z/API/Z/inspection/CPU/detection.h +714 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/6502.h +25 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch32.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch64.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/Z80.h +26 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-32.h +31 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-64.h +312 -0
- data/src/external/Z/API/Z/inspection/CPU.h +209 -0
- data/src/external/Z/API/Z/inspection/OS/completion.h +36 -0
- data/src/external/Z/API/Z/inspection/OS/detection.h +768 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Linux.h +22 -0
- data/src/external/Z/API/Z/inspection/OS/modules/MS-DOS.h +16 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Mac OS X.h +23 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Windows.h +19 -0
- data/src/external/Z/API/Z/inspection/OS/modules/iPhone OS.h +23 -0
- data/src/external/Z/API/Z/inspection/OS.h +236 -0
- data/src/external/Z/API/Z/inspection/Objective-C/completion.h +8 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v1.0.h +11 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v2.0.h +15 -0
- data/src/external/Z/API/Z/inspection/Objective-C.h +51 -0
- data/src/external/Z/API/Z/inspection/Z.h +19 -0
- data/src/external/Z/API/Z/inspection/build.h +22 -0
- data/src/external/Z/API/Z/inspection/character set.h +66 -0
- data/src/external/Z/API/Z/inspection/compiler/completion.h +2885 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Apple LLVM.h +26 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Clang.h +1664 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/GCC.h +1366 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/SCCZ80.h +473 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Visual C++.h +606 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/cc65.h +529 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/generic.h +13 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/template.h +650 -0
- data/src/external/Z/API/Z/inspection/compiler.h +299 -0
- data/src/external/Z/API/Z/inspection/data model/completion.h +128 -0
- data/src/external/Z/API/Z/inspection/data model/deduction.h +9 -0
- data/src/external/Z/API/Z/inspection/data model/detection.h +45 -0
- data/src/external/Z/API/Z/inspection/data model.h +362 -0
- data/src/external/Z/API/Z/inspection/floating-point/completion.h +50 -0
- data/src/external/Z/API/Z/inspection/floating-point.h +324 -0
- data/src/external/Z/API/Z/inspection/language.h +163 -0
- data/src/external/Z/API/Z/inspection/platform/detection.h +9 -0
- data/src/external/Z/API/Z/inspection/platform.h +29 -0
- data/src/external/Z/API/Z/keys/C++.h +27 -0
- data/src/external/Z/API/Z/keys/C.h +29 -0
- data/src/external/Z/API/Z/keys/CPU.h +80 -0
- data/src/external/Z/API/Z/keys/OS.h +182 -0
- data/src/external/Z/API/Z/keys/Objective-C.h +17 -0
- data/src/external/Z/API/Z/keys/chemistry.h +26 -0
- data/src/external/Z/API/Z/keys/compiler.h +178 -0
- data/src/external/Z/API/Z/keys/data model.h +32 -0
- data/src/external/Z/API/Z/keys/endianness.h +24 -0
- data/src/external/Z/API/Z/keys/language.h +21 -0
- data/src/external/Z/API/Z/keys/layout.h +20 -0
- data/src/external/Z/API/Z/keys/mathematics/geometry.h +29 -0
- data/src/external/Z/API/Z/keys/mathematics/number.h +21 -0
- data/src/external/Z/API/Z/keys/order.h +18 -0
- data/src/external/Z/API/Z/keys/platform.h +87 -0
- data/src/external/Z/API/Z/keys/program.h +39 -0
- data/src/external/Z/API/Z/keys/science/chemical elements.h +200 -0
- data/src/external/Z/API/Z/keys/science/electricity.h +18 -0
- data/src/external/Z/API/Z/keys/science/magnetism.h +19 -0
- data/src/external/Z/API/Z/keys/status.h +69 -0
- data/src/external/Z/API/Z/keys/text.h +27 -0
- data/src/external/Z/API/Z/keys/value.h +88 -0
- data/src/external/Z/API/Z/macros/arguments.h +25 -0
- data/src/external/Z/API/Z/macros/casting.h +22 -0
- data/src/external/Z/API/Z/macros/character.h +159 -0
- data/src/external/Z/API/Z/macros/date.h +14 -0
- data/src/external/Z/API/Z/macros/key.h +20 -0
- data/src/external/Z/API/Z/macros/language.h +126 -0
- data/src/external/Z/API/Z/macros/language.hpp +81 -0
- data/src/external/Z/API/Z/macros/members.h +86 -0
- data/src/external/Z/API/Z/macros/pasting.h +308 -0
- data/src/external/Z/API/Z/macros/pointer.h +33 -0
- data/src/external/Z/API/Z/macros/repetition.h +283 -0
- data/src/external/Z/API/Z/macros/structure.h +104 -0
- data/src/external/Z/API/Z/macros/templating.h +407 -0
- data/src/external/Z/API/Z/macros/tokens.h +14 -0
- data/src/external/Z/API/Z/macros/type enumeration.h +43 -0
- data/src/external/Z/API/Z/macros/type selection.hpp +76 -0
- data/src/external/Z/API/Z/macros/value.h +489 -0
- data/src/external/Z/API/Z/macros/variadic pasting.h +21 -0
- data/src/external/Z/API/Z/macros/variadic selection.h +56 -0
- data/src/external/Z/API/Z/macros/variadic.h +46 -0
- data/src/external/Z/API/Z/macros/version.h +17 -0
- data/src/external/Z/API/Z/network/3/IP.h +36 -0
- data/src/external/Z/API/Z/network/4/TCP.h +24 -0
- data/src/external/Z/API/Z/network/4/UDP.h +26 -0
- data/src/external/Z/API/Z/network/7/ED2K.h +104 -0
- data/src/external/Z/API/Z/network/7/HTTP.h +100 -0
- data/src/external/Z/API/Z/traits/SelectType.hpp +71 -0
- data/src/external/Z/API/Z/traits/TernaryType.hpp +20 -0
- data/src/external/Z/API/Z/traits/Type.hpp +4516 -0
- data/src/external/Z/API/Z/traits/TypeCount.hpp +52 -0
- data/src/external/Z/API/Z/traits/TypeList.hpp +376 -0
- data/src/external/Z/API/Z/traits/base.hpp +19 -0
- data/src/external/Z/API/Z/traits/filtering.hpp +30 -0
- data/src/external/Z/API/Z/traits/mathematics.hpp +48 -0
- data/src/external/Z/API/Z/types/arguments.h +19 -0
- data/src/external/Z/API/Z/types/base.h +1655 -0
- data/src/external/Z/API/Z/types/base.hpp +169 -0
- data/src/external/Z/API/Z/types/buffering.h +27 -0
- data/src/external/Z/API/Z/types/mathematics.h +135 -0
- data/src/external/Z/API/Z/types/time.h +23 -0
- data/src/external/Z/COPYING.LESSER +165 -0
- data/src/external/Z/development/Qt Creator/Z.pro +253 -0
- data/src/external/Z/distribution/CocoaPods/Zeta.podspec +18 -0
- data/src/external/Z/distribution/Gentoo Linux/Zeta-0.1.ebuild +22 -0
- data/src/external/Z/distribution/Gentoo Linux/metadata.xml +8 -0
- data/src/external/Z/distribution/Homebrew/Zeta.rb +11 -0
- data/src/external/z80/API/emulation/CPU/Z80.h +201 -0
- data/src/external/z80/README.md +229 -0
- data/src/external/z80/building/premake4.lua +33 -0
- data/src/external/z80/development/Xcode/Z80.xcodeproj/project.pbxproj +520 -0
- data/src/external/z80/sources/Z80.c +1660 -0
- data/src/interrupt.c +6 -0
- data/src/interrupt.h +3 -0
- data/src/io.c.erb +115 -0
- data/src/io.h.erb +18 -0
- data/src/main.c +69 -0
- data/src/memory.c.erb +43 -0
- data/src/memory.h.erb +9 -0
- metadata +329 -0
@@ -0,0 +1,712 @@
|
|
1
|
+
/* Z Kit - functions/base/Z3D.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
6
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
7
|
+
|
8
|
+
#ifndef _Z_functions_base_Z3D_H_
|
9
|
+
#define _Z_functions_base_Z3D_H_
|
10
|
+
|
11
|
+
#include <Z/functions/base/constructors.h>
|
12
|
+
#include <Z/functions/base/value.h>
|
13
|
+
|
14
|
+
|
15
|
+
/* MARK: - Common implementation */
|
16
|
+
|
17
|
+
|
18
|
+
#define Z_IMPLEMENTATION_COMMON(Type, type) \
|
19
|
+
\
|
20
|
+
static Z_INLINE \
|
21
|
+
Z3D##Type z_3d_##type##_add(Z3D##Type a, Z3D##Type b) \
|
22
|
+
{return z_3d_##type(a.x + b.x, a.y + b.y, a.z + b.z);} \
|
23
|
+
\
|
24
|
+
\
|
25
|
+
static Z_INLINE \
|
26
|
+
Z3D##Type z_3d_##type##_add_3(Z3D##Type a, Z3D##Type b, Z3D##Type c) \
|
27
|
+
{ \
|
28
|
+
return z_3d_##type \
|
29
|
+
(a.x + b.x + c.x, a.y + b.y + c.y, a.z + b.z + c.z); \
|
30
|
+
} \
|
31
|
+
\
|
32
|
+
\
|
33
|
+
static Z_INLINE \
|
34
|
+
Z3D##Type z_3d_##type##_add_4(Z3D##Type a, Z3D##Type b, Z3D##Type c, Z3D##Type d) \
|
35
|
+
{ \
|
36
|
+
return z_3d_##type \
|
37
|
+
(a.x + b.x + c.x + d.x, a.y + b.y + c.y + d.y, a.z + b.z + c.z + d.z); \
|
38
|
+
} \
|
39
|
+
\
|
40
|
+
\
|
41
|
+
static Z_INLINE \
|
42
|
+
Z3D##Type z_3d_##type##_add_scalar(Z3D##Type object, z##type scalar) \
|
43
|
+
{return z_3d_##type(object.x + scalar, object.y + scalar, object.z + scalar);} \
|
44
|
+
\
|
45
|
+
\
|
46
|
+
static Z_INLINE \
|
47
|
+
zboolean z_3d_##type##_are_equal(Z3D##Type a, Z3D##Type b) \
|
48
|
+
{return a.x == b.x && a.y == b.y && a.z == b.z;} \
|
49
|
+
\
|
50
|
+
\
|
51
|
+
static Z_INLINE \
|
52
|
+
Z3D##Type z_3d_##type##_clamp(Z3D##Type object, Z3D##Type minimum, Z3D##Type maximum) \
|
53
|
+
{ \
|
54
|
+
return z_3d_##type \
|
55
|
+
(z_##type##_clamp(object.x, minimum.x, maximum.x), \
|
56
|
+
z_##type##_clamp(object.y, minimum.y, maximum.y), \
|
57
|
+
z_##type##_clamp(object.z, minimum.z, maximum.z)); \
|
58
|
+
} \
|
59
|
+
\
|
60
|
+
\
|
61
|
+
static Z_INLINE \
|
62
|
+
Z3D##Type z_3d_##type##_cross_product(Z3D##Type a, Z3D##Type b) \
|
63
|
+
{ \
|
64
|
+
return z_3d_##type \
|
65
|
+
(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); \
|
66
|
+
} \
|
67
|
+
\
|
68
|
+
\
|
69
|
+
static Z_INLINE \
|
70
|
+
Z3D##Type z_3d_##type##_cube_clamp(Z3D##Type object, z##type minimum, z##type maximum) \
|
71
|
+
{ \
|
72
|
+
return z_3d_##type \
|
73
|
+
(z_##type##_clamp(object.x, minimum, maximum), \
|
74
|
+
z_##type##_clamp(object.y, minimum, maximum), \
|
75
|
+
z_##type##_clamp(object.z, minimum, maximum)); \
|
76
|
+
} \
|
77
|
+
\
|
78
|
+
\
|
79
|
+
static Z_INLINE \
|
80
|
+
Z3D##Type z_3d_##type##_divide(Z3D##Type a, Z3D##Type b) \
|
81
|
+
{return z_3d_##type(a.x / b.x, a.y / b.y, a.z / b.z);} \
|
82
|
+
\
|
83
|
+
\
|
84
|
+
static Z_INLINE \
|
85
|
+
Z3D##Type z_3d_##type##_divide_3(Z3D##Type a, Z3D##Type b, Z3D##Type c) \
|
86
|
+
{return z_3d_##type(a.x / b.x / c.x, a.y / b.y / c.y, a.z / b.z / c.z);} \
|
87
|
+
\
|
88
|
+
\
|
89
|
+
static Z_INLINE \
|
90
|
+
Z3D##Type z_3d_##type##_divide_4(Z3D##Type a, Z3D##Type b, Z3D##Type c, Z3D##Type d) \
|
91
|
+
{ \
|
92
|
+
return z_3d_##type \
|
93
|
+
(a.x / b.x / c.x / d.x, a.y / b.y / c.y / d.y, a.z / b.z / c.z / d.z); \
|
94
|
+
} \
|
95
|
+
\
|
96
|
+
\
|
97
|
+
static Z_INLINE \
|
98
|
+
Z3D##Type z_3d_##type##_divide_by_scalar(Z3D##Type object, z##type scalar) \
|
99
|
+
{return z_3d_##type(object.x / scalar, object.y / scalar, object.z / scalar);} \
|
100
|
+
\
|
101
|
+
\
|
102
|
+
static Z_INLINE \
|
103
|
+
z##type z_3d_##type##_dot_product(Z3D##Type a, Z3D##Type b) \
|
104
|
+
{return a.x * b.x + a.y * b.y + a.z * b.z;} \
|
105
|
+
\
|
106
|
+
\
|
107
|
+
static Z_INLINE \
|
108
|
+
Z3D##Type z_3d_##type##_fit(Z3D##Type object, Z3D##Type other) \
|
109
|
+
{ \
|
110
|
+
/* TO DO */ \
|
111
|
+
return z_3d_##type##_add(object, other); \
|
112
|
+
/*return z_3d_##type##_zero;*/ \
|
113
|
+
} \
|
114
|
+
\
|
115
|
+
\
|
116
|
+
static Z_INLINE \
|
117
|
+
Z3D##Type z_3d_##type##_from_scalar(z##type scalar) \
|
118
|
+
{return z_3d_##type(scalar, scalar, scalar);} \
|
119
|
+
\
|
120
|
+
\
|
121
|
+
static Z_INLINE \
|
122
|
+
zboolean z_3d_##type##_has_zero(Z3D##Type object) \
|
123
|
+
{return object.x == (z##type)0 || object.y == (z##type)0 || object.z == (z##type)0;} \
|
124
|
+
\
|
125
|
+
\
|
126
|
+
static Z_INLINE \
|
127
|
+
z##type z_3d_##type##_inner_maximum(Z3D##Type object) \
|
128
|
+
{return z_##type##_maximum(z_##type##_maximum(object.x, object.y), object.z);} \
|
129
|
+
\
|
130
|
+
\
|
131
|
+
static Z_INLINE \
|
132
|
+
z##type z_3d_##type##_inner_middle(Z3D##Type object) \
|
133
|
+
{return (object.x + object.y + object.z) / (z##type)3;} \
|
134
|
+
\
|
135
|
+
\
|
136
|
+
static Z_INLINE \
|
137
|
+
z##type z_3d_##type##_inner_minimum(Z3D##Type object) \
|
138
|
+
{return z_##type##_minimum(z_##type##_minimum(object.x, object.y), object.z);} \
|
139
|
+
\
|
140
|
+
\
|
141
|
+
static Z_INLINE \
|
142
|
+
z##type z_3d_##type##_inner_product(Z3D##Type object) \
|
143
|
+
{return object.x * object.y * object.z;} \
|
144
|
+
\
|
145
|
+
\
|
146
|
+
static Z_INLINE \
|
147
|
+
z##type z_3d_##type##_inner_sum(Z3D##Type object) \
|
148
|
+
{return object.x + object.y + object.z;} \
|
149
|
+
\
|
150
|
+
\
|
151
|
+
static Z_INLINE \
|
152
|
+
zboolean z_3d_##type##_is_zero(Z3D##Type object) \
|
153
|
+
{return object.x == (z##type)0 && object.y == (z##type)0 && object.z == (z##type)0;} \
|
154
|
+
\
|
155
|
+
\
|
156
|
+
static Z_INLINE \
|
157
|
+
Z3D##Type z_3d_##type##_maximum(Z3D##Type a, Z3D##Type b) \
|
158
|
+
{ \
|
159
|
+
return z_3d_##type \
|
160
|
+
(z_##type##_maximum(a.x, b.x), \
|
161
|
+
z_##type##_maximum(a.y, b.y), \
|
162
|
+
z_##type##_maximum(a.z, b.z)); \
|
163
|
+
} \
|
164
|
+
\
|
165
|
+
\
|
166
|
+
static Z_INLINE \
|
167
|
+
Z3D##Type z_3d_##type##_middle(Z3D##Type a, Z3D##Type b) \
|
168
|
+
{ \
|
169
|
+
return z_3d_##type \
|
170
|
+
((a.x + b.x) / (z##type)2, (a.y + b.y) / (z##type)2, (a.z + b.z) / (z##type)2); \
|
171
|
+
} \
|
172
|
+
\
|
173
|
+
\
|
174
|
+
static Z_INLINE \
|
175
|
+
Z3D##Type z_3d_##type##_minimum(Z3D##Type a, Z3D##Type b) \
|
176
|
+
{ \
|
177
|
+
return z_3d_##type \
|
178
|
+
(z_##type##_minimum(a.x, b.x), \
|
179
|
+
z_##type##_minimum(a.y, b.y), \
|
180
|
+
z_##type##_minimum(a.z, b.z)); \
|
181
|
+
} \
|
182
|
+
\
|
183
|
+
\
|
184
|
+
static Z_INLINE \
|
185
|
+
Z3D##Type z_3d_##type##_multiply(Z3D##Type a, Z3D##Type b) \
|
186
|
+
{return z_3d_##type(a.x * b.x, a.y * b.y, a.z * b.z);} \
|
187
|
+
\
|
188
|
+
\
|
189
|
+
static Z_INLINE \
|
190
|
+
Z3D##Type z_3d_##type##_multiply_3(Z3D##Type a, Z3D##Type b, Z3D##Type c) \
|
191
|
+
{return z_3d_##type(a.x * b.x * c.x, a.y * b.y * c.y, a.z * b.z * c.z);} \
|
192
|
+
\
|
193
|
+
\
|
194
|
+
static Z_INLINE \
|
195
|
+
Z3D##Type z_3d_##type##_multiply_4(Z3D##Type a, Z3D##Type b, Z3D##Type c, Z3D##Type d) \
|
196
|
+
{ \
|
197
|
+
return z_3d_##type \
|
198
|
+
(a.x * b.x * c.x * d.x, a.y * b.y * c.y * d.y, a.z * b.z * c.z * d.z); \
|
199
|
+
} \
|
200
|
+
\
|
201
|
+
\
|
202
|
+
static Z_INLINE \
|
203
|
+
Z3D##Type z_3d_##type##_multiply_by_scalar(Z3D##Type object, z##type scalar) \
|
204
|
+
{return z_3d_##type(object.x * scalar, object.y * scalar, object.z * scalar);} \
|
205
|
+
\
|
206
|
+
\
|
207
|
+
static Z_INLINE \
|
208
|
+
Z3D##Type z_3d_##type##_rotate_as_axes(Z3D##Type object, Z3DSInt8 rotation) \
|
209
|
+
{ \
|
210
|
+
if ((rotation.x % 4) & 1) z_##type##_swap(&object.y, &object.z); \
|
211
|
+
if ((rotation.y % 4) & 1) z_##type##_swap(&object.x, &object.z); \
|
212
|
+
if ((rotation.z % 4) & 1) z_##type##_swap(&object.x, &object.y); \
|
213
|
+
return object; \
|
214
|
+
} \
|
215
|
+
\
|
216
|
+
\
|
217
|
+
static Z_INLINE \
|
218
|
+
z##type z_3d_##type##_squared_length(Z3D##Type object) \
|
219
|
+
{return object.x * object.x + object.y * object.y + object.z * object.z;} \
|
220
|
+
\
|
221
|
+
\
|
222
|
+
static Z_INLINE \
|
223
|
+
Z3D##Type z_3d_##type##_subtract(Z3D##Type a, Z3D##Type b) \
|
224
|
+
{return z_3d_##type(a.x - b.x, a.y - b.y, a.z - b.z);} \
|
225
|
+
\
|
226
|
+
\
|
227
|
+
static Z_INLINE \
|
228
|
+
Z3D##Type z_3d_##type##_subtract_3(Z3D##Type a, Z3D##Type b, Z3D##Type c) \
|
229
|
+
{return z_3d_##type(a.x - b.x - c.x, a.y - b.y - c.y, a.z - b.z - c.z);} \
|
230
|
+
\
|
231
|
+
\
|
232
|
+
static Z_INLINE \
|
233
|
+
Z3D##Type z_3d_##type##_subtract_4(Z3D##Type a, Z3D##Type b, Z3D##Type c, Z3D##Type d) \
|
234
|
+
{ \
|
235
|
+
return z_3d_##type \
|
236
|
+
(a.x - b.x - c.x - d.x, a.y - b.y - c.y - d.y, a.z - b.z - c.z - d.z); \
|
237
|
+
} \
|
238
|
+
\
|
239
|
+
\
|
240
|
+
static Z_INLINE \
|
241
|
+
Z3D##Type z_3d_##type##_subtract_scalar(Z3D##Type object, z##type scalar) \
|
242
|
+
{return z_3d_##type(object.x - scalar, object.y - scalar, object.z - scalar);} \
|
243
|
+
\
|
244
|
+
\
|
245
|
+
static Z_INLINE \
|
246
|
+
void z_3d_##type##_swap(Z3D##Type *a, Z3D##Type *b) \
|
247
|
+
{ \
|
248
|
+
Z3D##Type t = *a; \
|
249
|
+
\
|
250
|
+
*a = *b; *b = t; \
|
251
|
+
} \
|
252
|
+
\
|
253
|
+
\
|
254
|
+
static Z_INLINE \
|
255
|
+
Z2D##Type z_3d_##type##_xy(Z3D##Type object) \
|
256
|
+
{return z_2d_##type(object.x, object.y);} \
|
257
|
+
\
|
258
|
+
\
|
259
|
+
static Z_INLINE \
|
260
|
+
Z2D##Type z_3d_##type##_xz(Z3D##Type object) \
|
261
|
+
{return z_2d_##type(object.x, object.z);} \
|
262
|
+
\
|
263
|
+
\
|
264
|
+
static Z_INLINE \
|
265
|
+
Z3D##Type z_3d_##type##_xzy(Z3D##Type object) \
|
266
|
+
{return z_3d_##type(object.x, object.z, object.y);} \
|
267
|
+
\
|
268
|
+
\
|
269
|
+
static Z_INLINE \
|
270
|
+
Z2D##Type z_3d_##type##_yx(Z3D##Type object) \
|
271
|
+
{return z_2d_##type(object.y, object.x);} \
|
272
|
+
\
|
273
|
+
\
|
274
|
+
static Z_INLINE \
|
275
|
+
Z3D##Type z_3d_##type##_yxz(Z3D##Type object) \
|
276
|
+
{return z_3d_##type(object.y, object.x, object.z);} \
|
277
|
+
\
|
278
|
+
\
|
279
|
+
static Z_INLINE \
|
280
|
+
Z2D##Type z_3d_##type##_yz(Z3D##Type object) \
|
281
|
+
{return z_2d_##type(object.y, object.z);} \
|
282
|
+
\
|
283
|
+
\
|
284
|
+
static Z_INLINE \
|
285
|
+
Z3D##Type z_3d_##type##_yzx(Z3D##Type object) \
|
286
|
+
{return z_3d_##type(object.y, object.z, object.x);} \
|
287
|
+
\
|
288
|
+
\
|
289
|
+
static Z_INLINE \
|
290
|
+
Z2D##Type z_3d_##type##_zx(Z3D##Type object) \
|
291
|
+
{return z_2d_##type(object.z, object.x);} \
|
292
|
+
\
|
293
|
+
\
|
294
|
+
static Z_INLINE \
|
295
|
+
Z3D##Type z_3d_##type##_zxy(Z3D##Type object) \
|
296
|
+
{return z_3d_##type(object.z, object.x, object.y);} \
|
297
|
+
\
|
298
|
+
\
|
299
|
+
static Z_INLINE \
|
300
|
+
Z2D##Type z_3d_##type##_zy(Z3D##Type object) \
|
301
|
+
{return z_2d_##type(object.z, object.y);} \
|
302
|
+
\
|
303
|
+
\
|
304
|
+
static Z_INLINE \
|
305
|
+
Z3D##Type z_3d_##type##_zyx(Z3D##Type object) \
|
306
|
+
{return z_3d_##type(object.z, object.y, object.x);}
|
307
|
+
|
308
|
+
|
309
|
+
#define z_3d_type_add( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _add )
|
310
|
+
#define z_3d_type_add_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _add_3 )
|
311
|
+
#define z_3d_type_add_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _add_4 )
|
312
|
+
#define z_3d_type_add_scalar( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _add_scalar )
|
313
|
+
#define z_3d_type_are_equal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _are_equal )
|
314
|
+
#define z_3d_type_clamp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _clamp )
|
315
|
+
#define z_3d_type_cross_product( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _cross_product )
|
316
|
+
#define z_3d_type_cube_clamp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _cube_clamp )
|
317
|
+
#define z_3d_type_divide( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _divide )
|
318
|
+
#define z_3d_type_divide_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _divide_3 )
|
319
|
+
#define z_3d_type_divide_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _divide_4 )
|
320
|
+
#define z_3d_type_divide_by_scalar( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _divide_by_scalar )
|
321
|
+
#define z_3d_type_dot_product( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _dot_product )
|
322
|
+
#define z_3d_type_fit( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _fit )
|
323
|
+
#define z_3d_type_from_scalar( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _from_scalar )
|
324
|
+
#define z_3d_type_has_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_zero )
|
325
|
+
#define z_3d_type_inner_maximum( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inner_maximum )
|
326
|
+
#define z_3d_type_inner_middle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inner_middle )
|
327
|
+
#define z_3d_type_inner_minimum( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inner_minimum )
|
328
|
+
#define z_3d_type_inner_product( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inner_product )
|
329
|
+
#define z_3d_type_inner_sum( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inner_sum )
|
330
|
+
#define z_3d_type_is_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_zero )
|
331
|
+
#define z_3d_type_maximum( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _maximum )
|
332
|
+
#define z_3d_type_middle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _middle )
|
333
|
+
#define z_3d_type_minimum( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _minimum )
|
334
|
+
#define z_3d_type_multiply( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _multiply )
|
335
|
+
#define z_3d_type_multiply_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _multiply_3 )
|
336
|
+
#define z_3d_type_multiply_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _multiply_4 )
|
337
|
+
#define z_3d_type_multiply_by_scalar(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _multiply_by_scalar)
|
338
|
+
#define z_3d_type_rotate_as_axes( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _rotate_as_axes )
|
339
|
+
#define z_3d_type_squared_length( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _squared_length )
|
340
|
+
#define z_3d_type_subtract( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _subtract )
|
341
|
+
#define z_3d_type_subtract_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _subtract_3 )
|
342
|
+
#define z_3d_type_subtract_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _subtract_4 )
|
343
|
+
#define z_3d_type_subtract_scalar( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _subtract_scalar )
|
344
|
+
#define z_3d_type_swap( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _swap )
|
345
|
+
#define z_3d_type_xy( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _xy )
|
346
|
+
#define z_3d_type_xz( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _xz )
|
347
|
+
#define z_3d_type_xzy( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _xzy )
|
348
|
+
#define z_3d_type_yx( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _yx )
|
349
|
+
#define z_3d_type_yxz( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _yxz )
|
350
|
+
#define z_3d_type_yz( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _yz )
|
351
|
+
#define z_3d_type_yzx( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _yzx )
|
352
|
+
#define z_3d_type_zx( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _zx )
|
353
|
+
#define z_3d_type_zxy( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _zxy )
|
354
|
+
#define z_3d_type_zy( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _zy )
|
355
|
+
#define z_3d_type_zyx( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _zyx )
|
356
|
+
|
357
|
+
|
358
|
+
/* MARK: - Partial implementation for signed types */
|
359
|
+
|
360
|
+
|
361
|
+
#define Z_IMPLEMENTATION_SIGNED(Type, type) \
|
362
|
+
\
|
363
|
+
static Z_INLINE \
|
364
|
+
Z3D##Type z_3d_##type##_absolute(Z3D##Type object) \
|
365
|
+
{ \
|
366
|
+
return z_3d_##type \
|
367
|
+
(z_##type##_absolute(object.x), \
|
368
|
+
z_##type##_absolute(object.y), \
|
369
|
+
z_##type##_absolute(object.z)); \
|
370
|
+
} \
|
371
|
+
\
|
372
|
+
\
|
373
|
+
static Z_INLINE \
|
374
|
+
zboolean z_3d_##type##_has_negative(Z3D##Type object) \
|
375
|
+
{return object.x < (z##type)0 || object.y < (z##type)0 || object.z < (z##type)0;} \
|
376
|
+
\
|
377
|
+
\
|
378
|
+
static Z_INLINE \
|
379
|
+
zboolean z_3d_##type##_is_negative(Z3D##Type object) \
|
380
|
+
{return object.x < (z##type)0 && object.y < (z##type)0 && object.z < (z##type)0;} \
|
381
|
+
\
|
382
|
+
\
|
383
|
+
static Z_INLINE \
|
384
|
+
Z3D##Type z_3d_##type##_negative(Z3D##Type object) \
|
385
|
+
{return z_3d_##type(-object.x, -object.y, -object.z);}
|
386
|
+
|
387
|
+
|
388
|
+
#define z_3d_type_absolute( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _absolute )
|
389
|
+
#define z_3d_type_has_negative(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_negative)
|
390
|
+
#define z_3d_type_is_negative( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_negative )
|
391
|
+
#define z_3d_type_negative( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _negative )
|
392
|
+
|
393
|
+
|
394
|
+
/* MARK: - Partial implementation for integer types */
|
395
|
+
|
396
|
+
|
397
|
+
#define Z_IMPLEMENTATION_INTEGER(Type, type) \
|
398
|
+
\
|
399
|
+
Z_INLINE zboolean z_3d_##type##_are_perpendicular(Z3D##Type a, Z3D##Type b) \
|
400
|
+
{return !z_##type##_absolute(z_3d_##type##_dot_product(a, b));}
|
401
|
+
|
402
|
+
|
403
|
+
#define z_3d_type_are_perpendicular(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _are_perpendicular)
|
404
|
+
|
405
|
+
|
406
|
+
/* MARK: - Partial implementation for real types */
|
407
|
+
|
408
|
+
|
409
|
+
#define Z_IMPLEMENTATION_REAL(Type, type, epsilon) \
|
410
|
+
\
|
411
|
+
static Z_INLINE \
|
412
|
+
zboolean z_3d_##type##_are_almost_equal(Z3D##Type a, Z3D##Type b) \
|
413
|
+
{ \
|
414
|
+
return z_##type##_are_almost_equal(a.x, b.x) && \
|
415
|
+
z_##type##_are_almost_equal(a.y, b.y) && \
|
416
|
+
z_##type##_are_almost_equal(a.z, b.z); \
|
417
|
+
} \
|
418
|
+
\
|
419
|
+
\
|
420
|
+
static Z_INLINE \
|
421
|
+
zboolean z_3d_##type##_are_perpendicular(Z3D##Type a, Z3D##Type b) \
|
422
|
+
{return z_##type##_absolute(z_3d_##type##_dot_product(a, b)) <= epsilon;} \
|
423
|
+
\
|
424
|
+
\
|
425
|
+
static Z_INLINE \
|
426
|
+
Z3D##Type z_3d_##type##_clamp_01(Z3D##Type object) \
|
427
|
+
{ \
|
428
|
+
return z_3d_##type \
|
429
|
+
(z_##type##_clamp_01(object.x), \
|
430
|
+
z_##type##_clamp_01(object.y), \
|
431
|
+
z_##type##_clamp_01(object.z)); \
|
432
|
+
} \
|
433
|
+
\
|
434
|
+
\
|
435
|
+
static Z_INLINE \
|
436
|
+
zboolean z_3d_##type##_has_almost_zero(Z3D##Type object) \
|
437
|
+
{ \
|
438
|
+
return z_##type##_is_almost_zero(object.x) || \
|
439
|
+
z_##type##_is_almost_zero(object.y) || \
|
440
|
+
z_##type##_is_almost_zero(object.z); \
|
441
|
+
} \
|
442
|
+
\
|
443
|
+
\
|
444
|
+
static Z_INLINE \
|
445
|
+
zboolean z_3d_##type##_has_finite(Z3D##Type object) \
|
446
|
+
{ \
|
447
|
+
return z_##type##_is_finite(object.x) || \
|
448
|
+
z_##type##_is_finite(object.y) || \
|
449
|
+
z_##type##_is_finite(object.z); \
|
450
|
+
} \
|
451
|
+
\
|
452
|
+
\
|
453
|
+
static Z_INLINE \
|
454
|
+
zboolean z_3d_##type##_has_infinity(Z3D##Type object) \
|
455
|
+
{ \
|
456
|
+
return z_##type##_is_infinity(object.x) || \
|
457
|
+
z_##type##_is_infinity(object.y) || \
|
458
|
+
z_##type##_is_infinity(object.z); \
|
459
|
+
} \
|
460
|
+
\
|
461
|
+
\
|
462
|
+
static Z_INLINE \
|
463
|
+
zboolean z_3d_##type##_has_nan(Z3D##Type object) \
|
464
|
+
{ \
|
465
|
+
return z_##type##_is_nan(object.x) || \
|
466
|
+
z_##type##_is_nan(object.y) || \
|
467
|
+
z_##type##_is_nan(object.z); \
|
468
|
+
} \
|
469
|
+
\
|
470
|
+
\
|
471
|
+
static Z_INLINE \
|
472
|
+
Z3D##Type z_3d_##type##_inverse_lerp(Z3D##Type a, Z3D##Type b, z##type t) \
|
473
|
+
{ \
|
474
|
+
return z_3d_##type \
|
475
|
+
(z_##type##_inverse_lerp(a.x, b.x, t), \
|
476
|
+
z_##type##_inverse_lerp(a.y, b.y, t), \
|
477
|
+
z_##type##_inverse_lerp(a.z, b.z, t)); \
|
478
|
+
} \
|
479
|
+
\
|
480
|
+
\
|
481
|
+
static Z_INLINE \
|
482
|
+
zboolean z_3d_##type##_is_almost_zero(Z3D##Type object) \
|
483
|
+
{ \
|
484
|
+
return z_##type##_is_almost_zero(object.x) && \
|
485
|
+
z_##type##_is_almost_zero(object.y) && \
|
486
|
+
z_##type##_is_almost_zero(object.z); \
|
487
|
+
} \
|
488
|
+
\
|
489
|
+
\
|
490
|
+
static Z_INLINE \
|
491
|
+
zboolean z_3d_##type##_is_finite(Z3D##Type object) \
|
492
|
+
{ \
|
493
|
+
return z_##type##_is_finite(object.x) && \
|
494
|
+
z_##type##_is_finite(object.y) && \
|
495
|
+
z_##type##_is_finite(object.z); \
|
496
|
+
} \
|
497
|
+
\
|
498
|
+
\
|
499
|
+
static Z_INLINE \
|
500
|
+
zboolean z_3d_##type##_is_infinity(Z3D##Type object) \
|
501
|
+
{ \
|
502
|
+
return z_##type##_is_infinity(object.x) && \
|
503
|
+
z_##type##_is_infinity(object.y) && \
|
504
|
+
z_##type##_is_infinity(object.z); \
|
505
|
+
} \
|
506
|
+
\
|
507
|
+
\
|
508
|
+
static Z_INLINE \
|
509
|
+
zboolean z_3d_##type##_is_nan(Z3D##Type object) \
|
510
|
+
{ \
|
511
|
+
return z_##type##_is_nan(object.x) && \
|
512
|
+
z_##type##_is_nan(object.y) && \
|
513
|
+
z_##type##_is_nan(object.z); \
|
514
|
+
} \
|
515
|
+
\
|
516
|
+
\
|
517
|
+
static Z_INLINE \
|
518
|
+
Z3D##Type z_3d_##type##_lerp(Z3D##Type a, Z3D##Type b, z##type t) \
|
519
|
+
{ \
|
520
|
+
return z_3d_##type \
|
521
|
+
(z_##type##_lerp(a.x, b.x, t), \
|
522
|
+
z_##type##_lerp(a.y, b.y, t), \
|
523
|
+
z_##type##_lerp(a.z, b.z, t)); \
|
524
|
+
} \
|
525
|
+
\
|
526
|
+
\
|
527
|
+
static Z_INLINE \
|
528
|
+
Z3D##Type z_3d_##type##_reciprocal(Z3D##Type object) \
|
529
|
+
{ \
|
530
|
+
return z_3d_##type \
|
531
|
+
(((z##type)1) / object.x, \
|
532
|
+
((z##type)1) / object.y, \
|
533
|
+
((z##type)1) / object.z); \
|
534
|
+
}
|
535
|
+
|
536
|
+
|
537
|
+
#define z_3d_type_are_almost_equal(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _are_almost_equal)
|
538
|
+
#define z_3d_type_clamp_01( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _clamp_01 )
|
539
|
+
#define z_3d_type_has_almost_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_almost_zero )
|
540
|
+
#define z_3d_type_has_finite( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_finite )
|
541
|
+
#define z_3d_type_has_infinity( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_infinity )
|
542
|
+
#define z_3d_type_has_nan( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _has_nan )
|
543
|
+
#define z_3d_type_inverse_lerp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _inverse_lerp )
|
544
|
+
#define z_3d_type_is_almost_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_almost_zero )
|
545
|
+
#define z_3d_type_is_finite( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_finite )
|
546
|
+
#define z_3d_type_is_infinity( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_infinity )
|
547
|
+
#define z_3d_type_is_nan( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _is_nan )
|
548
|
+
#define z_3d_type_lerp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _lerp )
|
549
|
+
#define z_3d_type_reciprocal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_, _reciprocal )
|
550
|
+
|
551
|
+
|
552
|
+
/* MARK: - Implementation expansions */
|
553
|
+
|
554
|
+
|
555
|
+
Z_IMPLEMENTATION_COMMON (UInt8, uint8 )
|
556
|
+
Z_IMPLEMENTATION_COMMON (SInt8, sint8 )
|
557
|
+
Z_IMPLEMENTATION_SIGNED (SInt8, sint8 )
|
558
|
+
Z_IMPLEMENTATION_INTEGER(SInt8, sint8 )
|
559
|
+
Z_IMPLEMENTATION_COMMON (UInt16, uint16)
|
560
|
+
Z_IMPLEMENTATION_COMMON (SInt16, sint16)
|
561
|
+
Z_IMPLEMENTATION_SIGNED (SInt16, sint16)
|
562
|
+
Z_IMPLEMENTATION_INTEGER(SInt16, sint16)
|
563
|
+
Z_IMPLEMENTATION_COMMON (UInt32, uint32)
|
564
|
+
Z_IMPLEMENTATION_COMMON (SInt32, sint32)
|
565
|
+
Z_IMPLEMENTATION_SIGNED (SInt32, sint32)
|
566
|
+
Z_IMPLEMENTATION_INTEGER(SInt32, sint32)
|
567
|
+
|
568
|
+
#ifdef Z_UINT64
|
569
|
+
Z_IMPLEMENTATION_COMMON(UInt64, uint64)
|
570
|
+
#endif
|
571
|
+
|
572
|
+
#ifdef Z_SINT64
|
573
|
+
Z_IMPLEMENTATION_COMMON (SInt64, sint64)
|
574
|
+
Z_IMPLEMENTATION_SIGNED (SInt64, sint64)
|
575
|
+
Z_IMPLEMENTATION_INTEGER(SInt64, sint64)
|
576
|
+
#endif
|
577
|
+
|
578
|
+
#ifdef Z_UINT128
|
579
|
+
Z_IMPLEMENTATION_COMMON(UInt128, uint128)
|
580
|
+
#endif
|
581
|
+
|
582
|
+
#ifdef Z_SINT128
|
583
|
+
Z_IMPLEMENTATION_COMMON (SInt128, sint128)
|
584
|
+
Z_IMPLEMENTATION_SIGNED (SInt128, sint128)
|
585
|
+
Z_IMPLEMENTATION_INTEGER(SInt128, sint128)
|
586
|
+
#endif
|
587
|
+
|
588
|
+
#ifdef Z_FLOAT16
|
589
|
+
Z_IMPLEMENTATION_COMMON(Float16, float16)
|
590
|
+
Z_IMPLEMENTATION_SIGNED(Float16, float16)
|
591
|
+
Z_IMPLEMENTATION_REAL (Float16, float16, Z_FLOAT16_EPSILON)
|
592
|
+
#endif
|
593
|
+
|
594
|
+
#ifdef Z_FLOAT32
|
595
|
+
Z_IMPLEMENTATION_COMMON(Float32, float32)
|
596
|
+
Z_IMPLEMENTATION_SIGNED(Float32, float32)
|
597
|
+
Z_IMPLEMENTATION_REAL (Float32, float32, Z_FLOAT32_EPSILON)
|
598
|
+
#endif
|
599
|
+
|
600
|
+
#ifdef Z_FLOAT64
|
601
|
+
Z_IMPLEMENTATION_COMMON(Float64, float64)
|
602
|
+
Z_IMPLEMENTATION_SIGNED(Float64, float64)
|
603
|
+
Z_IMPLEMENTATION_REAL (Float64, float64, Z_FLOAT64_EPSILON)
|
604
|
+
#endif
|
605
|
+
|
606
|
+
#ifdef Z_FLOAT128
|
607
|
+
Z_IMPLEMENTATION_COMMON(Float128, float128)
|
608
|
+
Z_IMPLEMENTATION_SIGNED(Float128, float128)
|
609
|
+
Z_IMPLEMENTATION_REAL (Float128, float128, Z_FLOAT128_EPSILON)
|
610
|
+
#endif
|
611
|
+
|
612
|
+
#ifdef Z_FLOAT80_X87
|
613
|
+
Z_IMPLEMENTATION_COMMON(Float80_x87, float80_x87)
|
614
|
+
Z_IMPLEMENTATION_SIGNED(Float80_x87, float80_x87)
|
615
|
+
Z_IMPLEMENTATION_REAL (Float80_x87, float80_x87, Z_FLOAT80_X87_EPSILON)
|
616
|
+
#endif
|
617
|
+
|
618
|
+
#ifdef Z_FLOAT96_X87
|
619
|
+
Z_IMPLEMENTATION_COMMON(Float96_x87, float96_x87)
|
620
|
+
Z_IMPLEMENTATION_SIGNED(Float96_x87, float96_x87)
|
621
|
+
Z_IMPLEMENTATION_REAL (Float96_x87, float96_x87, Z_FLOAT96_X87_EPSILON)
|
622
|
+
#endif
|
623
|
+
|
624
|
+
#ifdef Z_FLOAT128_X87
|
625
|
+
Z_IMPLEMENTATION_COMMON(Float128_x87, float128_x87)
|
626
|
+
Z_IMPLEMENTATION_SIGNED(Float128_x87, float128_x87)
|
627
|
+
Z_IMPLEMENTATION_REAL (Float128_x87, float128_x87, Z_FLOAT128_X87_EPSILON)
|
628
|
+
#endif
|
629
|
+
|
630
|
+
|
631
|
+
/* MARK: - Cleanup */
|
632
|
+
|
633
|
+
|
634
|
+
#undef Z_IMPLEMENTATION_COMMON
|
635
|
+
#undef Z_IMPLEMENTATION_SIGNED
|
636
|
+
#undef Z_IMPLEMENTATION_INTEGER
|
637
|
+
#undef Z_IMPLEMENTATION_REAL
|
638
|
+
|
639
|
+
|
640
|
+
/* MARK: - Default real type definitions */
|
641
|
+
|
642
|
+
|
643
|
+
#ifdef Z_REAL
|
644
|
+
# define z_3d_absolute z_3d_type_absolute (REAL)
|
645
|
+
# define z_3d_add z_3d_type_add (REAL)
|
646
|
+
# define z_3d_add_3 z_3d_type_add_3 (REAL)
|
647
|
+
# define z_3d_add_4 z_3d_type_add_4 (REAL)
|
648
|
+
# define z_3d_add_scalar z_3d_type_add_scalar (REAL)
|
649
|
+
# define z_3d_are_almost_equal z_3d_type_are_almost_equal (REAL)
|
650
|
+
# define z_3d_are_equal z_3d_type_are_equal (REAL)
|
651
|
+
# define z_3d_are_perpendicular z_3d_type_are_perpendicular (REAL)
|
652
|
+
# define z_3d_clamp z_3d_type_clamp (REAL)
|
653
|
+
# define z_3d_clamp_01 z_3d_type_clamp_01 (REAL)
|
654
|
+
# define z_3d_cross_product z_3d_type_cross_product (REAL)
|
655
|
+
# define z_3d_cube_clamp z_3d_type_cube_clamp (REAL)
|
656
|
+
# define z_3d_divide z_3d_type_divide (REAL)
|
657
|
+
# define z_3d_divide_3 z_3d_type_divide_3 (REAL)
|
658
|
+
# define z_3d_divide_4 z_3d_type_divide_4 (REAL)
|
659
|
+
# define z_3d_divide_by_scalar z_3d_type_divide_by_scalar (REAL)
|
660
|
+
# define z_3d_dot_product z_3d_type_dot_product (REAL)
|
661
|
+
# define z_3d_fit z_3d_type_fit (REAL)
|
662
|
+
# define z_3d_from_scalar z_3d_type_from_scalar (REAL)
|
663
|
+
# define z_3d_has_almost_zero z_3d_type_has_almost_zero (REAL)
|
664
|
+
# define z_3d_has_finite z_3d_type_has_finite (REAL)
|
665
|
+
# define z_3d_has_infinity z_3d_type_has_infinity (REAL)
|
666
|
+
# define z_3d_has_nan z_3d_type_has_nan (REAL)
|
667
|
+
# define z_3d_has_negative z_3d_type_has_negative (REAL)
|
668
|
+
# define z_3d_has_zero z_3d_type_has_zero (REAL)
|
669
|
+
# define z_3d_inner_maximum z_3d_type_inner_maximum (REAL)
|
670
|
+
# define z_3d_inner_middle z_3d_type_inner_middle (REAL)
|
671
|
+
# define z_3d_inner_minimum z_3d_type_inner_minimum (REAL)
|
672
|
+
# define z_3d_inner_product z_3d_type_inner_product (REAL)
|
673
|
+
# define z_3d_inner_sum z_3d_type_inner_sum (REAL)
|
674
|
+
# define z_3d_inverse_lerp z_3d_type_inverse_lerp (REAL)
|
675
|
+
# define z_3d_is_almost_zero z_3d_type_is_almost_zero (REAL)
|
676
|
+
# define z_3d_is_finite z_3d_type_is_finite (REAL)
|
677
|
+
# define z_3d_is_infinity z_3d_type_is_infinity (REAL)
|
678
|
+
# define z_3d_is_nan z_3d_type_is_nan (REAL)
|
679
|
+
# define z_3d_is_negative z_3d_type_is_negative (REAL)
|
680
|
+
# define z_3d_is_zero z_3d_type_is_zero (REAL)
|
681
|
+
# define z_3d_lerp z_3d_type_lerp (REAL)
|
682
|
+
# define z_3d_maximum z_3d_type_maximum (REAL)
|
683
|
+
# define z_3d_middle z_3d_type_middle (REAL)
|
684
|
+
# define z_3d_minimum z_3d_type_minimum (REAL)
|
685
|
+
# define z_3d_multiply z_3d_type_multiply (REAL)
|
686
|
+
# define z_3d_multiply_3 z_3d_type_multiply_3 (REAL)
|
687
|
+
# define z_3d_multiply_4 z_3d_type_multiply_4 (REAL)
|
688
|
+
# define z_3d_multiply_by_scalar z_3d_type_multiply_by_scalar(REAL)
|
689
|
+
# define z_3d_negative z_3d_type_negative (REAL)
|
690
|
+
# define z_3d_reciprocal z_3d_type_reciprocal (REAL)
|
691
|
+
# define z_3d_rotate_as_axes z_3d_type_rotate_as_axes (REAL)
|
692
|
+
# define z_3d_squared_length z_3d_type_squared_length (REAL)
|
693
|
+
# define z_3d_subtract z_3d_type_subtract (REAL)
|
694
|
+
# define z_3d_subtract_3 z_3d_type_subtract_3 (REAL)
|
695
|
+
# define z_3d_subtract_4 z_3d_type_subtract_4 (REAL)
|
696
|
+
# define z_3d_subtract_scalar z_3d_type_subtract_scalar (REAL)
|
697
|
+
# define z_3d_swap z_3d_type_swap (REAL)
|
698
|
+
# define z_3d_xy z_3d_type_xy (REAL)
|
699
|
+
# define z_3d_xz z_3d_type_xz (REAL)
|
700
|
+
# define z_3d_xzy z_3d_type_xzy (REAL)
|
701
|
+
# define z_3d_yx z_3d_type_yx (REAL)
|
702
|
+
# define z_3d_yxz z_3d_type_yxz (REAL)
|
703
|
+
# define z_3d_yz z_3d_type_yz (REAL)
|
704
|
+
# define z_3d_yzx z_3d_type_yzx (REAL)
|
705
|
+
# define z_3d_zx z_3d_type_zx (REAL)
|
706
|
+
# define z_3d_zxy z_3d_type_zxy (REAL)
|
707
|
+
# define z_3d_zy z_3d_type_zy (REAL)
|
708
|
+
# define z_3d_zyx z_3d_type_zyx (REAL)
|
709
|
+
#endif
|
710
|
+
|
711
|
+
|
712
|
+
#endif /* _Z_functions_base_Z3D_H_ */
|